|
NovaWo1f Newbie
Joined: 02 Jun 2002 Posts: 8 Location: USA
|
Posted: Wed Jul 24, 2002 8:35 pm
Newbie needs help with variables :/ |
Hi, I dont know a thing about variables and stuff, and I was just wondering how I would do this.. What I'm wanting to do is setup a trigger I assume that would launch a ship, when it leaves the platform calculate a set course, enter hyperspace, when it comes out land. When it lands take off, and calculate back to its originating position, and repeat. I assume I'd have to set a variable or something to say what planet its on now, and what it needs to go to next. But dont know how to do this.
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Jul 24, 2002 9:16 pm |
Without more information, I can't give you much help. You need to post more information about how all of this that you want to do works in your MUD.
Anyway, some here is some basic stuff:
#VAR varName {value}
This creates a variable with the name of varName and contents of value. If a variable by that name already exits, its contents are replaced with the new value. Anytime that you want to access the contents of this variable, just put the name after an @, like this:
@varName
You can also create triggers. A trigger is a piece of code that is executed when text that matches your pattern is sent from the MUD. You can create a trigger by entering this into the command line:
#TRIGGER {pattern} {commands}
You can also create a trigger using the Settings Editor. In this case you would put pattern into the box named Pattern and commands into the box named Value.
The pattern is the piece of text that you want to match from the MUD. It may contain wildcards. Wildcards allow you to match unkown text. For example, you may match a word or a number. If you want to save whatever was matched by a wildcard, you enclose it in parenthesis. Here is an example pattern:
You get (%d) coins from %w.
This will look for a line like - "You get 1000 coins from Kjata." - and will store the text matched by %d, but not the one from %w since it isn't in parenthesis. If you want to access the saved text, you reference it in the form of %n. For example, you would acces what was matched by %d by using %1. If anything else from the pattern was saved, it would be %2, and so on.
That should get you one your way. For more information, read the topics in the Getting Started section fo the help file.
Kjata |
|
|
|
NovaWo1f Newbie
Joined: 02 Jun 2002 Posts: 8 Location: USA
|
Posted: Wed Jul 24, 2002 9:41 pm |
Allright, I'll -attempt- to try it myself, But in case I fail heres exactly what I want to do:
First, launch the ship by sending:
launch
Next when this text is received:
The ship leaves the platform far behind as it flies into space.
send:
calculate sullust
Plus set a variable so it knows its going to sullust.
Next when this is received:
Ready for the jump to lightspeed.
Send this:
hyperspace
Next it'll receive this text:
The ship lurches slightly as it comes out of hyperspace.
When it does send:
land sullust
Once it gets:
You feel a slight thud as the ship sets down on the ground.
Need to launch, and repeat the whole process, this time instead of calculating to sullust calculate to coruscant, and insteaad of landing at sullust, land at landing. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Jul 24, 2002 10:15 pm |
You are really looking for a basic set of triggers. You can send the first launch yourself. You may have to turn off these triggers if you get disconnected in the middle, but I am sure you can figure it out.
#TR {^The ship leaves the platform far behind as it flies into space.$} {#IF (@Dest="landing" {calculate sullust;#VAR Dest {sullust}} {calculate coruscant;#VAR Dest {landing}}}
#TR {^Ready for the jump to lightspeed.$} {hyperspace}
#TR {^The ship lurches slightly as it comes out of hyperspace.$} {land @Dest}
#TR {^You feel a slight thud as the ship sets down on the ground.$} {launch} |
|
|
|
NovaWo1f Newbie
Joined: 02 Jun 2002 Posts: 8 Location: USA
|
Posted: Wed Jul 24, 2002 10:38 pm |
Thanks, almost works, except it doesn't seem to store the var...when i first launched i had to calculate manualy cause it didnt trigger, and then when it came out it sent "land" with no args, when i view it in the settings it says theres a syntax error..
#IF (@Dest="landing" {calculate sullust;#VAR Dest {sullust}} {calculate coruscant;#VAR Dest {landing}}
^ syntax error
the little arrow is pointed to the { right before calculate. |
|
|
|
NovaWo1f Newbie
Joined: 02 Jun 2002 Posts: 8 Location: USA
|
Posted: Wed Jul 24, 2002 10:49 pm |
Nevermind, figured it out, needed to put ) after the @Dest="landing" :)
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|