How do I use show value to find errors in my scripts?
The reason of this article can seem stupid: well my script starts when the first lines are executed (a npc starts to walk = my cutscene script starts) but sometimes it's not that easy. Let's say that you want to add screens and that for some reasons the menu does not popup. How will you know where the problem comes from? How will you find the command line that are not executed?
Well that's the reason why of this article. A nice command have been implemented and check for you if a command line is executed or not: it's called "show value" and here's how to use it. Let's take an example with screens. Let's say that you want to show backdop 14 and 15 but that they does not pop up. The backdrop are included in a cutscene that is launched when you speak with an npc
script, cutscene, begin suspend player suspend npcs walk hero to X (me, 7) show text box (34) wait for text box walk npc ( 2, north, 7) walk hero to Y (me, 5) walk npc ( 6, north, 7) show backdrop (14) wait (8) show backdrop (15) wait (8) show map resume player resume npcs end #end of the script
Ohr plotscript writers generally use show value this way
showvalue(0) #-> the command is not executed showvalue(1) #-> the command line is executed (but do nothing)
Here how to use it
script, cutscene, begin suspend player suspend npcs walk hero to X (me, 7) show text box (34) wait for text box walk npc ( 2, north, 7) showvalue(0) walk hero to Y (me, 5) walk npc ( 6, north, 7) show backdrop (14) wait (8) show backdrop (15) wait (8) show map showvalue(1) resume player resume npcs end #end of the script
Note that show value (1°) always goes AFTER the command line you want to check. If you test and a 1 appears it means that thee is no bug and that there is something that prevent the backdrop from beeing poped up properly (something in your autorun map script for example) If a 0 pop then it means that there is a bug in your script, may be npc 6 has not been placed on map therefore the script can't go on and it explains why your backdrops don't pop up. And if no figures appears? Well that means that the bug is at the beginning or the script or that the script is even not launch. (You forget to put a conditional to your text box/ o your npc)
I hope that this example has shown you how useful the command 'show value' can be, so don't hesitate in using it when you don't understand why you scripts does not work as you want!