DO Script Replacing HandleSingleCommand [SOLVED]

TA offline v5.8 -

I've created a new command kick, and an object ball. I have a script that calls HandleSingleCommand ("kick ball"). However, I want to substitute the do script in place of HandleSingleCommand. So what would the syntax look like?

do (kick, "script", ???)

Assuming that the command's name is "kick" and the object name is "ball" it would be:

do (kick, "script", QuickParams ("object", ball))

The third parameter to do is a dictionary; it's keys get turned into variables within the script that is being done. For most commands you'll only need a single element in the dictionary, for the object the command is being done to. For two-object commands, you might have "object1" and "object2", and some commands might have parameters called "exit" or "text", but you can pass them all in the same way.

Before 5.8, you would have needed to write it out in full:

params = NewDictionary()
dictionary add (params, "object", ball)
do (kick, "script", params)

but the new QuickParams function makes it easy to create dictionaries of up to 4 items.


Got it! It works, thank you!


Ooh, you can use variables and attributes for the dictionary values, not just specific objects/strings. Nice!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums