Elseif not working?

hi i have on crank:
health2 -= varies

	if test2==false then
		varies = 90;
	elseif test2==true then
		varies = 0.5;

meaning when crankin' dependin' on if variable test2 is false or true it changes the health2.. i seem to only get one varies value showing, does elseif or else matter to do this or would two ifs work? Im confusin myself!!

There is no such thing as true and false in pulpscript! What your code is actually doing is comparing the variable test2 with two other variables called true and false, and any uninitiated variable in pulpscript defaults to 0!

You probably want to use 1 and 0 to mean true and false instead :slight_smile:

ahhh ok! im still getting only one result but i changed it to 0 and 1 thanks...
do i need an end after the if?
boxer2block = 1;
health2 -= varies

if test2==1 then
	boxer2block = 90;
	say "one"
elseif test2==0 then
	boxer2block = 0.5;
	say "two"


Where are you setting the value of test2? What is changing it?

You don't need another end after if, it should be if... elseif... end as you have it :slight_smile:

nothing is changin the value yet, im manually changing it to test it. I tried value in room and on crank so far....

works! on a loop with a
varname = random 0,1
so constantly updates random #! boxer2block =varname thanks!!

1 Like