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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Yetzederixx
Beginner


Joined: 19 Oct 2010
Posts: 14
Location: Sulphur, LA

PostPosted: Wed Oct 27, 2010 9:23 pm   

PK Group Collection/Highlighting
 
This script will gather the players name, I'm Kylanthys in the selction of names, and place them into their pk group (clans in http://dsl-mud.org).

Selection from whoclan:
Code:

[51 Pri] [ Slayers ]         Ys'llaggra   Underlord        (Leader) (Recruiter)
[51 Arm] [ Justice ]         Rayyke       Recruit         
[51 Cle] [ Shalonesti ]      Kylanthys    Sha'falas       
[51 Inv] [ White Robes ]     Jyoti        Archmagus        (Recruiter)
[51 Pri] [ Wargar*]          Akxo         Warcouncil(Thane) (Recruiter)


Pattern: ^[(\d+) \w+] (.*).*[|)]\s+([a-z']+)\s+\a+.*
Reg Ex: True
ID : gatherNames
Code:

$clan = %if(%ends(%2, "*"), %remove("*", %2))
$clan = %replace(%2, " ", "")
#ADDITEM @$clan %3

Please take note of the @$clan. This same script in ZMUD was 548 characters long without being able to do that. My variable names are Shalonesti, WhiteRobes, etc and by using the short cut of @$clan it saved 456 chars of repetitive code.

This section actually does the highlighting:
Code:

where
Players near you:
Akrie                        Lhedr-Eowyl Pond
Erebron                      The Dining Hall
Elyrial                      Lhedr-Eowyl Pond
Kylanthys                    In The Trees

Pattern: ^([a-zA-Z']+) \s?\s+(\w+).*
Note: the \s?\s+ was necessary here to keep it from firing at wierd times, like during communications.
Reg Ex: True
Code : I'm only going to snippit the first little bit as there are 16 groups. Bravo on the #switch, it made this alot easier as I didn't have to worry about the 12ish end braces

Code:
#switch (%ismember(%1, @BlackRobes)) {#cw 96}
[/code]
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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