SCI Programming.com
Welcome, Guest. Please login or register.
May 20, 2012, 08:41 PM
Home Gallery Arcade Chat Shop Search Help Login Register
Home Fan Made Games Sierra Games Tools Tutorials Member Sites
Developer Desktop

Home  >  SCI Community  >  SCI Programming  >  SCI Community How To's & Tutorials  >  Topic: Adding Troflip's Easy alt Debugging « previous next »
Pages: [1] Print
Author Topic: Adding Troflip's Easy alt Debugging  (Read 500 times)
Cloudee1
Just Another User
*

Karma: 2
Offline Offline

Posts: 576



Peekaboo!

$1819.00 Buckazoids
View Inventory
Give Money

Burger Time

coyaba ?id=1000008636
View Profile WWW
« on: Mar 8, 2007, 09:48 AM »

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
Code:
(method (handleEvent pEvent)
and the
Code:
(super:handleEvent(pEvent))
all of this
Code:
  // 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 


   
Logged

Chillin like a Villian

41134_goldld0.gif 49626_silverpropcomp.gif
Pages: [1] Print 
Home  >  SCI Community  >  SCI Programming  >  SCI Community How To's & Tutorials  >  Topic: Adding Troflip's Easy alt Debugging « previous next »
Jump to:  
Page created in 0.107 seconds with 22 queries.
The SCI Programming Community
Copyright © 2007 - 2012, All Rights Reserved.
Forums Powered by SMF 1.1.16 | SMF © 2011, Simple Machines