 |
Meznev Newbie
Joined: 22 Sep 2005 Posts: 6
|
Posted: Thu Sep 29, 2005 3:53 am
Nested #If blocks, possible comparison bug? |
I seem to be having a problem with nested if statements. I basically want to do something like this:
Code: |
#loopdb @db {
#if (%val > 90) {
#show Hey, its bigger than 90!
} {
#if (%val > 50) {
#show Hey, its bigger than 50!
} {
#if (%val > 10) {
#show Hey, its bigger than 10!
}
}
}
}
|
Although what'll end up being output is something like this, to the mud (times the amount of elements in the var):
{#show Hey, its bigger than 90!}{#if (25 >= 50) {#show Hey, its bigger than 50!}{#if (25 > 10) {#show Hey, its bigger than 10!}}}
Also, I can't for the life of me get the expresions to work on different-length digits properly, take this for example:
Code: |
@tempvar = 100
#if (@tempvar > 25) { #show @tempvar is bigger than 25! } { #show @tempvar is smaller than 25! }
|
For me, that will ALWAYS be false. Even if I changed it so it read as:
#if (100 > 25) ....
Unless, I do this:
#if (100 > "025") ...
Then it actually works. I've tried 100 > XX, XX < 100, 100 < XX, XX < 100, it always ends up the same.
Just did some quick testing while writing this. And in fact, the ONLY way I can get a 3-digit number to be greater than a 2-digit number is if the first two digits of the number are greater than the two digit number being compared to, ie:
#if (500 > 25) ...
True
#if (155 > 25) ...
False
#if (500 < 25) ...
False
#if (155 < 25) ...
True
I'm not sure if anyone can honestly help me with the second. It seems to be a bug in zmud if its true. Can someone else try and confirm? I'm using 7.20a, will try with 7.21. Although there's no mention of it in the release notes |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Thu Sep 29, 2005 8:22 am |
You nested if-else block is missing spaces between the true and false portions on the text you say is being sent to the mud.
{#show Hey, its bigger than 90!}{#if (25 >= 50) {#show Hey, its bigger than 50!}{#if (25 > 10) {#show Hey, its bigger than 10!}}}
I have no problems with numbers evaluating properly as numeric comparisons in #IF statements. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
|
|
|
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
|
|