Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Kronus
Wanderer


Joined: 13 Jan 2002
Posts: 76
Location: USA

PostPosted: Mon Jul 08, 2002 2:13 am   

Classes
 
Hello, I am sort of a newbie to zMUD scripting. My questions is about Classes. I am not sure how they apply to scripting in zMUD. If someone could give me an example of how Classes might be used practicly, or just give me some of the advantages or just in general what classes are! Thanks.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Jul 08, 2002 4:57 am   
 
quote:

Hello, I am sort of a newbie to zMUD scripting. My questions is about Classes. I am not sure how they apply to scripting in zMUD. If someone could give me an example of how Classes might be used practicly, or just give me some of the advantages or just in general what classes are! Thanks.



Classes are little more than file folders. They don't DO anything (ie, a trigger will match a line, an alias will run code, you can click a menu/button that executes code, etc), but they make scripting life far easier.

For instance, let's say that I have these three lines that frequently appear in the MUD:

** Mary Jane just arrived in the world.
** Mary Jane has left the world.
** Mary Jane has left the world unexpectedly.

And let's say I wanted to throw that into a window called Arrivals in a colorized, time-stamped, labeled format:

(IN, 12:34:14 PM): Mary Jane

I could do this in one class, like this:

#class Arrivals
#trigger {^ ~*~* (*) just arrived in the world.} {:Arrivals:%ansi(red)~(%ansi(green)IN%ansi(red), %ansi(yellow)%time(hh:nn:ss AMPM")%ansi(red)~): %ansi(blue)%1}
#trigger {^ ~*~* (*) has left the world.} {:Arrivals:%ansi(red)~(%ansi(green)OUT%ansi(red), %ansi(yellow)%time(hh:nn:ss AMPM")%ansi(red)~): %ansi(blue)%1}
#trigger {^ ~*~* (*) has left the world unexpectedly.} {:Arrivals:%ansi(red)~(%ansi(green)DISCO%ansi(red), %ansi(yellow)%time(hh:nn:ss AMPM")%ansi(red)~): %ansi(blue)%1}
#class 0

Now, I actually have this down to just one trigger but assuming we're dealing with multiple triggers, buttons, aliases, etc we can enable or disable ALL of them by referring to the class instead of each individual setting:

#T+ Arrivals -- turns on the class
#T- Arrivals -- turns off the class

That's really the main advantage of a class, but like I said it makes life a whole lot easier by keeping yourself organized.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Kronus
Wanderer


Joined: 13 Jan 2002
Posts: 76
Location: USA

PostPosted: Mon Jul 08, 2002 5:21 pm   
 
So in essence your telling me that Classes is little more than a folder that keeps all related script stuff together. Right?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Jul 08, 2002 5:49 pm   
 
Exactly.

They also very useful ability to turn off
all the junk in them when not needed as
Matt's example. Last thing you want is
all lot of triggers active that aren't always
needed which lag your computer.

Ton Diening
Providing untested answers that tend to be
more complicated than others.
Reply with quote
Kronus
Wanderer


Joined: 13 Jan 2002
Posts: 76
Location: USA

PostPosted: Mon Jul 08, 2002 6:33 pm   
 
Ahhhh ok thank you both for you answers! Maybe I'll put them to good use... now for the rest of my script....
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net