| View previous topic :: View next topic |
| Author |
Message |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Mar 23, 2009 8:36 am Post subject: |
|
|
| TwinHamster wrote: | A game-freezing bug has appeared and I'm trying to read the script-debug, but can't quite interpret very well due to its outdated wiki page.
|
I will bet you a dollar that the freeze you are seeing now and the crash you were seeing earlier have the same cause. Since this is an engine bug, script debug mode isn't gonna help.
Have you changed all your animation code to use "replace _ sprite" instead of freeing and reloading?
How much are you still using "free sprite"? |
|
| Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Mon Mar 23, 2009 8:47 am Post subject: |
|
|
| James Paige wrote: | | TwinHamster wrote: | A game-freezing bug has appeared and I'm trying to read the script-debug, but can't quite interpret very well due to its outdated wiki page.
|
I will bet you a dollar that the freeze you are seeing now and the crash you were seeing earlier have the same cause. Since this is an engine bug, script debug mode isn't gonna help.
Have you changed all your animation code to use "replace _ sprite" instead of freeing and reloading?
How much are you still using "free sprite"? |
The freezing problem was actually the bad loop in the script that was activated at the wrong moment and has since been resolved.
I have also replaced all of the container mess with the simpler sprite functions and have no need for free sprite anymore. |
|
| Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Mar 23, 2009 12:22 pm Post subject: |
|
|
| TwinHamster wrote: | | James Paige wrote: |
I will bet you a dollar that the freeze you are seeing now and the crash you were seeing earlier have the same cause. Since this is an engine bug, script debug mode isn't gonna help. |
The freezing problem was actually the bad loop in the script that was activated at the wrong moment and has since been resolved. |
Oh! I stand corrected. Your dollar has been sent. |
|
| Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue Mar 24, 2009 2:14 pm Post subject: |
|
|
Uh...Saving and Loading scripts.
I thought they'd be relatively simple to implement, but I'm being proved pretty wrong.
My save script stores the hero's current map and location coordinates in global variables (Even though the save file should already know these) and calls 'save in slot (1)'.
The load script is the main problem, however.
So far, I've only got:
| Code: |
Plotscript, load-game, begin
load from slot (1)
teleport to map (Load-map, Load-x, Load-y)
hero-x := Load-x * 200
hero-y := Load-y * 200
do game
gameover
end |
I've tried calling this plotscript as a special 'load-game plotscript' and through menu selection, but after placing a couple of 'show value(n)' to see how far the script goes, it seems that it isn't run at all. |
|
| Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Tue Mar 24, 2009 2:18 pm Post subject: |
|
|
| TwinHamster wrote: | | I've tried calling this plotscript as a special 'load-game plotscript' and through menu selection, but after placing a couple of 'show value(n)' to see how far the script goes, it seems that it isn't run at all. |
"Load game plotscript" is the one that's triggered when you load a game. You need this set up in your new game plotscript.
Note that "load from slot" will restart the game. _________________
|
|
| Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue Mar 24, 2009 2:44 pm Post subject: |
|
|
| Moogle1 wrote: | | "Load game plotscript" is the one that's triggered when you load a game. You need this set up in your new game plotscript. |
I figured that if I had all of the global variables and tags saved, then I could just re-initialize the game with the new positions and such after calling 'load from slot'?
| Quote: | | Note that "load from slot" will restart the game. |
So would it just be better to use a series of 'import globals (slot, first, last)' ?
[edit]
import globals works pretty neatly.
Is there a clean way to import tags too? |
|
| Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Mar 24, 2009 3:40 pm Post subject: |
|
|
That script ought to infinite-loop if it was set as the loadgame script. For the probable reason that it didn't (and didn't run at all), see 'Why don't my special plotscripts work?'
Yo'll just have to save the tags in globals. That's assuming that loading a saved game normally really isn't what you want.
WARNING: importglobals and exportglobals only work on globals 0-1024 at the moment. Someone forgot to update them. _________________ "It is so great it is insanely great." |
|
| Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue Mar 24, 2009 4:08 pm Post subject: |
|
|
| The Mad Cacti wrote: | | WARNING: importglobals and exportglobals only work on globals 0-1024 at the moment. Someone forgot to update them. |
Can you actually use that many variables? o_o
1024 seems like an impossibly high number of global variables for me at this point. |
|
| Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Tue Mar 24, 2009 4:19 pm Post subject: |
|
|
Yes, definitely.
Anyway, here's what I did for Timpoline. There are other ways, like you mention.
| Code: | plotscript, load game, begin
do game
game over
end
plotscript, new game, begin
initialize
do game
game over
end
script, initialize, begin
if (save slot used(1)) then (
load from slot(1)
)
end |
So when you start a game, it calls [new game], which tries to load a file. If it succeeds, the game starts over with [load game] and bypasses that check. _________________
|
|
| Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue Mar 24, 2009 4:27 pm Post subject: |
|
|
I just ended up going with that first thing you suggested and simply tacked stuff onto 'new game':
| Code: |
plotscript, new game, begin
show backdrop (0)
if(save slot used (1))
then(
wait for menu (open menu (1, false))
if(checktag(2)==off)then(load-game)
else(initialize)
)
else(initialize)
show map
wait (1)
reset palette
fade screen in
do game
game over
end |
Where the menu (1) lets you choose whether to start a new game or to continue a saved one.
Since 'load from slot' was giving me a couple troubles, I ended up recalling information through 'import globals' and loops for storing/recalling tags:
| Code: |
script, save-tags, begin
variable (tagger)
for (tagger, 3, 19) do(
if( checktag(tagger) )
then(
write global (200 + tagger, 1)
)
else(
write global (200 + tagger, 0)
)
)
end
script, load-tags, begin
variable (globaller)
for (globaller, 203, 219) do(
if( read global (globaller) == 1)
then(
set tag (globaller -- 200, true)
)
else(
set tag (globaller -- 200, false)
)
)
end |
Everything is working nicely and I'm surprised I had not gotten to these sooner.
And thanks for those examples! |
|
| Back to top |
|
 |
|