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
judicar
Newbie


Joined: 25 Feb 2003
Posts: 2

PostPosted: Mon Jun 16, 2003 10:07 am   

Dragonrealms - Room list status window
 
This class creates a status window that shows a list of players in the room and a itemized list of the rooms contents. Great for spammy rooms in tf. I think you'll need to put in RoomContents and RoomOccupants global variables.


#CLASS {RoomClass}
#ALIAS ParseRoomContents {;****************************************;;Alias: ;;****************************************;#LOOPDB @ExtraMessages { #VAR tmpc %replace( @tmpc, %key, %val)};#VAR RoomContentsFullNames %replace( @tmpc, ",", "|");#VAR NumRoomItems %numitems( @RoomContentsFullNames, ",");#VAR RoomContents {};#VAR RoomContentsParsed {};#FORALL @RoomContentsFullNames {#VAR tmpc {%i};;get the noun of each item and add to list;#VAR tmpc %word( @tmpc, %numwords( @tmpc));#VAR RoomContents %additem( @tmpc, @RoomContents)};;build a recordset containing a how many of each item are in the room.;#VAR RoomContentsCounted %countlist( @RoomContents);#VAR StatusLine {};#LOOPDB @RoomContentsCounted {;loop through recordset and build a line for each item. ex: 14 goblin;#VAR tmpc {%val %key};#ADDITEM StatusLine @tmpc};#VAR StatusLine %sort( @StatusLine);#STW + %ansi( blue, bold)Items;#STW + %ansi( green, bold)------------------------;;Print everything it found to status window.;#FORALL @StatusLine {#STW + %ansi( red, bold)%i}}
#ALIAS ParseRoomOccupants {#VAR RoomOccupants {};#VAR tmpo {%1};;clean up the list of names and turn it into a string list;#VAR tmpo %replace( @tmpo, "and", "|");#VAR tmpo %replace( @tmpo, ",", "|");#VAR tmpo %replace( @tmpo, "|| ", "|");#FORALL @tmpo {;if they're sitting, kneeling, etc then the name precedes the word "who" otherwise it's the last word.;#VAR tmps %ismember( "who", %replace( %i, " ", "|"));#IF (@tmps>0) {#ADDITEM RoomOccupants %trim( %word( %i, @tmps-2))} {#ADDITEM RoomOccupants %trim( %word( %i, %numwords( %i)))}};#VAR RoomOccupants %sort( @RoomOccupants);#STW %ansi( blue, bold)Occupants;#STW + %ansi( green, bold)------------------------;;loop through list of names and print to status window;#LOOP 1,%numitems( @RoomOccupants) {#STW + %ansi( red, bold)%item( @RoomOccupants, %i)};#STW + %cr}
#VAR RoomContentsFullNames {}
#VAR tmp {} {}
#VAR RoomContentsCounted {}
#VAR NumRoomItems {}
#VAR StatusLine {}
#VAR ExtraMessages {that appears stunned which appears dead who is sitting who is kneeling who is prone , and, and ,with some stuff on it with a few fleas on it }
#VAR RoomContentsParsed {}
#VAR pt {1} {1}
#TRIGGER {Also here: (*).} {;Trigger: Fires on portion of room description that lists players.;;%1: Comma seperated list of player names.;ParseRoomOccupants {%1}}
#TRIGGER {You also see (*).} {;****************************************;;Trigger: Fires on portion of room description that lists the room's contents;;%1: Comma seperated list of item names;;****************************************;#VAR tmpc {%1};;clear the status window;#STW "";ParseRoomContents}
#TRIGGER {Also in the room: (*).} {;****************************************;;Trigger: Fires on portion of room description that lists players.;;%1: Comma seperated list of player names.;;****************************************;ParseRoomOccupants {%1}}
#TRIGGER {Q} {;Trigger: Fires on gsl Q tag. ;; %2: Time in future that roundtime will expire.;#VAR RoundTimeExpires %2} "" {gsl|case}
#CLASS 0
Reply with quote
RobAMacAF
Beginner


Joined: 24 Nov 2005
Posts: 19

PostPosted: Sun Nov 27, 2005 9:45 pm   Re: Dragonrealms - Room list status window
 
I have updated this script so it updates as people enter and exit the rooms.

------------------------

#CLASS {RoomClass}
#ALIAS ParseRoomContents {;****************************************;;Alias: ;;****************************************;#LOOPDB @ExtraMessages {#VAR tmpc %replace( @tmpc, %key, %val)};#VAR RoomContentsFullNames %replace( @tmpc, ",", "|");#VAR NumRoomItems %numitems( @RoomContentsFullNames, ",");#VAR RoomContents {};#VAR RoomContentsParsed {};#FORALL @RoomContentsFullNames {#VAR tmpc {%i};;get the noun of each item and add to list;#VAR tmpc %word( @tmpc, %numwords( @tmpc));#VAR RoomContents %additem( @tmpc, @RoomContents)};;build a recordset containing a how many of each item are in the room.;#VAR RoomContentsCounted %countlist( @RoomContents);#VAR StatusLine {};#LOOPDB @RoomContentsCounted {;loop through recordset and build a line for each item. ex: 14 goblin;#VAR tmpc {%val %key};#ADDITEM StatusLine @tmpc};#VAR StatusLine %sort( @StatusLine);#STW + %ansi( blue, bold)Items;#STW + %ansi( green, bold)------------------------;;Print everything it found to status window.;#FORALL @StatusLine {#STW + %ansi( red, bold)%i}}
#ALIAS ParseRoomOccupants {#VAR RoomOccupants {};#VAR tmpo {%1};;clean up the list of names and turn it into a string list;#VAR tmpo %replace( @tmpo, "and", "|");#VAR tmpo %replace( @tmpo, ",", "|");#VAR tmpo %replace( @tmpo, "who is sitting", "|");#VAR tmpo %replace( @tmpo, "|| ", "|");#VAR tmpo %replace( @tmpo, "||", "|");#FORALL @tmpo {;if they're sitting, kneeling, etc then the name precedes the word "who" otherwise it's the last word.;#VAR tmps %ismember( "who", %replace( %i, " ", "|"));#IF (@tmps>0) {#ADDITEM RoomOccupants %trim( %word( %i, @tmps-2))} {#ADDITEM RoomOccupants %trim( %word( %i, %numwords( %i)))}};#VAR RoomOccupants %sort( @RoomOccupants);#STW %ansi( blue, bold)Occupants;#STW + %ansi( green, bold)------------------------;;loop through list of names and print to status window;#LOOP 1,%numitems( @RoomOccupants) {#STW + %ansi( red, bold)%item( @RoomOccupants, %i)};#STW + %cr}
#VAR RoomContentsFullNames {a purple gem pouch| a bucket of viscous gloop| a large white cabinet| a dark mahogany door}
#VAR tmp {} {}
#VAR sneak {1}
#VAR RoomContentsCounted {pouch1gloop1cabinet1door1}
#VAR NumRoomItems {4}
#VAR StatusLine {1 cabinet|1 door|1 gloop|1 pouch}
#VAR ExtraMessages {that appears stunned which appears dead who is sitting who is kneeling who is prone , and, and ,with some stuff on it with a few fleas on it}
#VAR RoomContentsParsed {}
#VAR pt {1} {1}
#TRIGGER {Also here: (*).} {;Trigger: Fires on portion of room description that lists players.;;%1: Comma seperated list of player names.;ParseRoomOccupants {%1}}
#TRIGGER {You also see (*).} {;****************************************;;Trigger: Fires on portion of room description that lists the room's contents;;%1: Comma seperated list of item names;;****************************************;#VAR tmpc {%1};;clear the status window;#STW "";ParseRoomContents}
#TRIGGER {Also in the room: (*).} {;****************************************;;Trigger: Fires on portion of room description that lists players.;;%1: Comma seperated list of player names.;;****************************************;ParseRoomOccupants {%1}}
#TRIGGER {Q} {;Trigger: Fires on gsl Q tag. ;;%2: Time in future that roundtime will expire.;#VAR RoundTimeExpires %2} "" {gsl|case}
#TRIGGER {(%w) {just went|went through}*.} {//:Status Window:#CLR;#VAR tmpc {%1};#IF (%1=="group") {} {#VAR RoomOccupants %replace( @RoomOccupants, "%1", "");#VAR RoomOccupants %replace( @RoomOccupants, " |", "|");#VAR RoomOccupants %sort( @RoomOccupants);#STW %ansi( blue, bold)Occupants;#STW + %ansi( green, bold)------------------------;;loop through list of names and print to status window;#LOOP 1,%numitems( @RoomOccupants) {#STW + %ansi( red, bold)%item( @RoomOccupants, %i)};#STW + %cr;#VAR StatusLine %sort( @StatusLine);#STW + %ansi( blue, bold)Items;#STW + %ansi( green, bold)------------------------;;Print everything it found to status window.;#FORALL @StatusLine {#STW + %ansi( red, bold)%i}}}
#TRIGGER {(%w) just arrived.} {#VAR JustARrived %1;//:Status Window:#CLR;#VAR tmpc {%1};#IF (%1=="group") {} {#VAR RoomOccupants @RoomOccupants+%1;#VAR RoomOccupants %replace( @RoomOccupants, "+", "|");#VAR RoomOccupants %replace( @RoomOccupants, " |", "|");#VAR RoomOccupants %sort( @RoomOccupants);#STW %ansi( blue, bold)Occupants;#STW + %ansi( green, bold)------------------------;;loop through list of names and print to status window;#LOOP 1,%numitems( @RoomOccupants) {#STW + %ansi( red, bold)%item( @RoomOccupants, %i)};#STW + %cr;#VAR StatusLine %sort( @StatusLine);#STW + %ansi( blue, bold)Items;#STW + %ansi( green, bold)------------------------;;Print everything it found to status window.;#FORALL @StatusLine {#STW + %ansi( red, bold)%i}}}
#TRIGGER {^~[(*)~]} {#VAR RoomOccupants ""}
#CLASS 0

----------------------------
Reply with quote
healunter
Beginner


Joined: 07 Jan 2007
Posts: 17

PostPosted: Sun Jan 07, 2007 4:57 am   
 
can this be fixed to clean itself before reposting to itself?

in other words blanking it then redoing it?
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