|
BDan Newbie
Joined: 20 Apr 2007 Posts: 1
|
Posted: Fri Apr 20, 2007 11:52 pm
[Range] |
I tried my best to figure this out without a post, but I could not.
In any case, I was reading over other examples of the use of [Range] and I was wondering if it works with numbers as a value.
Currently, I'm trying to get a storage to Identify an item, take its level, and put it in a corresponding container. At first, I had it capture
and #IF to a (%1 <15) and so on, about for times for different values and it would put them in the correct container, but I'd get spam if
the item was put up and the trigger continued to try the rest of the IF checks an item fit. I was wondering, if you guys could give me any insight on how to better formulate this script. I'll show it to you for reference. (This is with Ranges, which doesn't work.)
Quote: |
Trigger Line: It is a level (%d)
Trigger Content:
#if (%1 = "[4-15]") {put @item laun}
#if (%1 = "[40-49]") {put @item ruck}
#if (%1 = "[26-39]") {put @item purp}
#if (%1 = "[15-25]") {put @item urn};get @item;c id @item |
Any thanks would be appreciated and I'm very sorry if this is an FAQ I passed over. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Apr 21, 2007 3:16 am |
[range] is only for trigger patterns, and only allows you to capture an unbroken sequence of those characters:
a-z = any lowercase letter
A-Z = any uppercase letter
0-9 = any number
In effect, [0-9] is just a longer way to write %d.
In ZMud, there's no good way to do the testing of ranges. Your only option is the #IF command/%if() function that separately tests for both boundaries:
#if ((%1 >= 4) AND (%1 <= 15)) {}
As you might suspect, boundaries that overlap (4-15, 15-25) will usually break the logic of your code. You'll need to remove the overlap, place it in it's own #IF, and come up with something else to check that reveals what to do with the item. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|
|
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
|
|