Each-Step Goofiness
Posted: Wed Oct 31, 2012 12:03 am
I'm just now starting on what I hope to be my entry to HOTOHR. I'm also experiencing some goofiness with each-step scripts. I've worked around the problem for now, but I might need to know more about this later.
My game has a compass feature, that checks which direction the hero is facing and sets a text slice to display the appropriate information. I used a simple Each-Step script to accomplish that, but noticed that even though the script worked, everytime I started the game I got an invalid slice error.
Eventually, I determined this was because the Each-Step script was somehow occuring BEFORE my new game script which loads the slices. I used the following script to test which happened first and everytime I was immediately returned to the title screen.
Is that working as intended? I got around this problem by using the seteachstepscript command in my new game script, but I almost didn't try because the dictionary entry makes it sound like you can't use the @scriptname trick that the other map script commands use, and I couldn't find the old style command to define a plotscript.
In summary:
1) It seems like Each-Step scripts trigger before NewGame scripts. Is that expected?
2) The dictionary entry for seteachstepscript discouragingly implies it doesn't work like other similar commands, even though it does.
3) Is there ever a reason to use the old way of defining scripts?
Sorry if this is the wrong place to ask about this, or if this has been discussed before.
My game has a compass feature, that checks which direction the hero is facing and sets a text slice to display the appropriate information. I used a simple Each-Step script to accomplish that, but noticed that even though the script worked, everytime I started the game I got an invalid slice error.
Eventually, I determined this was because the Each-Step script was somehow occuring BEFORE my new game script which loads the slices. I used the following script to test which happened first and everytime I was immediately returned to the title screen.
Code: Select all
#I run on-each step and end the game if tag 4 is off!
plotscript,GoofySteps,begin
if (checktag (4)==off)
then (gameover)
end
#I run every new-game and set tag 4 on!
plotscript,GoofyNew,begin
settag (4,on)
end
In summary:
1) It seems like Each-Step scripts trigger before NewGame scripts. Is that expected?
2) The dictionary entry for seteachstepscript discouragingly implies it doesn't work like other similar commands, even though it does.
3) Is there ever a reason to use the old way of defining scripts?
Sorry if this is the wrong place to ask about this, or if this has been discussed before.