Debugging - theRAPTLab/gsgo GitHub Wiki

Overview

dbgOut is pretty handy, but if you need to check on the value of a property, dbgOut cannot directly evaluate it. Instead you need to use a stack operation:

exprPush {{ agent.prop.statusText.value }}
dbgStack

dbgOut

dbgStack


Test GEMSCRIPT

These scripts can be used to test every GEMSCRIPT to make sure they work with no errors. While there is a dbgOut error message for testing, there should not be any red javascript console errors.

To test:

  1. Create a new project with a new KeywordTest character.
  2. Create a second KeywordTouch character.
  3. Add one of each type of character to the scene.
  4. View the console. You should see a number of debug and stack messages and NO errors.
  5. Prep Round. Start Round.
  6. Start a Character controller.
  7. Move the KeywordTest character on top of the KeywordTouch character.
  8. View the console. You should see repeated debug statements from the touch event.

KeywordTest

# BLUEPRINT KeywordTest
# TAG isCharControllable true
# TAG isPozyxControllable false
# TAG isPTrackControllable false

# PROGRAM INIT
addFeature Costume
addFeature Physics
featCall Physics init
addFeature Touches 
featCall Touches monitor enum b2b
addProp colour number 0
dbgContext
dbgError 'this is an error'
dbgOut 'debug'
//  shows 'debug' in debug console
dbgStack
dbgTick

featCall Graphing showMessage 'dialog test'
// shows dialog with 'dialog test'


exprPush {{ character.prop.colour.value }}
dbgStack

// exprPush expression with 'character' reference
useFeature Graphing
featProp Graphing text setTo 'Fish'
exprPush {{ character.getFeatProp('Graphing','text').value }}
dbgStack
// return stack 'Fish'

featProp character.Costume.costumeName setTo 'AQ_algae.png'
// shows algae graphic

featPropPush character.Graphing.text
dbgStack
// returns stack 'Fish'

exprPush {{ 55 }}
featPropPop character.Graphing meter
// shows meter at 55



ifExpr {{ KeywordTest.getFeatProp('Graphing','text').value === 'test' }} [[
  dbgOut 'Got KeywordTest'
]]
dbgOut 'blueprint name "KeywordTest" passed getFeatProp test'
// checking blueprint name reference
ifExpr {{ agent.getFeatProp('Graphing','text').value === 'Fish' }} [[
  dbgOut 'Got Fish'
]]
dbgOut '"agent" reference passed getFeatProp test'
// shows 'Got Fish' in debug console
ifExpr {{ character.getFeatProp('Graphing','text').value === 'Fish' }} [[
  dbgOut 'Got Fish'
]]
dbgOut '"character" reference passed getFeatProp test'
// shows 'Got Fish' in debug console



ifFeatProp character.Graphing.text equal 'Fish' [[
  dbgOut 'ifFeatProp Got Fish'
]]
// shows 'Got Fish' in debug console

ifProp character.colour equal 0 [[
  dbgOut 'ifProp got 0'
]]
// shows 'ifProp got 0' in debug console


prop character.colour setTo 255
propPush character.colour
dbgStack
// shows '255' in debug console

exprPush {{ 125 }}
propPop character.colour
propPush character.colour
dbgStack
// shows '125' in debug console


# PROGRAM UPDATE


every 5 runAfter [[ 
  dbgOut '...5'
  // shows "...5" every 5 seconds
]]

onEvent Start [[ 
  dbgOut 'START!'
  // shows "START!" once in debug console
]]

when KeywordTest touches KeywordTouch [[ 
  dbgOut 'Touch!'
  // shows 'Touch!' every tick
  ifExpr {{ character.getProp('colour').value === 125 }} [[
    dbgOut 'hit 125'
    shows 'hit 125' every tick
  ]]
  // test block code
]]


// NOT TESTED
// randomPos
// stackAdd
// stackDiv
// stackMul
// stackSub

KeywordTouch

# BLUEPRINT enum
# TAG isCharControllable true
# TAG isPozyxControllable false
# TAG isPTrackControllable false

# PROGRAM INIT
addFeature Costume
featProp character.Costume.costumeName setTo 'AQ_boulder.json'
addFeature Physics
addFeature touchesfeatCall Touches monitor enum b2b

# PROGRAM UPDATE
⚠️ **GitHub.com Fallback** ⚠️