|
Jezuit Beginner
Joined: 02 Nov 2002 Posts: 27 Location: USA
|
Posted: Wed Nov 26, 2003 10:23 am
Checking for no value in a queue |
What I'm trying to do is check to see if a variable is empty. It is basically a list, so it'll delete each item as it does it, so then I need to see if it is empty. I've tried, using if statements, using (@queue == "") and (%null(@queue)), and for some reason they've never worked. Yet, when I reset the variable to "#VAR queue {}", the script works...
The alias I'm using scans the queue to see if anything's there before it does the next thing... Well, it won't do the next thing if it thinks there's something there, yet, when I look, it's empty, I'm just not trying to find an empty value correctly. Any thoughts?? |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Wed Nov 26, 2003 10:39 am |
#if @name="" {yes} {no}
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Nov 26, 2003 4:36 pm |
"It is basically a list"
A list is a particular type of zMUD variable. Is it a list or isn't it?
What command do you use to "delete each item"?
I had no problems.
#VAR queue {Item 1|Item2|Third Item}
#AL test1 {#IF (@queue=="") {#SAY test1 = empty} {#SAY test1 = not empty}}
#AL test2 {#IF (%null(@queue)) {#SAY test2 = empty} {#SAY test2 = not empty}}
#AL test3 {#IF (%numitems( @queue) = 0) {#SAY test3 = empty} {#SAY test3 = not empty}}
#DELNITEM queue 1;test1;test2;test3
As expected, all three tests report "not empty" the first two times and "empty" on the third #DELN.
#VAR queue {Item 1|Item2|Third Item}
#DELI queue {%item( @queue, 1)};test1;test2;test3
Same results, not empty on first two deletions and empty on third.
#VAR queue {Item 1|Item2|Third Item}
#VAR queue {%delitem( %item( @queue, 1), @queue)};test1;test2;test3
And the same results again.
You see, no matter what I try I get the expected results. So, without knowing what commands you use, it's impossible to help you. |
|
|
|
Talmark Novice
Joined: 22 Nov 2003 Posts: 34
|
Posted: Wed Nov 26, 2003 11:49 pm |
You could also do a simple:
#IF {@queue} {#SH not empty} {#SH empty} |
|
|
|
|
|
|
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
|
|