YASSE: Difference between revisions

The official GemStone IV encyclopedia.
Jump to navigation Jump to search
(Got started on this page, mostly as a way of keeping stuff straight in my head, though I'm not certain about it being appropriate for KP. Thoughts?)
 
m (Some fixes to command syntax etc)
Line 14: Line 14:
goto killminer
goto killminer
END
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:
* 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:
Line 27: Line 28:
-clear trigger
-clear trigger


* getwordfrom - This command gets a word from a string variable and returns it to the variable %w. You simply tell it the variable, reference word, and then the number of words from that word you'd like. 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:
* 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
action [I'll give you] goto getprice
Line 33: Line 34:
getprice:
getprice:
getwordfrom %l you 2
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 the gem, it'll save that variable for you to echo out or save to a file.
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.

<i>note: I can't actually make this work at the moment, though it did previously, it may be a bug in the version of YASSE I'm using or just user error.</i>
* 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:
* 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>
-set autostart <scriptname>

* gosub/return - These commands enable you to have subroutines in a script.


===Development===
===Development===
Line 45: Line 49:
===External Links===
===External Links===
* [http://sourceforge.net/projects/yasse Sourceforge Page]
* [http://sourceforge.net/projects/yasse Sourceforge Page]
* [http://en.wikipedia.org/wiki/Yasse YASSE Wikipedia Page]

Revision as of 16:03, 11 July 2006

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 diffirence 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.

Development

External Links