How to ?

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

How to ?

by azekill_DIABLO » Sun May 29, 2016 15:29

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
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

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

by rubenwardy » Sun May 29, 2016 15:36

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
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: How to ?

by azekill_DIABLO » Sun May 29, 2016 16:01

thx :)
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: How to ?

by azekill_DIABLO » Mon May 30, 2016 11:21

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 ??
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron