Author Topic: My script isn't doing what i want it too  (Read 1951 times)

Oh, I develop add-ons when not compressed. Thanks Port.

It shows something cool yeah, but that logic will always return true

Not if one were to change the value of the gun's projectile, which is what he's trying to do.

Not if one were to change the value of the gun's projectile, which is what he's trying to do.
Yeah that part will work fine
But then he's comparing the value of gunimage.projectile to itself
Which will always return true because a variable is always equal to itself

IIRC, the first half of a comparison is unaffected by variable changes which take place in the second half.
So it's not [the value of the Gun's projectile], it's more like [the Gun's projectile as stored in memory].

When evaluating the expression %a == (%a = 7),

  • Search for parenthesis, find (%a = 7).
  • Evaluate the expression within (%a is now 7) and assign the value of %a (7) to the parenthesis section.
  • Now being finished with parenthesis, find ##%a## == and assign the value of %a (7, as set before) to that variable reference.

The expression is now 7 == 7. It will always return true.