How does script-debug mode work?

From OHRRPGCE-Wiki

Jump to: navigation, search
This article does not meet the standard of quality we would like to have. Feel free to revise it and make it better by using the edit link at the top of the page. This tag should be removed when an editor feels it is of high quality.

The reason this article has been marked is: this article describes the nearly worthless debug mode in hasta-la-qb. It needs to be re-written for the quite entirely useful script debug mode that TeeEmCee wrote for ubersetzung

If you press F10 while playing your game, you may suddenly notice a bunch of cryptic numbers being displayed at the bottom of the screen. This is script-debugging mode. I originally wrote script-debugging mode to help be fix bugs in the script interpreter itself, but it can also be useful for you to debug your own scripts.If any of the following seems overly complicated and confusing, don't worry a bit. None of this stuff is anything anybody ever needs to learn. It makes my head hurt, and I programmed it myself!

There are three script debugging levels, Off, Regular, and Detailed. Pressing F10 cycles between them. In regular mode, the script-debugging information is repainted only when the script is in "wait" mode. In detailed mode, the script info is repainted every single interpreter cycle, which can make things slow down considerably

When in script-debugging mode you will see two bars at the top of the screen, one blue and one pink. When no scripts are running, both bars will be completely black. As the script buffers fill, the colored bars will expand to the right. If the blue bar fills up, you will get a "script buffer overflow" error, and if the pink bar fills up you will get a "script heap overflow" error.

When script debugging mode is on, look at the bottom of the screen. You will see six column footers.

#     ID     RtVal     CmdKn     CmdID     State

# is just the number of the script in the order it was loaded.

ID is the script's ID number. This is the same ID number that you assigned to your script in your define script command. If you see a really big number, like over 32000, that is an autonumber script.

RtVal is the script's current return value. Most of the time this will always be zero, but it changes if your script makes use of the return command

CmdKn, or "Command Kind" tells what kind of command the script is currently interpreting. You may notice 1=integer, 2=flow control, 3=global variable, 4=local variable, 5=math function, 6=built-in function, and 7=script. Unless you are using detailed mode, all you are likely to see is CmdKn 6 and 7.

CmdID, or "Command ID" is the ID number of the currently executing command. Its meaning varies depending on the CmdKn. When CmdKn is 6, the CmdID will match the command ID number found in PLOTSCR.HSD, and when CmdKn=7 the CmdID will match the ID number of the script that is being called. If your script is in a "wait" state, you can tell which wait command caused it by looking at the CmdID. For example, "wait for text box" has a CmdID value of 59. "wait for hero" has a CmdID of 3. You can check PLOTSCR.HSD for the full list

State is the internal interpreter state. 0=no state (error), 1=wait, 2=reading command, 3=returning from command, 4=moving to next argument, 5=doing next argument, 6=done with command

Personal tools