Terrain script calls
Author | Topic: Terrain script calls |
---|---|
? Man, ? Amazing
Member # 5755
|
written Sunday, January 22 2006 15:10
Profile
I'm working on a couple of scripts and have some questions on when, and how often, the default states are called. init_state - Is this called only the first time a town is entered, or every time a town is entered? start_state - The docs suggest this state is called every turn, but that makes no sense to me. The code that needs a home will be checking a SDF, and will either put a sign, or remove a sign (swap with a blank graphic) depending on that value. My gut says to put it in the start state, since actions in the town could cause the sign to appear/disappear, but it seems CPU intensive to do it that way if it runs that state every click. Any ideas? [ Wednesday, January 25, 2006 13:43: Message edited by: Jumpin' Salmon ] -------------------- quote: Posts: 4114 | Registered: Monday, April 25 2005 07:00 |
Councilor
Member # 6600
|
written Sunday, January 22 2006 17:01
Profile
Homepage
Start_state does check every turn so if the sign switch can be activated every turn, it makes sense to put it there. If it is only checking a SDF, I don't think it will slow the game down noticeably. On the other hand, you could use a special encounter that the party has to walk on before seeing the sign or after triggering the switch to check whether the terrain should be switched because then it would only be called once in a while. Of course, I think terrain switches back after leaving a town, so it would also have to go into init_state. So go back to the first hand. Dikiyoba. Edit: Double sig. Better than a double post, I guess... [ Sunday, January 22, 2006 17:02: Message edited by: Dikiyoba ] Posts: 4346 | Registered: Friday, December 23 2005 08:00 |
Off With Their Heads
Member # 4045
|
written Sunday, January 22 2006 19:43
Profile
Homepage
The INIT_STATE is called every time the party enters the town. As far as the sign, you've got two choices. You can either put it in the START_STATE — and Dikiyoba is right: a single get_flag in the START_STATE won't kill you (or even be noticeable) — or put a bunch of special encounter rectangles around the area so that the change takes place while the party is approaching the spot. -------------------- 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
|
written Sunday, January 22 2006 22:54
Profile
Start state then. I discovered the need for this because I have more than the arbitrary maximum number of signs in my town. So I decided to make a more versatile sign script and a new terrain. Hopefully it will work, and not drive me nuts. It was not encouraging to read the docs and see the following: quote:*this message sponsored by the editors guild* -------------------- quote: Posts: 4114 | Registered: Monday, April 25 2005 07:00 |
Councilor
Member # 6600
|
written Monday, January 23 2006 11:15
Profile
Homepage
That's to weed out the complete incompetents. Or maybe it's a typo. Dikiyoba. Posts: 4346 | Registered: Friday, December 23 2005 08:00 |
Agent
Member # 5814
|
written Monday, January 23 2006 14:21
Profile
The docs are just there to make you suffer. Ripping off someone else's code is much easier and less buggy. -------------------- quote: Posts: 1115 | Registered: Sunday, May 15 2005 07:00 |
Off With Their Heads
Member # 4045
|
written Monday, January 23 2006 20:55
Profile
Homepage
quote:To reinforce this: I have never written a town script (or a creature script or anything else) from scratch. I always copy from Jeff's code and then delete what I don't wont. And I wrote cutscene code that worked once. Now I literally copy and paste from old cutscenes every time I need a new cutscene. -------------------- 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 |
Councilor
Member # 6600
|
written Tuesday, January 24 2006 07:59
Profile
Homepage
I borrow bits and pieces from other scripts (and my own too) whenever I need to do something in a script and then go to the docs if I can't find what I want. Then I test the completed script. It's slow but it works. Dikiyoba. Posts: 4346 | Registered: Friday, December 23 2005 08:00 |
Shock Trooper
Member # 932
|
written Tuesday, January 24 2006 19:13
Profile
quote:With other games I write pretty much everything from scratch - I don't care if I'm reinventing the wheel if I can do it better. (I'm not stupid: if someone does write code that is functionally equivalent or close to what I've already got, I'll use it.) I have written a couple of scripts from scratch, but I rarely do it anymore. I've written about a half dozen mostly from scratch. I only do either of the former when it's easier to write from scratch than to adapt someone else's work. quote:Frankly, someone with serious knowledge of Avernumscript and plenty of time needs to rewrite the documentation. It's not like Jeff is going to actually proof read the documentation he wrote. -------------------- Microsoft Patents Ones, Zeroes (March 25, 1998) "Asians are good at Starcraft because they're always squinting, thus they can see things sharply. Remember to always squint in war." ~ Sun-Tzu Posts: 215 | Registered: Sunday, April 7 2002 08:00 |
Councilor
Member # 6600
|
written Tuesday, January 24 2006 20:25
Profile
Homepage
Even if he did, people often have trouble catching their own mistakes. Dikiyoba. Posts: 4346 | Registered: Friday, December 23 2005 08:00 |
? Man, ? Amazing
Member # 5755
|
written Wednesday, January 25 2006 13:47
Profile
Frustrations abound. I've decided, based on the BUGS! thread, that create_text_bubble will not work from a terrain script. Does text_bubble_on_char work from within a terrain script?? Are there any text bubble calls that work from a terrain script? Grrr. -------------------- quote: Posts: 4114 | Registered: Monday, April 25 2005 07:00 |
Off With Their Heads
Member # 4045
|
written Wednesday, January 25 2006 14:25
Profile
Homepage
The best way to know is to try. This is probably the first law of Avernumscript programming. -------------------- 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
|
written Thursday, January 26 2006 09:19
Profile
Well, it's done. I posted the script at The Codex. I never did find a way to get either text_bubble call to work reliably from within the script, so I used the clunky message_dialog call. -------------------- quote: Posts: 4114 | Registered: Monday, April 25 2005 07:00 |