WILDHostCommands.cpp

Includes:
<strings.h>
"WILDHostCommands.h"
"CScriptableObjectValue.h"
"LEOScript.h"
"LEORemoteDebugger.h"
"LEOContextGroup.h"
"CStack.h"
"CDocument.h"
"CDocumentMac.h"
"CRecentCardsList.h"
"CAlert.h"
"CMessageBox.h"
"CSound.h"
<unistd.h>

Introduction

Use the links in the table of contents to the left to access the documentation.



Functions

WILDAnswerInstruction
WILDAskInstruction
WILDChooseInstruction
WILDCreateInstruction
WILDCreateUserPropertyInstruction
WILDDebugCheckpointInstruction
WILDDeleteInstruction
WILDDeleteUserPropertyInstruction
WILDGoBackInstruction
WILDGoInstruction
WILDHideInstruction
WILDPlayMelodyInstruction
WILDPrintInstruction
WILDShowInstruction
WILDStartInstruction
WILDStopInstruction
WILDVisualEffectInstruction
WILDWaitInstruction

WILDAnswerInstruction


void WILDAnswerInstruction(
    LEOContext *inContext ) 
Discussion

Implement the 'answer' command. Displays an alert panel with a message and up to 3 buttons. Parameters are removed from the stack on completion. The name of the button the user clicked will be written into the local variables 'the result' and 'it'.

msg - The message to display. The alert will resize vertically to fit this message. button1 - The name for the first, leftmost button, or an empty string to indicate the button should be named "OK". button2 - The name for the second button, to the right of button 1. Or an empty string to indicate only 1 button is desired. button3 - The name for the 3rd button, to the right of button 2, or an empty string to indicate no 3rd button is desired.

The rightmost button will be made the 'OK' button and will react to the return key.

This command is deprecated. It is here as a concession to Stacksmith's HyperCard heritage, but it is recommended you create buttons and text fields on the card and let the user perform any actions you desire there.

(WILD_ANSWER_INSTR)


WILDAskInstruction


void WILDAskInstruction(
    LEOContext *inContext ) 
Discussion

Implement the 'ask' command. Displays an alert panel with a message and an input field, plus OK and Cancel buttons. Parameters are removed from the stack on completion. The name of the button the user clicked will be written into the local variable 'the result'. The text the user entered into the edit field will be written into the local variable 'it'.

msg - The message to display. The alert will resize vertically to fit this message. answer - A default answer to write into the edit field to pre-fill it.

This command is deprecated. It is here as a concession to Stacksmith's HyperCard heritage, but it is recommended you create buttons and text fields on the card and let the user perform any actions you desire there.

(WILD_ASK_INSTR)


WILDChooseInstruction


void WILDChooseInstruction(
    LEOContext *inContext ) 
Discussion

Implements the 'choose' command. The first parameter must be a string, the name of the tool you want.

(WILD_CHOOSE_INSTR)


WILDCreateInstruction


void WILDCreateInstruction(
    LEOContext *inContext ) 
Discussion

Implements the 'create' command (for objects). Use this to create new card parts on the current card or current background (if in editBackground mode). 2 parameters must be pushed on the stack before this is called and will be removed on completion: typeName - The type of part to create, i.e. button, field, player or browser, as a string. objectName - The name to give the new object.

(WILD_CREATE_INSTR)


WILDCreateUserPropertyInstruction


Discussion

Implements the 'create property' command. Adds a user property of the specified name to the specified object. From then on this property will be usable just like any built-in property of that object. Takes 2 parameters and removes them from the stack on completion:

propertyName - The name the new property should have, as a string. object - The object to add the property to, as a WILDObjectValue (i.e. isa = kLeoValueTypeScriptableObject)

(WILD_CREATE_USER_PROPERTY_INSTR)


WILDDebugCheckpointInstruction


Discussion

Enter the debugger at this line. Does nothing if the debugger is not running or otherwise has been deactivated.

(WILD_DEBUG_CHECKPOINT_INSTR)


WILDDeleteInstruction


void WILDDeleteInstruction(
    LEOContext *inContext ) 
Discussion

Pop a value off the back of the stack (or just read it from the given BasePointer-relative address) and delete it. If it's an object, we remove it from its owner, if it is a chunk, we empty it and remove any excess delimiters. (WILD_DELETE_INSTR)

param1 - If this is BACK_OF_STACK, we're supposed to pop the last item off the stack. Otherwise, this is a basePtr-relative address where a value will just be read.


WILDDeleteUserPropertyInstruction


Discussion

Implements the 'delete property' command. Deletes a user property of the specified name from the specified object. Only works for properties added using the 'create property' command. Takes 2 parameters and removes them from the stack on completion:

propertyName - The name of the property to delete, as a string. object - The object to remove the property from, as a WILDObjectValue (i.e. isa = kLeoValueTypeScriptableObject)

(WILD_DELETE_USER_PROPERTY_INSTR)


WILDGoBackInstruction


void WILDGoBackInstruction(
    LEOContext *inContext ) 
Discussion

Implements the 'go back' command.

It will use the current visual effect to perform the transition and will clear the current visual effect once done.

param1 in the instruction is a TOpenInMode that will be passed to GoThereInNewWindow().

(WILD_GO_BACK_INSTR)


WILDGoInstruction


void WILDGoInstruction(
    LEOContext *inContext ) 
Discussion

Implements the 'go' command. The first (and only required) parameter on the LEO stack must be a CScriptableObjectValue (i.e. isa = kLeoValueTypeScriptableObject) on which the GoThereInNewWindow() method will be called. If the parameter is a string instead, we will assume it is a stack that's not yet open and attempt to open that. It will remove its parameters from the LEO stack once it is done.

If the second parameter isn't empty, it is assumed to be a part from which the transition is to start (e.g. if we do a "zoom" effect opening the window) or to which the window will be attached in the case of a popup window.

It will use the current visual effect to perform the transition and will clear the current visual effect once done.

param1 in the instruction is a TOpenInMode that will be passed to GoThereInNewWindow().

(WILD_GO_INSTR)


WILDHideInstruction


void WILDHideInstruction(
    LEOContext *inContext ) 
Discussion

Pop a value off the back of the stack (or just read it from the given BasePointer-relative address) and set its "visible" property to FALSE. (WILD_HIDE_INSTR)

param1 - If this is BACK_OF_STACK, we're supposed to pop the last item off the stack. Otherwise, this is a basePtr-relative address where a value will just be read.


WILDPlayMelodyInstruction


Discussion

Take the name of an instrument off the back of the stack and look up the corresponding sound file up the hierarchy and finally in the system. Also take a melody string off the back of the stack and hand both of them off to ULIMelodyQueue to play that melody using that instrument. Implements the 'play' command. If the parameter is an object instead of an instrument, see if the object can be started. If yes, start it instead. (WILD_PLAY_MELODY_INSTR)


WILDPrintInstruction


void WILDPrintInstruction(
    LEOContext *inContext ) 
Discussion

Pop a value off the back of the stack (or just read it from the given BasePointer-relative address) and present it to the user in string form. In Stacksmith, this means showing it in the message box. (WILD_PRINT_INSTR)

param1 - If this is BACK_OF_STACK, we're supposed to pop the last item off the stack. Otherwise, this is a basePtr-relative address where a value will just be read.


WILDShowInstruction


void WILDShowInstruction(
    LEOContext *inContext ) 
Discussion

Pop a value off the back of the stack (or just read it from the given BasePointer-relative address) and set its "visible" property to TRUE. (WILD_SHOW_INSTR)

param1 - If this is BACK_OF_STACK, we're supposed to pop the last item off the stack. Otherwise, this is a basePtr-relative address where a value will just be read.


WILDStartInstruction


void WILDStartInstruction(
    LEOContext *inContext ) 
Discussion

Pop a value off the back of the stack (or just read it from the given BasePointer-relative address) and set its "started" property to TRUE. (WILD_START_INSTR)

param1 - If this is BACK_OF_STACK, we're supposed to pop the last item off the stack. Otherwise, this is a basePtr-relative address where a value will just be read.


WILDStopInstruction


void WILDStopInstruction(
    LEOContext *inContext ) 
Discussion

Pop a value off the back of the stack (or just read it from the given BasePointer-relative address) and set its "started" property to FALSE. (WILD_STOP_INSTR)

param1 - If this is BACK_OF_STACK, we're supposed to pop the last item off the stack. Otherwise, this is a basePtr-relative address where a value will just be read.


WILDVisualEffectInstruction


Discussion

Implement the 'visual effect' command. This sets the current context user data's transition effect to the specified visual effect so the next 'go' command can use it.

The only parameter on the stack is a string, the name of the transition to use. It will be removed from the stack once this instruction has completed.

(WILD_VISUAL_EFFECT_INSTR)


WILDWaitInstruction


void WILDWaitInstruction(
    LEOContext *inContext ) 
Discussion

Pop a value off the back of the stack (or just read it from the given BasePointer-relative address) and take it as a duration to delay the script. (WILD_WAIT_INSTR)

param1 - If this is BACK_OF_STACK, we're supposed to pop the last item off the stack. Otherwise, this is a basePtr-relative address where a value will just be read.