Alright, this was originally posted by Troflip at Mega-Tokyo. I kept waiting for him to post this here himself, but with all these new games I keep starting up, I got tired of waiting and up until now I was to lazy to actually go and find it. Until it struck me I've already got it in an older game project. So this is that code, allowing you to press the [alt] plus another key to view some pretty important debugging information.
* Note, if you are using scicompanion, which Troflip made, he has already included this in the companions template game, you will only need this if you are working on a game created with scistudio.
In the Main scripts Handle event method, add between the
(method (handleEvent pEvent)
and the
(super:handleEvent(pEvent))
all of this
// troflip debugging addition, For use in combination with the ALT key
(if (== evKEYBOARD (send pEvent:type))
(switch (send pEvent:message)
(case $2f00 Show(1)) // alt-v -> Show visual screen
(case $2e00 Show(4)) // alt-c -> Show control screen
(case $1900 Show(2)) // alt-p -> Show priority screen
(case $1400 (send gRoom:newRoom(GetNumber("Room Number?")))) // alt-t -> teleport to room
(case $1700 (send gEgo:get(GetNumber("Which Item?")))) // alt-i -> get inventory
(case $1f00 (send gCast:eachElementDo(#showSelf))) // alt-s -> Show cast
(case $3200 ShowFree() // alt-m -> Show memory usage
FormatPrint(
"Free Heap: %u Bytes\nLargest ptr: %u Bytes\nFreeHunk: %u KBytes\nLargest hunk: %u Bytes"
MemoryInfo(miFREEHEAP)
MemoryInfo(miLARGESTPTR)
(>> MemoryInfo(miFREEHUNK) 6)
MemoryInfo(miLARGESTHUNK)
) // end formatprint
) // end case $3200
) // end switch
) // end if keyboard event
// and now back to the normal script, You may want to delete all this bit upon release!
And there it is, pressing:
alt-t opens a dialog box to transport to any room
alt-c draws the rooms control colors to the screen.
alt-p draws the rooms priority colors to the screen.
alt-v draws the normal visual room
alt-i opens a dialog box allowing you to get any item
alt-s show self, displays cast list ??
alt-m displays heap and hunk memory usage - *the only one I really use