Jump to content

Help with a simple script


NinjaGoddessAyra

Recommended Posts

Okay so I guess I'll go ahead and say right off the bat that I have absolutely no programming experiance at all period. Morrowind was/is the first "language" I decided I really want to learn.

 

That being said, I went and took a look at Morrowind Scripting for Dummies, and it is an excellent well-written guide. After reading the first part of it and doing the first tutorial (the riddle chest) I decided to see if I could pull off the same script (the riddle chest) on my own using the knowledge I had just learned.

 

Well I decided to write my own erm....test script...? I guess you could call it that, basically seeing if I could pull of a basic version of the riddle chest on my own. I succeeded at making my own "riddle text script" so to speak only it does not do what I want it to do at all. After making a couple very minor changes, I compared it to the one in the Scripting for Dummies guide and it was all almost identical (save for the few message differences with mine.) so I have no idea why it does not do what I want it to.

 

Here is what I have for my version of the script:

 

begin aaa_riddle_test_script

 

short controlvar

short buttton

 

if (onactivate == 1)

if (controlvar == 0)

MessageBox "simple riddle with five answers", "choice one", "choice two", "choice three", "choice four", "choice five"

set controlvar to 1

elseif (controlvar > 1)

activate

endif

endif

 

if (controlvar == 1)

set button to getbuttonpressed

If (button == -1)

return

elseif (button == 2)

MessageBox "The answer is correct"

Activate

set controlvar to 2

else

messagebox "The answer is wrong"

set controlvar to -1

endif

elseif (controlvar == 2)

activate

set controlvar to 3

endif

 

end

 

I thought that looked okay and after I was done, I even compared it to the one in the guide, yet it does not work at all like how I wanted it too.

 

What I wanted it to do was if the player activates the chest, the menu pops up with the message and the five choices, if you pick choice 3, the chest would tell you "The answer is correct" and would open and you would have access to it from then on, if you chose any other choice, you would get a message saying "The answer is wrong" and the player would not be able to activate it after that.

 

What ends up happening is when I go to test it (I use the console command placeatpc etc.) the chest will give me the riddle message with the five choices like it was supposed to, and then once you click any choice at all, the message disappears altogether. Then when you go ahead and try to activate the chest again, nothing happens. However, if you type in the same console command (placeatpc etc.) and you try activating a copy of the same chest, it acts like any normal chest on activation, no message or anything at all.

 

I'm at my wits end here, I understand that this message was a little long and I understand that I'm a bit late in the game trying to learn the Morrowind scripting language, but I was wondering if anyone who was decent at scripting could please tell me what I'm doing wrong. Any help at all would be greatly appreciated.

Link to comment
Share on other sites

Wow please completely disregard that last post, I'm an idiot >.<

 

I only realized why the whole thing wasn't working after I went to reread the post.

 

Anyhow, it works the way it's supposed to now. Again, please disregard previous post.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...