Adding a new command

From ADRIFT 5 Manual Wiki
Revision as of 08:06, 23 August 2012 by Saabie (Talk | contribs) (Created page with "If the ARIFT standard library already contains the command (verb) that you want to use, then it is a simple matter to create a specific task to change the default behaviour for a...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If the ARIFT standard library already contains the command (verb) that you want to use, then it is a simple matter to create a specific task to change the default behaviour for a specific object or if specific restrictions pass.

But what if we want to add a new command that is not in the standard library?

In this tutorial i will be creating a new "Rub Lamp" command that will summon a magic genie.

The General Task

There is no "Rub" command in the standard library, so the first thing we need to do is create a new general task to define it.

But if we just do a "Rub lamp" command, then the player will probably try to rub other objects and that will produce the message "Sorry, i didn't understand that command" which does not look very professional.

What we need to do is create a "Rub %object%" command that will respond when the player tries to rub anything.

General task's also need to respond appropriately if the player tries to do something to an object that does not exist or is not currently at the same location as the player.

This can involve writing several restrictions, however if the standard library contains a command that operates in a similar way to the one you want to create then you can right-click on it's task and select copy, then go to your own folder and right-click to paste in a copy of the task which you can then edit.

Here are the restrictions copied from the "Pull object" task:

TaskRestrictionsPull.jpg

You will still need to check the text of each restriction, in this cas we need to change the word "pull" to "rub" in the first two restrictions.

Note that we could also add a restriction that the object must be being held by the player, but i am going to allow them to rub it without having to pick it up first.

On the description page we change the name of the task, put in the appropriate command, and write the message to display on completion.

TaskGeneralRub.jpg

A bit more specific

TaskSpecificGroup.jpg

A specific object

TaskSpecificObject.jpg