453 posts
Location
Holland
Posted 07 August 2012 - 03:41 PM
look, i dont really get this logic stuff:
printCentred( math.floor(h/2) + 0, ((nDifficulty == 1) and "[ EASY ]") or "EASY" )
ok i have 2 questions :P/>/>
1. how does this work
2. how to write this stuff
thx in advance
wilcomega
864 posts
Location
Sometime.
Posted 07 August 2012 - 05:39 PM
Well for starters, where is the actual printCentered function?
It makes more sense if you could tell us or something…
3790 posts
Location
Lincoln, Nebraska
Posted 07 August 2012 - 05:52 PM
If you are talking about how the math works, then look here:
Math LibraryIf you are trying to learn how to make interactive menus, I suggest you look here:
A Quick Guide Through Menu Making
1604 posts
Posted 07 August 2012 - 08:14 PM
printCentred( math.floor(h/2) + 0, ((nDifficulty == 1) and "[ EASY ]") or "EASY" )
printCentred(): function call.
math.floor(h / 2) + 0: divide h by 2, floor the result and add 0.
Now the "hard" part:
((nDifficulty == 1) and "[ EASY ]") or "EASY"
This is like using an if statement. If nDifficulty equals 1, then return "[ EASY "], else return "EASY".
839 posts
Location
England
Posted 08 August 2012 - 04:29 AM
Printcentred isn't a built in function. I take it you copied this code from someone else's project and want to use it to your own devices but know next to nothing about programming?