|
Fergal1982 Wanderer
Joined: 08 Aug 2005 Posts: 70
|
Posted: Sun May 21, 2006 8:38 pm
conditional colouring |
hi. im trying to make a trigger that auto-colours the input text on certain conditions.
the input text is
Quote: |
You currently have 3 knowledge crystals and 0 power crystals to use. |
where the 3 and the 0 can be any number.
if set the trigger as
Code: |
You currently have %1 knowledge crystals and %2 power crystals to use. |
and am using an if statement similar to
Code: |
#if (%1/3 >1) {#col {green}} |
but it doesnt work - i want it to colour if the number divided by three is greater than 1 and a whole number.
can anyone help?
thanks
fergal |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Sun May 21, 2006 9:35 pm |
use %d in the pattern not %1
#TR {You currently have %d knowledge crystals and %d power crystals to use.} {#IF (%1/3 >1) {#CO green}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Fergal1982 Wanderer
Joined: 08 Aug 2005 Posts: 70
|
Posted: Sun May 21, 2006 10:10 pm |
it still doesnt appear to be working correctly for some reason. its possible that its something to do with the formula itself ( %1/3 > 1) as if i fiddle around with it it apears to start working somewhat, although it seems rather sporadic and not following any logic i can see
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sun May 21, 2006 11:34 pm |
Try forcing an evaluation of the formula using (%eval(%1/3) > 1)
|
|
_________________ Taz :) |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon May 22, 2006 12:26 am |
Problem is that you have to put variables you want to use later inside parenthesis.
#TR {You currently have (%d) knowledge crystals and (%d) power crystals to use.} {#IF (%1/3 >1) {#CO green}} |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Mon May 22, 2006 2:28 am |
Why not just use #SUB?
i.e. If knowledge crystals are div by 3 then it is green if power crystals are then its blue. You can obviously expand on it. This is just a simple version. #SUB works just as well i used a very generic version of it. You can actually have it color word for word too.
Code: |
#TRIGGER {You currently have (%d) knowledge crystals and (%d) power crystals to use.} {#IF (%1/3 >1) {#SUB %ansi(green,bold)%line} {#IF (%2/3 >1) {#SUB %ansi(blue,bold)%line}{#NOOP}}
|
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Mon May 22, 2006 2:40 am |
Nice catch Guinn I hadn't noticed the lack of the round brackets to capture the values.
|
|
_________________ Taz :) |
|
|
|
|
|