Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Jscript
➜ A couple of newbie questions
|
A couple of newbie questions
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Chdling
(2 posts) Bio
|
| Date
| Wed 17 May 2006 02:22 PM (UTC) |
| Message
| I'm pretty new to java and was wondering how to do the following...
Say i had a trigger
(.*) enters.
and it sent
slap %1
to the world whenever someone entered
Now if i wanted to enable and disable this trigger with an alias how would i got about it?
So far i've saved
world.EnableTrigger("(.*) enters.", true);
as a js file and surprisingly enough (told you i was new) my happyslap alias doesn't turn it on as i don't know how to add the subroutine.
Any help would be much appreciated and the end aim isn't just to slap people easier.
Ok the 2nd problem, i play a mud with a hunt command which means you can hunt your target in the vain hope you'll actually kill them.
Everytime they leave a room you follow them
e.g You hunt Nick northwest.
The downside of this is if your hunting someone else who can hunt (and they are getting the better of you) they can just drag you into the wilderness, get you lost and backhunt.
Now that's all good and fair but a large number of people use a different client with a mapper on it (it's alot different from MUSHclients) which allows you to code in rooms, press a button when lost and as if by magic it takes you back to a place your familiar with.
Now what i hope to eventually achieve is this:
first make a trigger and write a script to reverse the directions i get dragged.
You hunt (.*) (.*).
so %2 gets run through a script (use string and compareTO and probably lots of if else statements to get the reverse direction n s e w nw ne se sw etc) then send the reverse direction to a variable.
Not sure if this would work though as everytime i send to a variable it clears whatever was previously in it and i'd end up wanting
e.g
Variable
Back - to hold
n
then
You follow Nick northeast
then variable
Back - to hold
n,sw
etc
Is there an addTo variable function?
Then i'd just use certain rooms to clear the variable so whenever i used "back" it'd take me back to the last known location.
Is all of this possible? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 17 May 2006 09:57 PM (UTC) |
| Message
|
Quote:
So far i've saved
world.EnableTrigger("(.*) enters.", true);
You need to give the trigger a name (this goes in the Label field) and use that name, eg:
world.EnableTrigger("trigger3", true);
See:
http://www.gammon.com.au/scripts/doc.php?function=EnableTrigger
Quote:
Is there an addTo variable function?
Every script language will have built-in a way of concatenting strings. For instance in Jscript:
a = "Nick"
a += " Gammon"
Note (a) // Nick Gammon is printed
Quote:
(use string and compareTO and probably lots of if else statements to get the reverse direction n s e w nw ne se sw etc)
See:
http://www.gammon.com.au/scripts/doc.php?function=ReverseSpeedwalk
That will do it for you.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
12,655 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top