[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Variables
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Variables

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Mordikar   (5 posts)  [Biography] bio
Date Sun 18 Jan 2004 01:39 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (19,188 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 18 Jan 2004 04:27 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Mordikar   (5 posts)  [Biography] bio
Date Reply #2 on Sun 18 Jan 2004 06:39 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #3 on Sun 18 Jan 2004 06:56 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Meerclar   USA  (554 posts)  [Biography] bio
Date Reply #4 on Sun 18 Jan 2004 11:16 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Mordikar   (5 posts)  [Biography] bio
Date Reply #5 on Sun 01 Feb 2004 03:18 PM (UTC)  quote  ]
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 :)
[Go to top] top

Posted by Nick Gammon   Australia  (19,188 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sun 01 Feb 2004 08:03 PM (UTC)  quote  ]
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
[Go to top] 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.


1,904 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]