WILDHostCommands.cpp
IntroductionUse the links in the table of contents to the left to access the documentation. Functions
WILDAnswerInstructionvoid WILDAnswerInstruction( LEOContext *inContext ) DiscussionImplement 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) WILDAskInstructionvoid WILDAskInstruction( LEOContext *inContext ) DiscussionImplement 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) WILDChooseInstructionvoid WILDChooseInstruction( LEOContext *inContext ) DiscussionImplements the 'choose' command. The first parameter must be a string, the name of the tool you want. (WILD_CHOOSE_INSTR) WILDCreateInstructionvoid WILDCreateInstruction( LEOContext *inContext ) DiscussionImplements the 'create' command (for objects). Use this to create new card parts on the current card or current background (if in editBackground mode). 3 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. container - An object to which this will be added. E.g. the menu to add a menu item to. (WILD_CREATE_INSTR) WILDCreateUserPropertyInstructionvoid WILDCreateUserPropertyInstruction( LEOContext *inContext ) DiscussionImplements 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) WILDDebugCheckpointInstructionvoid WILDDebugCheckpointInstruction( LEOContext *inContext ) DiscussionEnter the debugger at this line. Does nothing if the debugger is not running or otherwise has been deactivated. (WILD_DEBUG_CHECKPOINT_INSTR) WILDDeleteInstructionvoid WILDDeleteInstruction( LEOContext *inContext ) DiscussionPop 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. WILDDeleteUserPropertyInstructionvoid WILDDeleteUserPropertyInstruction( LEOContext *inContext ) DiscussionImplements 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) WILDGoBackInstructionvoid WILDGoBackInstruction( LEOContext *inContext ) DiscussionImplements 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) WILDGoInstructionvoid WILDGoInstruction( LEOContext *inContext ) DiscussionImplements 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) WILDHideInstructionvoid WILDHideInstruction( LEOContext *inContext ) DiscussionPop 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. WILDMarkInstructionvoid WILDMarkInstruction( LEOContext *inContext ) DiscussionPop a value off the back of the stack (or just read it from the given BasePointer-relative address) and set its "marked" property to whatever value is in param2 (true or false, i.e. 1 or 0). (WILD_MARK_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. param2 - 1 to set the marked to true, 0 to set the marked to false. WILDMoveInstructionvoid WILDMoveInstruction( LEOContext *inContext ) DiscussionAnimate a movement of an object along a series of points. (WILD_MOVE_INSTR) WILDPlayMelodyInstructionvoid WILDPlayMelodyInstruction( LEOContext *inContext ) DiscussionTake 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) WILDPrintInstructionvoid WILDPrintInstruction( LEOContext *inContext ) DiscussionPop 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. WILDShowInstructionvoid WILDShowInstruction( LEOContext *inContext ) DiscussionPop 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. WILDStartInstructionvoid WILDStartInstruction( LEOContext *inContext ) DiscussionPop 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. WILDStartRecordingSoundInstructionvoid WILDStartRecordingSoundInstruction( LEOContext *inContext ) DiscussionImplements the 'start recording sound' command. The first parameter must be a string, the name to give the newly recorded sound. (WILD_START_RECORDING_SOUND_INSTR) WILDStopInstructionvoid WILDStopInstruction( LEOContext *inContext ) DiscussionPop 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. WILDStopRecordingSoundInstructionvoid WILDStopRecordingSoundInstruction( LEOContext *inContext ) DiscussionImplements the 'start recording sound' command. The first parameter must be a string, the name to give the newly recorded sound. (WILD_STOP_RECORDING_SOUND_INSTR) WILDVisualEffectInstructionvoid WILDVisualEffectInstruction( LEOContext *inContext ) DiscussionImplement 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) WILDWaitInstructionvoid WILDWaitInstruction( LEOContext *inContext ) DiscussionPop 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. |