Page 1 of 1

How to ?

PostPosted: Sun May 29, 2016 15:29
by azekill_DIABLO
I have a problem : i don't know how to verify a Value like A

I have A which can be 1, 2 or 3

and i do
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
 if (A==1) then

but doesn't seem to work

Re: How to do a value between 1 or 3 on world creation???

PostPosted: Sun May 29, 2016 15:36
by rubenwardy
math.random(1,3)

Not sure if that includes 1 and 3.
If you want whole numbers:

math.floor(math.random(1,3) + 0.5)

EDIT: you changed your question. A==1 will work if a is 1. Use print(dump(A)) to find out its true value.
If it's something like "1" then use tonumber(A)==1
If it's something like 1.02 then you can round it to check whether the closest whole number is 1: math.floor(A + 0.5) == 1

note that math.floor always rounds down, which is why you need to +0.5.
round(A) == floor(A + 0.5)

http://lua-users.org/wiki/MathLibraryTutorial

Re: How to ?

PostPosted: Sun May 29, 2016 16:01
by azekill_DIABLO
thx :)

Re: How to ?

PostPosted: Mon May 30, 2016 11:21
by azekill_DIABLO
how can i modify the player model?? in 4.13 i done this many times but in.14 does not seem to work..;is there another fie than player.lua ??