Greetings!
I have a script that was written in Zmud, and being that I'm
in the infantile stages of Learning Lua, I was wondering if anyone could take a moment to explain how I would go about converting it to work in Lua on MUSHClient. The Script is as follows:
#CLASS {Dwarf} {enable}
#ALIAS scan {#VAR dir {};#VAR distance 0;#T+ scan;~scan;emote done}
#VAR imps {31}
#TRIGGER {You eat a warp pill.} {scan}
#TRIGGER {Ballox done} {eat warp}
#CLASS 0
#CLASS {Dwarf|scan} {disable}
#TRIGGER {Nearby (%w):} {#VAR dir %1;#VAR distance 1;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}}
#TRIGGER {Not Far (%w):} {#VAR dir %1;#VAR distance 2;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}}
#TRIGGER {Far off (%w):} {#VAR dir %1;#VAR distance 3;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}}
#TRIGGER {- Something Shiny} {#IF (@distance = 0) {~get all};#IF (@distance = 1) {@dir;~get all;@backtrack};#IF (@distance = 2) {@dir;@dir;~get all;@backtrack;@backtrack};#IF (@distance = 3) {@dir;@dir;@dir;~get all;@backtrack;@backtrack;@backtrack}}
#TRIGGER {Right (%w):} {#VAR dir %1;#VAR distance 0}
#CLASS 0
If you'll notice, I'm fairly certain that one of the most frequently recurring and vital parts of the script, the backtrack function, is not a recognizable function in LUA or by MUSHClient, which triggers the player to, if encountering an object that fires the trigger, to travel to the location of the object (token), and then reverse the steps traveled to get to the object.
Additionally, and I know this is fairly simple and I'm just not entirely spotless on the notion, how would I go about making an alias that would cause Muschlient to recognize and paste a trigger if the input were #Trigger? I.E. so I could type the script into the command input bar and make MUSHClient record it as a trigger, or a script, or a set of triggers?
Forgive me if this is elementary knowledge, I swear I've been skimming forums, most of which assume the user has atleast some knowledge of scripting and programming language, of which I have none, but am enthusiastic about learning.
I have a script that was written in Zmud, and being that I'm
in the infantile stages of Learning Lua, I was wondering if anyone could take a moment to explain how I would go about converting it to work in Lua on MUSHClient. The Script is as follows:
#CLASS {Dwarf} {enable}
#ALIAS scan {#VAR dir {};#VAR distance 0;#T+ scan;~scan;emote done}
#VAR imps {31}
#TRIGGER {You eat a warp pill.} {scan}
#TRIGGER {Ballox done} {eat warp}
#CLASS 0
#CLASS {Dwarf|scan} {disable}
#TRIGGER {Nearby (%w):} {#VAR dir %1;#VAR distance 1;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}}
#TRIGGER {Not Far (%w):} {#VAR dir %1;#VAR distance 2;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}}
#TRIGGER {Far off (%w):} {#VAR dir %1;#VAR distance 3;#IF (@dir = West) {#VAR backtrack East};#IF (@dir = Down) {#VAR backtrack Up};#IF (@dir = Up) {#VAR backtrack Down};#IF (@dir = South) {#VAR backtrack North};#IF (@dir = North) {#VAR backtrack South};#IF (@dir = East) {#VAR backtrack West}}
#TRIGGER {- Something Shiny} {#IF (@distance = 0) {~get all};#IF (@distance = 1) {@dir;~get all;@backtrack};#IF (@distance = 2) {@dir;@dir;~get all;@backtrack;@backtrack};#IF (@distance = 3) {@dir;@dir;@dir;~get all;@backtrack;@backtrack;@backtrack}}
#TRIGGER {Right (%w):} {#VAR dir %1;#VAR distance 0}
#CLASS 0
If you'll notice, I'm fairly certain that one of the most frequently recurring and vital parts of the script, the backtrack function, is not a recognizable function in LUA or by MUSHClient, which triggers the player to, if encountering an object that fires the trigger, to travel to the location of the object (token), and then reverse the steps traveled to get to the object.
Additionally, and I know this is fairly simple and I'm just not entirely spotless on the notion, how would I go about making an alias that would cause Muschlient to recognize and paste a trigger if the input were #Trigger? I.E. so I could type the script into the command input bar and make MUSHClient record it as a trigger, or a script, or a set of triggers?
Forgive me if this is elementary knowledge, I swear I've been skimming forums, most of which assume the user has atleast some knowledge of scripting and programming language, of which I have none, but am enthusiastic about learning.