run_town_script();

Error message

  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: run_town_script();
Master
Member # 5977
Profile Homepage #0
I wondered if this call, when used in a scenario script START_STATE will cause the running of a town script in the town you are presently in?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #1
I believe so. The best way to get functionality questions answered is to set up a short test script and test it yourself.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #2
The call set_state_continue will do this for sure. I assume run_town_script will, but I'm not sure.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #3
quote:
Originally written by Kelandon:

The call set_state_continue will do this for sure. I assume run_town_script will, but I'm not sure.
Will set_state_continue work in a scenario's START_STATE!? i thought, when using that call that it would go to a state in the scenario script, and not the town script, or is that wrong?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Off With Their Heads
Member # 4045
Profile Homepage #4
It can go anywhere.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #5
So how then does the program know what state to take?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Off With Their Heads
Member # 4045
Profile Homepage #6
It runs the state in the same script. So if you call set_state_continue(22) in town script t22Vasskolis.txt, it runs state 22 in t22Vasskolis.txt. If you call set_state_continue(24) in slithhome.txt, it runs state 24 in slithhome.txt.

When all else fails, read the docs. Well, except that I think that it's lying about the INIT_STATE. And possibly the DEAD_STATE. Not sure.
quote:
void set_state(short new_state) - Changes the state of the script to new_state and immediately stops running the script. Has no effect in a dialogue script or in the states INIT_STATE, DEAD_STATE, or other predefined state types (except START_STATE).

void set_state_continue(short new_state) - Exactly like set_state, except that it doesn’t stop running the script.



[ Tuesday, January 17, 2006 07:58: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #7
Well, I knew that. you see, the problem is that I have a line of code in the scenario scripts START_STATE, but it has to make something happen in the town you are presently in. So this is the siruation:

You set machinery on full power, ten ticks later you get a message saying you blew up the place by doing that, and the machinery (beam projectors and power sources) should stop working. However, this can only be achieved from the town script, and not the scenario script. That is the exact problem.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
? Man, ? Amazing
Member # 5755
Profile #8
It might work for you to have the scenario script set a flag. Then when the other script begins (later on) have the if...state_continue.. in that start state.

Otherwise, would it work to duplicate the state into each possible script which could be calling it?? I know Smoo did something similar in his latest scenario. At least the earlier versions had it, so you could check that out. It was around the island area.

*this message sponsored by Foss*

--------------------
WWtNSD?
Posts: 4114 | Registered: Monday, April 25 2005 07:00
Master
Member # 5977
Profile Homepage #9
The flag metho is what I'm using now. the only problem is, is that the player has to leave town to return later. To let the player know he should do this, I advise him to "leave and come back later when you are certain the wizards are not etc. etc."

Duplicating the state won't really work, i think. because the scenario script START_STATE is the only state that is run every turn, this is the only place this specific thing will work proparly. If I would put it in the town script, I would still have to reenter town to make it work.

Thanks for thr advice, though, but I'll think I'll just try the run_town_script, and if that doesn't work, I'll come back here.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
? Man, ? Amazing
Member # 5755
Profile #10
Now that I've read the description of the actual event that you are having happen, I don't understand the difficulty. The "turn on full power" state could set two flags to represent the point in time that it all stops working (present plus 10). The state_state could check if the present time is equal to the value of those flags recombined. Using an if statement to check, you then can put the terrain swaps and message right in the start state.

Would that work?

--------------------
WWtNSD?
Posts: 4114 | Registered: Monday, April 25 2005 07:00
Master
Member # 5977
Profile Homepage #11
The terrain can only be modified from the townscript. Not from the scenario script. the call that checks whether the ten ticks have passed is in the scenario script. if there is a call that can run a town script, thw problem is solved. If there isn't, then the party will have to reenter town. What you just suggested to do, is almost exactly what I have in the script, but as I already said: for terrain modification, unless a state is run in the townscript using set_terrain, the party hs to reenter town to make it all work.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
? Man, ? Amazing
Member # 5755
Profile #12
Any particular reason you don't have all this stuff in the start state of the town script?

--------------------
WWtNSD?
Posts: 4114 | Registered: Monday, April 25 2005 07:00
Off With Their Heads
Member # 4045
Profile Homepage #13
Whoops. I just re-read the first post again. Missed the "scenario script" bit that you said — I thought you were in a town script.

I should've just said yes. The call set_state_continue will only send you somewhere else within the script you're already in. Just use run_town_script and you'll be fine.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #14
quote:
Originally written by Jumpin' Salmon:

Any particular reason you don't have all this stuff in the start state of the town script?
I think I already explained that twice: because only the scenario script's START_STATE is run every turn, and all the others, including the town script START_STATE, not. As I want that a particular message is displayed at a certain point in time (When flag x,y == 1 and the amount of ticks past from the moment that flag was set (which is stored in a variable: tick1) until now is tick1 + 10). this can only be done in the scenario script's START_STATE. that's why. Do you understand it now, or would you like to know more?

okay, Kelandon. Thanks. I haven't tried it out myself, as I'm bussy studying French for a test tomorrow.

Thanks to all of you who offered advice and tried to help.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Infiltrator
Member # 5576
Profile Homepage #15
From the BoA Editor Docs:
quote:
State 2 is automatically called by the game every turn the party is in the town. You can also write START_STATE as the number of this state.
I have never had a problem with this not occuring every turn, and is it really so critical that your message be displayed after exactly 10 turns? I have done this type of thing a number of times using the town script and it works fine.

One good reason to put your time checking code in the town script and not the scenario script is that it takes a bit of time to do the check, and so if you have a large number of checks, it can slow things down. So, it's better to have this happen only when you're in one town than through out the entire scenario. Besides, if the code applies to only that one portion of the scenario, it is a good idea to place it in the script that relates to that part of the scenario directly. That way the code easier to understand, maintain and alter.

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
...b10010b...
Member # 869
Profile Homepage #16
Niemand (and the docs) are right; the START_STATE is run every turn regardless of whether it's in a town or scenario script.

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Off With Their Heads
Member # 4045
Profile Homepage #17
I think that Thralni is planning to make it possible to leave the town before the event actually occurs. The town's START_STATE is only run every turn while you're in town — if the party has left already, then the START_STATE won't be run. Hence he must use the scenario's START_STATE, which is the only state that is run every single turn in the scenario regardless of where the party is.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
? Man, ? Amazing
Member # 5755
Profile #18
Of course if the location which starts the timer is more than 10 steps from the edge of town, this becomes a non-issue...

--------------------
WWtNSD?
Posts: 4114 | Registered: Monday, April 25 2005 07:00
The Establishment
Member # 6
Profile #19
If leaving the town is the worry, a possible compromise is to the exiting town situation is just to call the relevant node in the EXIT_STATE if the party leaves before the timer runs out.

Also, do not forget that combat mode allows increased mobility.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #20
If you have all of this done by one SDF, a single get_flag check every turn doesn't slow down anything noticeably.

There are many right ways to do this and only a few functional wrong ways.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #21
There is not enough time (unless you are in combat mode) to go from the control room all the way to the exit of town, and I also don't really want people to do that. I want the player to witness what he did. The only thing I have to implement is the wizards running to you to kill you and restore the system (which won't work).

Oh really... I didn't know it can be put in the town script's START_STATE. I'll put it there then. It will make things an awful lot easier. That also means you were right, salmon. My apologies for my lack of patience.

But then again, if the party does leave before the timer is actually ready running, then this becomes a problem. I could also make the amount of ticks to pass 5, actually. It is not really necessary for it to be 10, but it seemed like the right amount of time for the machines to blow up.

quote:
If you have all of this done by one SDF, a single get_flag check every turn doesn't slow down anything noticeably.

There are many right ways to do this and only a few functional wrong ways.
this is what happens now, and I don't really see an urge to change it.

I think I will put everything in the town script's START_STATE.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00