YASSE: Difference between revisions
m (3 revisions: Krakiipedia Import) |
m (Fixed link.) |
||
Line 2: | Line 2: | ||
===Script Compatibility=== |
===Script Compatibility=== |
||
Most scripts written for the [[Wizard (Front End |
Most scripts written for the [[Wizard (front end)|Wizard Front End]] are compatible, as are most written for [[StormFront]]. The major difference is simply variable naming conventions and it's normally straightforward to port scripts over. |
||
===Unique Features=== |
===Unique Features=== |
Revision as of 13:20, 9 December 2015
YASSE is the scripting engine developed for Avalon. It was developed mainly for DragonRealms and has many specific features for that. The scripting engine, itself, however, is very useful for GemStone IV.
Script Compatibility
Most scripts written for the Wizard Front End are compatible, as are most written for StormFront. The major difference is simply variable naming conventions and it's normally straightforward to port scripts over.
Unique Features
- %roomname - This is a variable that all scripts have access to that is the name of the room you are in (or most recently PEERed into)
- %roomdescription - This variable contains the room description, as well as the "Also here:" and "Obvious exits:/paths:" line.
- Both of these variables are very useful for scripts that need to check the contents of a room without building a matchtable and then LOOKing. This makes scripts much faster and more effecient, as well as more precise. An example usage would be:
if %roomdescription contains miner BEGIN if %roomdescription contains Also goto move goto killminer END goto move
- Triggers - These are basically match strings that will live in the memory, and every time they are matched will goto a subroutine of a running script, or call a separate script. Usage of this would be either in a script, such as this:
action [winks at you, flirting] goto flirtback
or from the command line you can set a trigger, such as:
-set trigger "winks at you, flirting" seduceher
which would run the script, "seduceher" when it matched that string. Triggers are cleared by the command:
-clear trigger
- getwordfrom - This command gets a word from a string variable and returns it to the variable %w. You simply tell it the reference word, and then the word number (or range) you'd like relative to the word you're looking for. This is useful for when you'd like to work with the words around a match string, since every time a string matches, it saves that line to %l. For example:
action [I'll give you] goto getprice matchwait getprice: getwordfrom you 2
This will set a trigger to watch for the words "I'll give you" and then get the word two after the word "you" and save it to a variable. So when the, say, jeweler tells you how much they'll give you for a gem, it'll save the second word after the word you to a variable (%w) for you to echo or save to a file.
- getword - A simpler command than getwordfrom, just gets the nth word of the line in %l (set from a match event).
- autostart script - This is a script that you can set to run each time that character is logged in. Usage would be from the command line and be:
-set autostart <scriptname>
- gosub/return - These commands enable you to have subroutines in a script.