Magnificent Ornk Aran Posted April 9, 2007 Share Posted April 9, 2007 I had some trouble with calling a town script from dialogue. Namely, I wanted the dialogue to show up and end (it was an "INN" message, meaning that the player had just rented a room), before the next message crops up (which told the player what happened during the night). run_town_script() made the dialog box pop up immediately before they left talk mode, which wasn't really what I wanted. So instead, I let the dialogue node set an SDF, which the town script's state 2 would constantly check. This should trigger the dialog box in the next move after talk mode was left. Unfortunately I don't know how to call another town script state from state 2. State 2 is the state that is called every move. The docs tell me that set_state_continue will not only call that state, but also make that state the one that gets constantly repeated. But I only want to call that state once, and then move back to state 2. Possible? Quote Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Lilith Posted April 9, 2007 Share Posted April 9, 2007 Why do you need to call another state? Just cut and paste the code for the dialog box into a conditional statement within the START_STATE. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 9, 2007 Author Share Posted April 9, 2007 Whoops. I think this is probably pretty easy. Just execute set_state_continue again at the end of my special state to jump back to state 2. I have to stop thinking of states as functions or subroutines. They're apparently more like statement numbers jumped to with GOTO. Edit: Yes, that works too, but it's quite a lengthy block of instructions and I have some kind of allergy against huge code snippets in an if - especially when it's only called once, and has a completely separate purpose. Edit2: My double set_state_continue() works perfectly. Talk mode ends, I make another move, the dialog box appears, and everything is just great. Since the dialog box appears only once, I can also assume that the state does not become the new START_STATE. Quote Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Lilith Posted April 9, 2007 Share Posted April 9, 2007 Quote: Originally written by Dr. Johann Georg Faust:Edit: Yes, that works too, but it's quite a lengthy block of instructions and I have some kind of allergy against huge code snippets in an if - especially when it's only called once, and has a completely separate purpose. I suppose. But it's good to economise on states where possible, on the basis that one only has a finite number to work with in any given town. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted April 9, 2007 Share Posted April 9, 2007 In general you don't have to be too stingy with states, you have about 90 available per town, and very few towns need very many of them. The scripts are a lot easier to read and fix if they are more thoroughly broken down into separate states. Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 9, 2007 Author Share Posted April 9, 2007 Well, I just discovered the limits to my "jump to extra state, then jump back" policy. It only works, obviously, if my state will only be triggered once. Everything else results in an endless loop, without implementing some extra logic that makes it even more confusing than the "lump it all in one state" method. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 9, 2007 Share Posted April 9, 2007 The limit on states is much higher than 90. I was just testing it, and got it to call state 1000. I'm not sure what the real limit is; I stopped testing when I decided that running out of states is about impossible. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Dintiradan Posted April 9, 2007 Share Posted April 9, 2007 Did you have 1000 states in total, or just a state numbered 1000? -------------------- The One Ring Theory Assignment to RULE THEM ALL! Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 9, 2007 Share Posted April 9, 2007 Just a state numbered 1000, but it should work anyhow....... OK, we're talking about BoA here, so it's quite likely it has some arbitrary limit on number of states. I don't have the patience to copy and paste 1000 states. Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Dintiradan Posted April 9, 2007 Share Posted April 9, 2007 Give me a moment, and I'll whip up a Perl script to do that. -------------------- EDIT: Well, I just put states 150-999 into a town script with no complaint. However, they were all empty. I'm going to try something more devious: get every one to call the next one in succession, until #999 just prints out a message_dialog. EDIT: Huh. I take it all back. It took nearly a half second before message_dialog("Hello World!","") was run after travelling through 950 states, but it did come up. EDIT: Maybe it's dialog scripts that have the limit for the number of nodes. I remember something like that being the reason for Smoo putting all the merchants in Rats Aplenty in a separate town. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted April 9, 2007 Share Posted April 9, 2007 There is a 200 node limit for each town. Quote Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted April 9, 2007 Share Posted April 9, 2007 Ok, that sounds like the right number. I guessed ~90 because Jeff wrote a comment in some scripts that said, "States you write yourself should be numbered from 10-100." Quote Link to comment Share on other sites More sharing options...
Magnificent Ornk Aran Posted April 11, 2007 Author Share Posted April 11, 2007 The API documentation and the actual implementation just happen to come from too barely connected parallel universes, as always. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.