Author Topic: Error formula : assign function doesnt work ?  (Read 1055 times)

Pizzicat

  • Newbie
  • *
  • Posts: 1
    • View Profile
Error formula : assign function doesnt work ?
« on: February 19, 2008, 04:28:34 AM »
hi
i would simplify my formula with assign function, but it doesnt work.
my good formula :

if(n > 25, n*bc*switch(r, 1, .2, 2, .18, 3, .14, 4, .12, 5, .1, 6, .08, 7, .07, 8, .06, 9, .05, 0) + (100*pow(((n*10)/100)/r,0.125)/1),n*bc*switch(r, 1, .2, 2, .18, 3, .14, 4, .12, 0) + (100*pow(((n*10)/100)/r,0.125)/1))

it work good

and with assign function :

assign("bonus",n*bc)
assign("ptbase",(100*pow(((n*10)/100)/r,0.125)/1))
if(n > 25, bonus*assign("pourcent",switch(r, 1, .2, 2, .18, 3, .14, 4, .12, 5, .1, 6, .08, 7, .07, 8, .06, 9, .05, 0)) + ptbase,bonus*assign("pourcent",switch(r, 1, .2, 2, .18, 3, .14, 4, .12, 0)) + ptbase)

is it good ?

i have this message into the test point area

thx


Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6216
    • View Profile
Re: Error formula : assign function doesnt work ?
« Reply #1 on: February 19, 2008, 10:10:55 AM »
2.4.3 has a bug in the formula *dialog* that causes it to display an error when you use assign().  The real problem is that it attempts to validate each variable that you use, to help prevent you from mis-typing one of the provided variables (like buyinCost, or rank, etc).  This is supposed to help prevent you from making mistakes and spending time trying to figure out what is wrong with your formula, rather than you spending time tweaking your formula to get it just the way you want it.

Unfortunately, because "assign()" allows you to create new variables, it does not take this into account, and it mistakingly reports an error in your formula.  HOWEVER, your formula will still work.  This is an error in the dialog only.  An annoying one, yes, but it does work.  I tested your formula, it works.  Just ignore the fact that the Points for Playing dialog tells you the formula has an error.