|
Loto Apprentice
Joined: 05 May 2003 Posts: 194
|
Posted: Sun Oct 10, 2004 9:21 pm
Clearing and displaying a variable. |
Currently I have this script to look at receipts for equipment. On my MUD, when your equipment gets damaged, you give it to a weaponsmith or an armorsmith to repair it. Sometimes there are MASSIVE amounts of receipts in clan chests. This is a script to look through them, but there are some things I'm having trouble doing. I looked through the helpfiles for Variable and couldn't find what I am looking for.
#CLASS {Receipts}
#ALIAS receipts {
#VAr rnum %1
#SAY You have %1 receipts to check.
}
#ALIAS start {
#Loop @rnum {
get receipt @cont
exa receipt
put receipt @endcont
}
}
#ALIAS cont {
#VAR cont %1
#SAY Receipts are coming from %1.
}
#ALIAS endcont {
#VAR endcont %1
#SAY Receipts will go into %1.
}
#TRIGGER {It is a receipt for (*) from *, already redeemable.} {#ADDITEM rlist %-1}
#CLASS 0
I need to make an alias that displays the contents of the variable in a neat fashion and then clears it, so it is empty for next time, but I do not know how to do this. I know how to display it with #SHOW, but it doesn't look neat. This is what another variable looks like with #SHOW:
Tarill|Bootsy|Muhaer|Logain
And I do not want it to look like that. I want it to look something like this:
There is a receipt for xxxx.
There is a receipt for xxxx.
There is a receipt for xxxx.
There is a receipt for xxxx.
There is a receipt for xxxx.
For however many things there are in the variable rlist, and clear it afterwards.
EDIT: Sorry, I didn't know it would do that. I assumed it would wrap it like it does with normal text. I suppose that's from it not having spaces. |
|
_________________ *Llewlyn* makes a strange sound but is suddenly very silent as you place a silver sai in his back!
Last edited by Loto on Mon Oct 11, 2004 4:00 am; edited 1 time in total |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Oct 11, 2004 1:02 am |
Please edit your post. We don't need to see all 218 names in your list and it would be much easier to read if the topic was significantly reduced from its current width of over 1400 characters. Three or four names would probably be enough.
|
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Oct 11, 2004 3:39 pm |
Thanks. Yes, it was the lack of spaces that caused the problem. The forum word-wrapper treats | the same as a letter.
List displays are easily formatted using #FORALL. They can also be formatted using %expandlist, which avoids creating a loop but is a bit harder to understand. Clearing the variable just requires setting it to a null value after the end of the display.
#AL rshow1 {#FORALL @rlist {#SAY There is a receipt for %i};#VAR rlist {}}
#AL rshow2 {#SAY There is a receipt for %expandlist( @rlist, %{cr}There is a receipt for%char( 32));#VAR rlist {}} |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
|
|