|
hannerii Newbie
Joined: 14 Mar 2007 Posts: 7
|
Posted: Sun Oct 19, 2008 2:48 pm
#STW |
Hey everyone, Im using a trigger that calls two aliases. I parses the room description for items and people then outputs it to a Status window using #STW (text). The problem i am having is that it keep generating many many status window artifacts in the class list. Can you not have a single Status window that both aliases will output too and not generate unqiue individual windows?
EDIT: http://www.emobius.com/phpbb/viewtopic.php?t=12097 this is the original posting of the code but i edited it some so cmud would take it. |
|
Last edited by hannerii on Sun Oct 19, 2008 3:29 pm; edited 1 time in total |
|
|
|
hannerii Newbie
Joined: 14 Mar 2007 Posts: 7
|
Posted: Sun Oct 19, 2008 3:01 pm |
Alias: ParseRoomContents{
#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}
#VAR tmpc %word( @tmpc, %numwords( @tmpc));
#VAR RoomContents %additem( @tmpc, @RoomContents)
}
#VAR RoomContentsCounted %countlist( @RoomContents);
#VAR StatusLine {};
#LOOPDB @RoomContentsCounted
{
#VAR tmpc {%val %key};
#ADDITEM StatusLine @tmpc
};
#VAR StatusLine %sort( @StatusLine);
#STW + %ansi( blue, bold)Items;
#STW + %ansi( green, bold)
#FORALL @StatusLine
{
#STW + {%ansi( red, bold)%i} {RoomClass} {1}
} |
|
|
|
hannerii Newbie
Joined: 14 Mar 2007 Posts: 7
|
Posted: Sun Oct 19, 2008 3:27 pm |
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)} {RoomClass} {1}
};
#STW + {%cr} {RoomClass} {1} |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Oct 20, 2008 1:32 pm |
From the documentation for #stw:
Quote: |
The status window can be added to by putting + before the string. If multiple status windows are defined they will be displayed in one window with a new line between each.
|
|
|
|
|
hannerii Newbie
Joined: 14 Mar 2007 Posts: 7
|
Posted: Tue Oct 21, 2008 7:27 pm |
Ayes, and as it is i am using the + before the string and it still doesn't keep it in the same window mate.
|
|
|
|
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Tue Oct 21, 2008 9:17 pm |
i have played with it in old version, but mechanics are probably the same
dont use #STW +, it will add element with name=value in default class, so you have little chance changing it later:P
use
#STW {@parsedvar1} class ref1
#STW {@parsedvar2} class ref2
etc
then reparse to storage vars as needed |
|
|
|
hannerii Newbie
Joined: 14 Mar 2007 Posts: 7
|
Posted: Tue Oct 21, 2008 11:25 pm |
So if i want to run through a loop and output stuff to the same status window i would use #STW {info to add} {class with stw} {stw static name} yes?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Oct 23, 2008 7:35 pm |
Could post the original mud text and the triggers you are using to capture it?
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Oct 23, 2008 8:44 pm |
I apologize for posting my message with the section from the manual. I was about to logoff and was in a bit of a rush, so I didn't notice that you had, in fact, been using the + as directed by the documentation.
|
|
|
|
|
|