|
zex0s Wanderer
Joined: 29 Jun 2003 Posts: 64
|
Posted: Mon Jul 28, 2003 1:11 pm
Possible way to do this? |
I want to embed some MXP triggers into some auction bidding.. so far, so good.. now comes to fun part..
I want to condense the trigger some, and user-defined functions *seem* to be the way to go.. so here is the question.
lets say I do @minbid(500), (where 500 is the current bid)
now, if it's less than 5000, I want @minbid to return 500+100, or 600, however, if it's between 5001 and 50000, I want it to return the bid+1000, etc.. so I can modify the function if I want, without having to modify it in 3 or 4 different places (because the auction text changes, depending on the state of the auction)
For now, I've just put #IF statements in each trigger, but thats a kludgy way of doing it, when I am pretty sure it's possible to remove the #IF and just use a user-defined function.
But, the helpfile is quite sparse on how to actually USE a user-defined function.
Thnx
zex0s |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Jul 28, 2003 3:19 pm |
User-defined functions don't eliminate the #IF statements, they just move them to the function where they become %if. Unless you can figure out an actual formula, the only choice is to define ranges.
#FUN minbid %if( %1 < 5000, %eval( %1 + 100), %if( %1 < 50000, %eval( %1 + 1000), too much)) |
|
|
|
|
|
|
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
|
|