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
➜ General
➜ Variables
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Mordikar
(5 posts) Bio
|
| Date
| Sun 18 Jan 2004 01:39 AM (UTC) |
| Message
| Hey folks, I'm trying to find some one who knows a lot about MUSHvariables, I'm trying ot make a new world for a game I play, I've scripted it in Perl, but I need help with MUSHvariables.
If you can help me, please leave a mesage or email ^^
Thanks a lot. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sun 18 Jan 2004 04:27 AM (UTC) |
| Message
| You mean MUSHclient's internal variables?
Can you describe what you are trying to achieve? Give an example? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Mordikar
(5 posts) Bio
|
| Date
| Reply #2 on Sun 18 Jan 2004 06:39 AM (UTC) |
| Message
| Well, in the game I play there is a command:
Who
That command returns a list of names, I need to take that list of names, store it in a variable [Or some thing] and when a new name enters the list, it would send a message to that new user, and if that user is banned, it would kick it out. | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #3 on Sun 18 Jan 2004 06:56 AM (UTC) |
| Message
| | If your goal is only to ban a player that shows up, you could do that using a trigger instead. That is, instead of bothering with variables and the like, simply have a trigger that fires whenever it sees a line in the who list that has this fellow's name in it. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Meerclar
USA (733 posts) Bio
|
| Date
| Reply #4 on Sun 18 Jan 2004 11:16 AM (UTC) |
| Message
| Actually, if you just want automated messages to new ppl logging in and insta-ban functions, triggers would be the way to go. Much much easier than scripting an ever changing array of names. Make two regular expressions that match whatever info you get when a player logs in, have one include a list of banned names (easy to maintain as you ban people) and the other is generic with a lower priority than the ban list so it only triggers if the person doesnt get dumped. If the entering player has been banned, the trigger will dump em on their butts otherwise it sends whatever greeting you want.
I'm not sure what codebase you're working with but every mud codebase I've ever worked with has an internal ban function that works on ip address and triggers before they ever get logged into the mud. The usual syntax is permban <ip address> and the address can be wildcarded to ban blocks of ip numbers without having to ban entire domains (aol for instance). |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | | Top |
|
| Posted by
| Mordikar
(5 posts) Bio
|
| Date
| Reply #5 on Sun 01 Feb 2004 03:18 PM (UTC) |
| Message
| Hmm...
I do know that I need MUSH variables for this to work,
but sadly, the way this game works is when a furre [person] enters the dream, I need the bot to send the trigger:
who
And I need it to take a record of all the furres that are currently in the dream, and check that every so often to make sure there are no new names, and if there are ban the banned ones, and share the shared ones.
Thankls for all you're help, It means a lot :)
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Sun 01 Feb 2004 08:03 PM (UTC) |
| Message
| Well, the exact solution would depend on the scripting language - you mentioned Perl - and the format of the who list.
However the general idea would be to make a trigger that matches what the who list output looks like, eg.
Player Name On For Idle M*U*S*H, better than sliced Bread! ^-^
Valetrem 00:02 1m I am sleeping
Ererran 00:08 7m
Fire 00:17 17m Building
Jeriraron 00:18 2m
Galasean 00:18 6m Cataloguing stars
Edag 00:19 19m
Gwa 00:39 18m
Gwiratrem 01:04 1h
Chemas 3d 20:22 16h Erm, uh, something?
There are 9 players connected.
Probably best to match this sort of stuff with a regular expression, see http://www.gammon.com.au/mushclient/regexp.htm for details about doing that.
In this case you want 3 triggers, one to start the list, one to capture each item, and one to finish the list and work out duplicates etc.
The "start" trigger might be:
Match: ^Player Name\s+On For\s+Idle\s+.*^
The "\s+" entries means "one or more spaces".
This trigger could empty out the player list variable, and enable trigger 2.
eg..
Send to: script
Send: world.SetVariable "newlist", ""
world.EnableTrigger "whomatch", 1
Regular expression: checked
Trigger 2, the "who item" trigger might be:
Match: ^(.*?)\s(\d+ d)?\d+\:\d+\s+\d+(h|m|s)\s+.*$
Label: whomatch
This matches the name, time on, and idle time, plus an optional comment.
This trigger could add to a variable, like this:
Send to: script
Send: world.SetVariable "newlist", world.GetVariable ("newlist") & "," & "%1"
Regular expression: checked
Finally, trigger 3 detects the end of the list:
Match: ^There are \d+ players connected.$
Regular expression: checked
This one disables trigger 2, and then compare the new player list to an earlier one, looking for new ones, and takes appropriate action, then it copies the new list to the old list, ready for next time.
In VBscript you might use "split" to split the list of names at a comma, and then "for each" to work your way through the list.
|
- 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.
24,310 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top