Garrulous Glaahk Newtfeet Posted March 19, 2004 Share Posted March 19, 2004 When a creature/terrain script recieves a message, this is what happens, right? The creature/terrain script receiving the message is called as usual in the normal sequence (with my_current_message = -1), then: The same script is called (at the same state), only my_current_message is now the value of the message. In other words, if my_current_message <> 0, I can be sure this is the second time this script has been called this turn (unless the script is on a 8-turn cycle). Is that correct? Also, how do short variables in a script act? Do their values persist through one run of the script, until the script is reloaded, through the entire scenario, or what? What can I expect when using them? Link to comment Share on other sites More sharing options...
Magnificent Ornk Drakefyre Posted March 20, 2004 Share Posted March 20, 2004 I believe the first part is correct. As for the variables, I think that they are temporary for the run of the script, and they can't be used in any other thing because of their limited scope, which is one reason to use SDFs for everything you want to carry important data. Link to comment Share on other sites More sharing options...
Garrulous Glaahk Newtfeet Posted March 20, 2004 Author Share Posted March 20, 2004 So, I can only count on variables staying the same in a single state (and any other states I call in that state)? Link to comment Share on other sites More sharing options...
Magnificent Ornk Drakefyre Posted March 20, 2004 Share Posted March 20, 2004 Yes, AFAIK. Link to comment Share on other sites More sharing options...
Well-Actually War Trall Spidweb Posted March 20, 2004 Share Posted March 20, 2004 "In other words, if my_current_message <> 0, I can be sure this is the second time this script has been called this turn (unless the script is on a 8-turn cycle)." Not necessarily. There are a number of things that can cause a script to be called in a turn. A ritual of sanctification, or someone walking on it, or its blocking someone's movement can cause it to be called. Also, in a combat turn, scripts are called every time someone moves (so if someone moves 5 spaces, the terrain scripts are called 5 times). Your scripts need to be robust enough to work properly no matter how many times in a turn they are called. "So, I can only count on variables staying the same in a single state (and any other states I call in that state)?" A variable in a script is only visible in that script, but anywhere in that script. (So it can be accessed in multiple states.) When the script is unloaded (for example, a town script when you leave that town), that variable's value is forgotten. Any value you want the game to remember should be stored in a Stuff Done Flag. Link to comment Share on other sites More sharing options...
Recommended Posts