Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: JSRNerdo on July 22, 2016, 07:38:09 pm
-
Hello. I'm trying to divide a variable by 50, then feed that into a modify-variable, to make that the value of another variable. However, when I do this, it always returns -3 for some reason. I'm not sure what's going on or why maths doesn't work. To be honest, even using maths is pretty much a hack for fire-beam burst fire beams, but hey, that's fredding.
Anyway, the relevant sexp test:
( modify-variable
@LeftBeamTick[0]
( / ( - @BeamLeftStatus[200] 150 ) 50 )
)
BeamLeftStatus always has to be above 200 for this event to fire, so that shouldn't be the problem. I've also tested without the subtraction, still returns -3.
Any ideas?
-
FRED only thinks in integers, could that be the problem?
-
What does the event log output?
Also, try putting in P=NP. A Nobel prize awaits. :p
-
Oh.
I'm an idiot.
Found the problem, I had modified the variable BeamLeftStatus to 0 BEFORE dividing, not after. After swapping the orders of the sexps, it works as intended.
-
Found the problem, I had modified the variable BeamLeftStatus to 0 BEFORE dividing, not after. After swapping the orders of the sexps, it works as intended.
...:wtf: But...
I've also tested without the subtraction, still returns -3.
:confused:
-
Found the problem, I had modified the variable BeamLeftStatus to 0 BEFORE dividing, not after. After swapping the orders of the sexps, it works as intended.
...:wtf: But...
I've also tested without the subtraction, still returns -3.
:confused:
He was going for ( 200 - 150 ) / 50 = 3 due to the error he had ( 0 - 150 ) / 50 = -3
as for the without substaction part I am as puzzled as you are... (I am also quite tired and may or may not have access to my full visual field at the moment...)