Class: Script (of Obj)

The script class is a very important part of the game. It is used in every room to perform animation and handle events.

Properties

  • client
  • state
  • start
  • timer
  • cycles
  • seconds
  • lastSeconds
  • register
  • script
  • caller
  • next

Methods

  • void init(heapPtr theClient[, heapPtr theCaller, number theRegister])

    Sets the client property to theClient. If the other parameters are specified, it sets the caller property to theCaller, and the register property to theRegister. Finally, it calls the changeState method with the start property as it's parameter.

  • void doit()

    If the script property is not NULL, it calls the doit method of it. Next, if cycles property is not zero, it decrements it. If after decrementing, it is equal to zero, it calls the cue() method.

    If the cycles property was zero to begin with, and the seconds property is not equal to zero, it compares the actual seconds to the lastSeconds property. If they are not equal, it sets lastSeconds to the current seconds (from GetTime(gtTIME_OF_DAY)) and decrements the seconds property. If the seconds property is equal to zero, it calss the cue() method.

  • void dispose()

    Disposes of the script object and all of it's elements.

  • void changeState(number newState)

    Sets the state property to the newState.

  • void cue([sendParams])

    Calls the changeState() method with (state + 1) as it's parameter. Then, if specified, sends the sendParams to the object.

  • bool handleEvent(heapPtr pEvent)

    If the script property is not null, it calls the script's handleEvent() method with pEvent has it's parameter. It then returns whether of not the pEvent object has been claimed.

  • void setScript(heapPtr scriptObj[. sendParams])

    If the script property is not NULL, it disposes of the object pointed to by it. It then calls scriptObj's init() method, and if specified, send the rest of the parameters to scriptObj.