|
bair Beginner
Joined: 31 Oct 2006 Posts: 22
|
Posted: Sat Dec 01, 2007 9:16 pm
help w/ who list capture |
If someone could please write this i'd appreciate it a lot. I'm having trouble finding information that I need w/ the cmud help files. I need a script to capture the who list to a who window (clearing the window everytime I type who), and updating it according to when people log in and off.
Here is the text when people log in and out:
Code: |
[ ?% ] < 100% > <14066hp 14066m 14066mv> [79 bl] [6744 exp] Info -> Typhon has entered the Vampire Wars.
Info -> Typhon has left the Vampire Wars.
[ ?% ] < 73% > <10385hp 416m 14066mv> [63 bl] [9550 exp] Info -> Cuthbert has entered the Vampire Wars.
Info -> Cuthbert has left the Vampire Wars.
Info -> Makoto has left the Vampire Wars.
|
Here is the text from a who list:
Code: |
[ 57% ] < 97% > <13708hp 12526m 14068mv> [69 bl] [192147 exp] --------------------------------------------------------------------------------
Newbie Busted the mortal
Hero Mischief is old man gloom.
Destroyer Bair is so clean in his black bandana
Mortal Xixor The Psychopathic Saint
Mortal Lily is just here.
--------------------------------------------------------------------------------
There are 5 visible players.
There are a total of 5 players connected.
--------------------------------------------------------------------------------
|
Sometimes my prompt comes up, sometimes it doesnt. Thanks a lot. I just need the names in the window (busted, mischief, bair, etc.) |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sat Dec 01, 2007 10:30 pm |
Code: |
#TR {Info -> (%w) has entered the Vampire Wars.} {#ADDITEM whoList %1}
#TR {Info -> (%w) has left the Vampire Wars.} {#DELITEM whoList %1}
#alias who {~who;whoCap = 1}
#TR {^--------------------------------------------------------------------------------} {#if (@whoCap = 1) {whoList = "";whoCap = 0}}
#TR {^%w %s(%w)*} {#if (@whoCap) {#ADDITEM whoList %1}}
#TR {^There are %d visible players.} {whoCap = 0} |
A caption to display the whoList could be
Code: |
%expandlist(@whoList, %cr) |
Think that should be a good start |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sat Dec 01, 2007 10:32 pm |
This one is pretty straight forward.
Code: |
#CLASS WhoCapture
#VAR wholist ""
#TR {Info -> (%w) has left the Vampire Wars.} {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#DELITEM wholist %1;#EXEC updatewho}
#TR {Info -> Typhon has entered the Vampire Wars.} {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#ADDITEM wholist %1;#EXEC updatewho}
#TR {--------------------------------------------------------------------------------} {#T+ SnagWho;#STATE 1}
#COND {--------------------------------------------------------------------------------} {#T- SnagWho;updatewho;#STATE 2}
#COND {--------------------------------------------------------------------------------} {#STATE 0}
#ALIAS updatewho {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#CLR;:WhoList:#loop %numitems(@wholist) {#SAY %item(@wholist, %i)}
#CLASS 0
#CLASS {WhoCapture|SnagWho}
#TR {^(%w)(%s)(%w)} {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#ADDITEM wholist %3}
#CLASS 0
|
|
|
|
|
bair Beginner
Joined: 31 Oct 2006 Posts: 22
|
Posted: Sat Dec 01, 2007 11:46 pm |
ralgith wrote: |
This one is pretty straight forward.
Code: |
#ALIAS updatewho {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#CLR;:WhoList:#loop %numitems(@wholist) {#SAY %item(@wholist, %i)}
|
|
I get a illegal token error here, thanks for your help btw. nevermind, fixed that, was missing a brace on the end. |
|
|
|
bair Beginner
Joined: 31 Oct 2006 Posts: 22
|
Posted: Sat Dec 01, 2007 11:58 pm |
Code: |
[ ?% ] < 100% > <14088hp 14088m 14088mv> [67 bl] [82736 exp] who
--------------------------------------------------------------------------------
Destroyer Bair is so clean in his black bandana
Rogue Drakul.
Adventurer Typhon small demon
Warrior Niasen has started a small fire in your Mom's panties!
--------------------------------------------------------------------------------
There are 4 visible players.
There are a total of 4 players connected.
--------------------------------------------------------------------------------
|
Gives me:
Code: |
sun
Typhon
Niasen
Drakul
Bair
|
I don't quite understand where "sun" comes from. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 02, 2007 1:12 am |
Really good question. Reset the variable (on command line :WhoList:#VAR wholist "") then run who command again and repost.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
bair Beginner
Joined: 31 Oct 2006 Posts: 22
|
Posted: Sun Dec 02, 2007 2:21 am |
i did that, did who a bunch of times, and it never updated. it added people when they logged in though.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 02, 2007 2:36 am |
hmm, maybe I'm missing something. Pretty tired right now. If someone else can't nail this down, I'll take another look tomorrow.
PM Me with the MUD connect info and CMUD version you're using and I'll pop on and test it myself :) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Dec 02, 2007 6:36 am |
Hmmm.. it works for me. I had quote my test variable though. CMUD seemed to be thrown off in displaying this variable.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<var name="data">[ ?% ] < 100% > <14088hp 14088m 14088mv> [67 bl] [82736 exp] who
--------------------------------------------------------------------------------
Destroyer Bair is so clean in his black bandana
Rogue Drakul.
Adventurer Mary small demon
Warrior Jack has started a small fire in your Mom's panties!
--------------------------------------------------------------------------------
There are 4 visible players.
There are a total of 4 players connected.
-------------------------------------------------------------------------------- </var>
</cmud>
|
But this is fine
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<var name="data">{
[ ?% ] < 100% > <14088hp 14088m 14088mv> [67 bl] [82736 exp] who
--------------------------------------------------------------------------------
Destroyer Bair is so clean in his black bandana
Rogue Drakul.
Adventurer Mary small demon
Warrior Jack has started a small fire in your Mom's panties!
--------------------------------------------------------------------------------
There are 4 visible players.
There are a total of 4 players connected.
--------------------------------------------------------------------------------
}</var>
</cmud>
|
|
|
_________________ Asati di tempari! |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 02, 2007 2:41 pm |
Ok, because I decided NOT to clear the who list whenever you use who command it is keeping that keyword in there.
Simply clear the @wholist under the WhoList WINDOW (not the one created under the main session window). It captured
a line from your MUD before SnagWho got disabled the first time you ran it.
Something like:
The Sun Rises in the...
Because it just snagged the matching pattern and added it to the variable.
You can fix this to reset the variable every time you do 'who' by doing this:
Code: |
#CLASS WhoCapture
#VAR wholist ""
#TR {Info -> (%w) has left the Vampire Wars.} {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#DELITEM wholist %1;#EXEC updatewho}
#TR {Info -> (%w) has entered the Vampire Wars.} {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#ADDITEM wholist %1;#EXEC updatewho}
#TR {--------------------------------------------------------------------------------} {#T+ SnagWho;:WhoList:#var wholist "";#STATE 1}
#COND {--------------------------------------------------------------------------------} {#T- SnagWho;updatewho;#STATE 2}
#COND {--------------------------------------------------------------------------------} {#STATE 0}
#ALIAS updatewho {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#CLR;:WhoList:#loop %numitems(@wholist) {#SAY %item(@wholist, %i)}}
#CLASS 0
#CLASS {WhoCapture|SnagWho}
#TR {^(%w)(%s)(%w)} {#IF (%window(WhoList) = 0) {#WIN WhoList};:WhoList:#ADDITEM wholist %3}
#CLASS 0
|
Also note, in the one trigger from my original post you need to change Typhon to (%w)
So, delete what you have now and port this in. (I fixed the missing curly bracket too.) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
bair Beginner
Joined: 31 Oct 2006 Posts: 22
|
Posted: Sun Dec 02, 2007 7:13 pm |
works great, thanks.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 02, 2007 9:28 pm |
Welcome. Sorry for the silly mistakes :) Like I said, I was tired grin.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|