|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Mon Feb 03, 2003 8:09 am
Need help to make triggers... |
ok... I own a ship on a star wars mud..
when i lift off it gives me this text
Launch sequence initiated.
The ship hums as it lifts off the ground.
after about 5 seconds the next message appears
The ship leaves the platform far behind as it flies into space.
ok this is when i would enter one of the 2 destinations i have chosen to fly between to get my skill up.
1) calc *PLANET ONE* *COORDINATES*;hype
2) calc *PLANET TWO* *COORDINATES*;hype
after the command hype is sent to the mud the ship can do nothing else but fly through space for the set ammount of time untill it reaches its destination...
upon reaching its destination the commands
1) course *PLANET ONE* and
2) course *PLANET TWO* must be sent... there is an additional time after these commands for the process of manuvering to complete .. then it will tell me
You begin orbitting (*PLANET ONE* or *PLANET TWO*)
once this line of text is received i then wish to
1) land *PLANET ONE* *PAD NAME*
2) land *PLANET TWO* *PAD NAME*
again there is a waiting period while the ship performs the action upon landing the text "You feel a slight thud as the ship sets down on the ground." is given to me...
my question is how do i make zMud determine between which planet i am on currently... so i dont have to enter the comands every single time i fly...
i know it has someting to do with setting up a value and then adding or subtracting from it depending on which planet i am on and then using that number to tell me which planet im on and then to fly back to the other one and then the whole process repeats....
other than that i dont really know what to do... the triggers i have set up cant do anything because the names of the planets and the landing pads are different for each planet...
in all reality i would like this to encompase all 16 planets that are available... so i can just put in something like ""launch *PLANET NAME*"" and it would fly me there automatically...
i appreciate any help anyone could provide... Thanks
I don't want the whole world, Just your half. |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Mon Feb 03, 2003 8:50 am |
ok sorry if that message was messy ill try to make it clearer...
TEXT SENT TO MUD
1) Launch
2) Calc *PLANET NAME* *COORDINATES*
3) Hype
4) Course *PLANET NAME*
5) Land *PLANET NAME*
TEXT RECEIVED FROM MUD...
1) Launch sequence initiated.
The ship hums as it lifts off the ground.
-->WAIT<---- (Not actual text received)
The ship leaves the platform far behind as it flies into space.
2) Hyperspace course set. Ready for the jump to lightspeed.
3) The stars become streaks of light as you enter hyperspace.
-->WAIT<---- (Not actual text received)
Hyperjump complete.
The ship lurches slightly as it comes out of hyperspace.
4) New course set, approaching *COORDINATES*
The ship begins to turn.
-->WAIT<---- (Not actual text received)
Manuever complete.
-->WAIT<---- (Not actual text received)
You begin orbiting *PLANET NAME*
5) Landing sequence initiated.
The ship slowly begins its landing approach.
-->WAIT<---- (Not actual text received)
Landing sequence complete.
You feel a slight thud as the ship sets down on the ground.
during these waiting periods no other commands may be entered into the ship as it is unable to do anything untill it finishes its current project..
As far as i have gotten is to set a variable equal to 0... I dont know how to do if then statements so i need help...
i hope this repost has made it more clear as to what i was trying to acheive
I don't want the whole world, Just your half. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Mon Feb 03, 2003 1:51 pm |
Let's start with a trigger that should do all of this automatically, if that works, we can build from that. Note that this trigger is for 6.40:
#TRIGGER {The ship leaves the platform far behind as it flies into space.} {calc @planet @coords}
#COND {Hyperspace course set. Ready for the jump to lightspeed.} {hype}
#COND {The ship lurches slightly as it comes out of hyperspace.} {course @planet}
#COND {You begin orbiting @planet} {land @planet @pad}
#ALIAS launch {#VAR planet %1;#VAR coords %2;#VAR pad %3;~launch}
The script is composed of a trigger that will perform each step while waiting for the text that signals the next step can be done and an alias. The alias is used is used to set the variables the trigger uses and it has this syntax:
launch planetName coords padName
So you call the alias with the planet, coordinates and pad you want to use and the trigger takes care of the rest.
Kjata |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Mon Feb 03, 2003 8:41 pm |
ok here is what im seeing.... this current sequence you gave is only one way... and then i would have to be at the comp to input the next planet and coordinates after i got done with the first planet...
each planet has its own specific coords and landing pad name... these never change... is it possible to imput these into a variable for later refrence and then when i type
something like "launch *destination*" it will automatically go back and grab that info out of the variable and begin the process of going to that planet....
and for continous traveling like back and forth between ther same 2 planets for skill practice i would enter something like
"launch *origin* *destination*" and it would take over and just fly back and forth between the 2 automatically without any additional required action on my part. as in i can get up and leave for 5 hours and when i comeback it will be still flying back and forth...
i dont know if this is possible but i appreciate all of your help so far Kjata
all in all there are 16 planets each with their own set of coords and own landing pad name... i just thought i would make 48 different variables to input all the names/coords into them and call them back out as needed... this seems kind of innefficient to me but i know of no other way...
and sorry if this makes it more difficult i use version 6.16 as that is the version that has given me the least ammount of problems in the way of freezing my puter |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Feb 03, 2003 9:31 pm |
Since you are using 6.16, you won't have the #COND command. For this script, you can just use #TR in it's place (that's not always the case). Two planets is simplest, but any number can be accomodated. All you need is another trigger which will do the alias automatically.
#TR {You feel a slight thud as the ship sets down on the ground} {#IF (@planet = "Earth"} {launch Mars 10:12:98 Marsport} {launch Earth 1:1:1 Houston}}
Substitute actual planets, coordinates, and landing pads. (as you can see, it would have been helpful if you'd listed a couple of them)
LightBulb
Advanced Member |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Mon Feb 03, 2003 10:09 pm |
ok....
My variables....
planet.1 = corellia planet.2 = coruscant
landing.1 = primary landing.2 = gamma
coords.1 = 1867 -3186 9808 coords.2 = 300 300 300
ok say im start on corellia and i want to fly to coruscant and then back to corellia and repeat said actions over and over.
launch origin destination
launch corellia coruscant
when i type that in, another variable in the trigger -lets say i called it "repeat"- i was thinking that it has
to be set to 0 or 1 and depending on which it is, is which planet it will go to...ofcourse i would include all the numbers 0-15 to make up for the 16 planets
as i said before i am new to programmin but i have gathered this from looking through some scripts in hopes that i can salvage bits and peices of those to help solve my situation...
there are only 2 reasons i could find to not use your code Kjata... One.. it is only set up to make a one way travel between planets. Two.. not all the time do i exactly remember the planets name or the landing pad name or even the coords... some of those are mighty hard to comit to memory... so therefore what im looking for is just a 2 or 3 word trigger phrase that will initate the whole process of fetching the coords/names from its memory and using those to proceed.
And if at all possible could you add to this something that would enable/disable the whole sequence when i did it like i could put it on a macro or something
i hope this has cleared it up for anyone else that reads this post i know it has a little bit for me. And sorry if i repeat everything over and over again.. i guess i really dont get it and im still trying to explain it to myself too |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Feb 04, 2003 2:04 am |
Don't worry about giving too much info, that almost never happens, and it's better than not giving enough.
I've deliberately chosen variable names that don't match the ones you already have. Change them to match if you don't mind overwriting your existing variables.
#VAR planets %null
#VAR coord %null
#VAR pads %null
#AL addplanet {#ADDITEM planets {%1};#ADDKEY coord {%1} {%2 %3 %4};#ADDKEY pads {%1} {%5}}
#AL delplanet {#DELITEM planets {%1};#DELKEY coord {%1};#DELKEY pads {%1}}
#AL ap {#IF %class( AutoPilot) {#T- AutoPilot} {#T+ AutoPilot}}
#TR {You begin orbiting (%w)} {#VAR location %ismember( %1, @planets);#IF %ismember( %1, @planets) {} {#T- AutoPilot;#MESS {Unknown planet! Autopilot disabled!}}}
#CLASS AutoPilot disable
#TR {^The ship leaves the platform far behind as it flies into space.} {#IF (@location < %numitems( @planets)) {calc %item( @planets, (@location + 1)) %db( @coord, %item( @planets, (@location + 1)))} {calc %item( @planets, 1) %db( @coord, %item( @planets, 1))}}
#TR {^Hyperspace course set. Ready for the jump to lightspeed.} {hype}
#TR {^The ship lurches slightly as it comes out of hyperspace.} {#IF (@location < %numitems( @planets)) {course %item( @planets, (@location + 1))} {course %item( @planets, 1)}}
#TR {^You begin orbiting (%w)} {#VAR location %ismember( %1, @planets);land %1 %db( @pads, %1)}
#TR {^You feel a slight thud as the ship sets down on the ground.} {d;s;s;open hatch;leaveship;close shadow;refuel shadow full;open shadow 81349;enter shadow;close hatch;n;n;u;launch}
#CLASS 0
To add planets, use the addplanet alias
addplanet corellia 1867 -3186 9808 primary
To remove planets, use the delplanet alias
delplanet corellia
To switch on/off, type:
ap
If it's on, it will take over whenever the next trigger phrase arrives, so the easiest way to start is to turn it on (ap) and then launch.
Be sure to remove Kjata's script first! It will cause conflicts if it's running.
LightBulb
Advanced Member
Script corrected. Changes in red. |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Tue Feb 04, 2003 3:06 am |
hmm well the stuff looks good and everything but it dosent work.... i have added 2 planets corellia and coruscant both with their respective coords and pads... I entered then with the addplanet alias you set up just as you showed... but when i launch the system dosent go.. ive landed and tried to turn ap on again and relaunch still dosent work....ive done this for about 10 launches so far...
another problem i have seen in the code *my fault sorry* is that i forgot to tell you that after each landing i must exit my ship and refuel it... i dont see a place where this could be entered in this code but as i said i am quite new to this...
the mud i play is called Legend of the Jedi at 198.107.27.119 port 5555
my characters name is Azuel if anyone wishes to contac me on said mud i will be there for another 4 hours after this post
when you first get on *tell azuel *MESSAGE** include the fact that your trying to help me get my triggers going otherwise i prolly wont talk to you... my character isnt a very social person..
if you log on i will begin to teach you the skills you need to know to pilot a ship so you can therefore learn the sequences by yourself rather than me mesing them up trying to convey them...
i thank all of you for your help it is greatly appreciated.
currently these are the problems i have run into by copy and pasting all that code into my zMud command line and hitting enter it does everything up untill the first trigger it has a problem with the #T- and then after fixing that it has a problem with #message im unsure what to do because i dont code... it keeps giving me syntax errors...
dont know what else to give ya on that subject.... |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Tue Feb 04, 2003 4:51 am |
OK here is new idea....
make database... input all the information into the database to hold for later recovery...
Alias: addinfo (PLANETNAME) (PLANETCORDS) (PADNAME) (1-16) similar to Lightbulb's addplanet idea and design but put it into a database rather than a variable and putting them in there with a specified number as to which planet it is 1-16
Alias: launch (%A 1-16) (%B 1-16) A being the planet im on B being the planet i want to travel to... if i A is given as 0 then i would like it to just fly to B and stay there but if anything other than 0 is given in A, then i want it to fly back and forth untill i stop it namely by disabling the triggers that run the sequences. which i hope would be put into their own folder to keep mess to a minimum
Trigger: The ship leaves the platform far behind as it flies into space
Command: calc (planet that im going to)
Trigger: Hyperspace course set. Ready for the jump to lightspeed
Command: hype
Trigger: The ship lurches slightly as it comes out of hyperspace
Command: course (planet that im going to)
Trigger: You begin orbiting (destination planet)
Command: land (planet) (padname) <-- as stated above looking for way to recall all of this from database according to planet number given in launch sequence
Trigger: You feel a slight thud as the ship sets down on the ground
Command: d;s;s;open hatch;leaveship;close shadow;refuel shadow full;open shadow 81349;enter shadow;close hatch;n;n;u the character ; is used as my seperator in zmud to send the bunched commands sepratly
now the only reason i am trying to redo this is because i am hoping it will be more comprehendable to me as i didnt understand how the other code worked.. probabbly still wont on this but i do have some experience with databses so i chose this way as it is a little familiar
i hope i havent upset anyone by changing my mind too many times and trying to get too much out of anyone i know that what im asking cant be all together easy..
I don't want the whole world, Just your half. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Feb 04, 2003 12:25 pm |
Here's the script according to your new idea:
#ALIAS addinfo {#VAR newPlanet "";#ADDKEY newPlanet Name %1;#ADDKEY newPlanet Coords %2;#ADDKEY newPlanet Pad %3;#NEW All @newPlanet}
#ALIAS launch {#VAR loop 0;#IF (%1 = 0) {#VAR loop 1};#VAR curPlanet %2;#VAR returnPlanet %1;~launch}
#CLASS autoPilot
#TRIGGER {The ship leaves the platform far behind as it flies into space} {calc db(@curPlanet, "Name") %db(@curPlanet, "Coords")}
#TRIGGER {Hyperspace course set. Ready for the jump to lightspeed} {hype}
#TRIGGER {The ship lurches slightly as it comes out of hyperspace} {course %db(@curPlanet, "Name")}
#TRIGGER {You begin orbiting} {land %db(@curPlanet, "Name") %db(@curPlanet, "Pad")}
#TRIGGER {You feel a slight thud as the ship sets down on the ground} {d;s;s;open hatch;leaveship;close shadow;refuel shadow full;open shadow 81349;enter shadow;close hatch;n;n;u;#IF (@loop) {#VAR temp @curPlanet;#VAR curPlanet @returnPlanet;#VAR returnPlanet @temp;#UNVAR temp;#GAG;~launch}}
#CLASS 0
First you need to create the database fields. The database will contain three fields which must be named "Name", "Coords", and "Pad". Then, use the addinfo alias, which does not require a planet number (the number goes from 0 to 15 in the order you add them), to add each planet to the database. After that, you can use the launch alias like you described and everything should continue from there automatically.
Kjata |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Feb 04, 2003 3:52 pm |
Sorry, I thought I'd caught all my mismatched {}'s, but I left a couple }'s off the first trigger. I've corrected it now (in case someone else tries the script). The editor's complaint about #MESSAGE can be corrected by changing the command to #MESS.
If you want the ship to fly back and forth between two (or more) planets indefinitely, you'll also need a trigger for the launch command (unless launch can be added to the end of the refuel string).
LightBulb
Advanced Member |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Tue Feb 04, 2003 8:06 pm |
SETBACK #1
im pretty sure this would matter so what was your primary idea that the database was going to be called... i called it db seeing as that was the only one that would collect the info i entered "although flawed" ... when i entered addinfo Coruscant 300 300 300 Primary, here is what got entered into the database with current coding..
name 300
coords Primary
pad 300
SETBACK #2
i get this error on the launch trigger
calc db (@curPlanet, "Name") %db(@curPlanet, "Coords")
^ syntax error
this is the text that was sent to the mud causing the mud to say the system isnt known
calc db(2, Name) 4300 4300 4300 <--- the only reason it has all 3 of the munbers is because i edited the database record
SETBACK #3
the only way the loop will continue is if I type Launch # or if i enter Launch 0 # it was supposed to be if i enter launch 0 it would only go one way and the loop wouldnt continue... i have decided to change 0 in the coding to -1 since 0 is actually a planet in the database.
well ok i got the addinfo to work a little bit better by changing the addinfo alisas to this
#VAR newPlanet ""
#ADDKEY newPlanet Name %1
#ADDKEY newPlanet Coords %2 %3 %4
#ADDKEY newPlanet Pad %5
#NEW All @newPlanet
but it still dosent capture the 3 numbers in the coordinates only the first one
addinfo Coruscant 300 300 300 Primary
name Coruscant
coords 300
pad Primary
like that i ws hoping that having %2 %3 %4 in the same row would get all 3 of the numbers but that seems to have failed also
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Feb 04, 2003 9:40 pm |
Ok, the last two are small oversights on my part. Here are the needed changes:
#ADDKEY newPlanet Coords %2
should be:
#ADDKEY newPlanet Coords "%2"
and then enclose the coordinates in double quotes when calling the alias. Example:
addinfo Coruscant "300 300 300" Primary
Next:
#TRIGGER {The ship leaves the platform far behind as it flies into space} {calc db(@curPlanet, "Name") %db(@curPlanet, "Coords")}
should be:
#TRIGGER {The ship leaves the platform far behind as it flies into space} {calc %db(@curPlanet, "Name") %db(@curPlanet, "Coords")}
Finally:
#IF (%1 = 0) {#VAR loop 1}
should be:
#IF (%1 <> -1) {#VAR loop 1}
Notice that if you delete a record from the database, the record numbers do not change to fill up the gap. If you have to do this, you should consider deleting the database completely (delete the .db file) and start it again so you have the planet numbers from 0 to 15 correctly.
Kjata |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Tue Feb 04, 2003 9:52 pm |
#ADDKEY newPlanet Coords "%2" thats what it shows up as when i enter it into the editor
not #ADDKEY newPlanet Coords "%2"
im guessing it dosent recognize the "" and therefore not the %2 inside of it because it dosent turn blue
and it gives this in the database still
Name: 300
Coords: Primary
Pad: 300 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Feb 04, 2003 10:02 pm |
Heh, don't mind the colors. I just like to put it blue because it distinguishes it from normal text and beacause I really think zMUD should color it that way. The reality is that pretty print in zMUD cannot recognize this as a special case inside a string and does not color it, but it does not affects the script in any way.
If it doesn't want to work, then you can try braces {} instead of the double quotes.
Kjata |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Feb 04, 2003 10:34 pm |
Since the coordinates are a group of three numbers, just use three parameters for them.
#ALIAS addinfo {#VAR newPlanet "";#ADDKEY newPlanet Name %1;#ADDKEY newPlanet Coords {%2 %3 %4};#ADDKEY newPlanet Pad %5;#NEW All @newPlanet}
LightBulb
Advanced Member |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Tue Feb 04, 2003 10:51 pm |
ok thanks guys the help is greatly appreciated
it all seems to work properl;y now thanks
I don't want the whole world, Just your half. |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Wed Feb 05, 2003 4:40 am |
ummm not to ask too much but can u guys help me add to this set of triggers an alias like Lightbulb had on his i just type AP and it turns it on or off... *preferably with a text reply* so i can know wether its on or off without guessing...
please and thank you
I don't want the whole world, Just your half. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Feb 05, 2003 5:05 am |
Kjata used "autoPilot" as the class, so it's just a minor change in capitalization (actually, zMUD will ignore the capitalization). The simplest way to handle notification is through the status line (or window), but a button would work well also.
#AL ap {#IF %class( autoPilot) {#T- autoPilot} {#T+ autoPilot}}
#ST Autopilot %if( %class( autoPilot), %ansi(bold, green)ON, %ansi(bold, high, red)OFF)%ansi(black)
Kjata, I think your version turned out best. It might make a good addition to the Finished Scripts forum.
LightBulb
Advanced Member |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Wed Feb 05, 2003 5:46 am |
go ahead and add it if ya want you guys are the ones who made it for me...
and thanks alot to everyone who helped i really appreciate it.
I don't want the whole world, Just your half. |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Fri Feb 07, 2003 4:04 am |
ok Lightbulb....
that sequence for the addind a thing to make me be able to see if the autopilot triggers are on or not dosent work it just always stays green.....
i type ap into the command line and it does actually disable the folder that the triggers are in but it dosent change the little autopilot text color at the bottom of the screen....
ok....scratch that... here is what i can see from further investigation... the alias ap first of all dosent even turn the folder autoPilot on or off... and it also dosent show the correct color when the folder is or isnt activated it always just shows the green... ??? dunno what to do pls help
can you make it into a button for me... i click it it turns the folder off.. i click again it turns it on and it sayd either Ap on or Ap off color dosent matter..
please and thanks
I don't want the whole world, Just your half. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 07, 2003 4:57 am |
It works in v6.40. I think status lines needed an actual variable in v6.16, but it might just be the %class function, I think that's new since v6.16. Try it with the %trigger function instead (they do the same thing). Although, if that's the problem the alias shouldn't work right either.
#AL ap {#IF %trigger( autoPilot) {#T- autoPilot} {#T+ autoPilot}}
#ST Autopilot %if( %trigger( autoPilot), %ansi(bold, green)ON, %ansi(bold, high, red)OFF)%ansi(black)
As for a button:
- Go to the button editor (click the Buttons icon)
- Click the New button
- Set the Caption to Ap OFF
- Change the Kind to Toggle
- For the Value type
#T+ autoPilot
- Click Save
- Next to the Kind dragdown menu is a State dragdown menu, select the second Button
- Set the Caption to Ap ON
- Set the Value to
#T- autoPilot
- Go to the Advanced tab
- Set the Value to
%trigger( autoPilot)
You can change the size and position on the Position/Size tab. If you decide you want color changes, use the color buttons next to the two Captions.
LightBulb
Advanced Member
Just saw the change to your post, it looks like %class is the problem -- change it to %trigger |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Fri Feb 07, 2003 5:13 am |
ok thanks all that worked great... thanks a bunch...
now another favor....
i want to set up aliases for each nunber 0-15 when i enter the alias i would like it to recall the information out of our database we have made and then send that to the mud
so by setting off the alias "0" (which is the entry in the database referring to coruscant) the prog sends sends the command calc Coruscant 300 300 300 Primary ; hype
no need for it to do the rest of the stuff just calc and then hype
thanks for the help so far...
I don't want the whole world, Just your half. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 07, 2003 7:00 am |
I think this will work:
#AL 0 {calc %db( 0, Name) %db( 0, Coords) %db( 0, Pad);hype}
LightBulb
Advanced Member |
|
|
|
Aiesha Beginner
Joined: 09 Jan 2002 Posts: 29 Location: USA
|
Posted: Fri Feb 07, 2003 7:22 am |
yep thanks alot man i preciate it more than you know *prolly just saved my life on the game*
and ya only get one life soo thats definatly important
thanks
I don't want the whole world, Just your half. |
|
|
|
|
|