Adding Troflip's alt Debugging: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
No edit summary
Tag: Reverted
Andrew Branscom (talk | contribs)
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 9: Line 9:
'''By Cloudee1'''</div>
'''By Cloudee1'''</div>


<br />
==<br /> Introduction ==
==<br /> Introduction ==
'''By Cloudee1'''
'''By Cloudee1'''
Line 19: Line 20:


<div class="CodeBlockHeader">Code:</div>
<div class="CodeBlockHeader">Code:</div>
<syntaxhighlight lang=" Smalltalk" class="cs">      (method (handleEvent pEvent)</syntaxhighlight>
<syntaxhighlight lang="sci" class="cs">      (method (handleEvent pEvent)</syntaxhighlight>


and the
and the


<div class="CodeBlockHeader">Code:</div>
<div class="CodeBlockHeader">Code:</div>
<syntaxhighlight lang=" Smalltalk" class="cs">        (super:handleEvent(pEvent))</syntaxhighlight>
<syntaxhighlight lang="sci" class="cs">        (super:handleEvent(pEvent))</syntaxhighlight>


all of this
all of this


<div class="CodeBlockHeader">Code:</div>
<div class="CodeBlockHeader">Code:</div>
<syntaxhighlight lang=" Smalltalk" class="cs">// troflip debugging addition, For use in combination with the ALT key
<syntaxhighlight lang="sci" class="cs">// troflip debugging addition, For use in combination with the ALT key
   (if (== evKEYBOARD (send pEvent:type))
   (if (== evKEYBOARD (send pEvent:type))
     (switch (send pEvent:message)
     (switch (send pEvent:message)
Line 65: Line 66:
<references />
<references />


==<br /> Also See ==
==<br /> Related Links ==


* &nbsp;
* &nbsp;
&nbsp;
&nbsp;
[[Category:Template Game]]
[[Category:SCI Template Game]]
[[Category:Template Games]]
[[Category:Template Games]]
[[Category:SCI Template Games]]
[[Category:SCI Template Games]]

Latest revision as of 17:02, 28 April 2025

SCI Tutorials SCI Tutorials and Guides


Adding Troflip's alt Debugging
By Cloudee1



Introduction

By Cloudee1

This was originally posted by Troflip on the Mega-Tokyo forums. 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 too 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, this is already included in SCI Companion's template game. It is only needed for SCI Studio.

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 $1e00 (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


References



Related Links

  •