Could someone please explain me how to exactly use that?
resting ? chakra.value+=chakra.max_value/rand(33,666) : chakra.value+=chakra.max_value/rand(99,3333)
Above is being used in a mob/proc, so I didn't used src, I'm lazeh.
Regards,
Rick
ID:161323
![]() May 21 2008, 7:12 am
|
|
Expr ? TrueExpr : FalseExp
Could someone please explain me how to exactly use that? resting ? chakra.value+=chakra.max_value/rand(33,666) : chakra.value+=chakra.max_value/rand(99,3333) Above is being used in a mob/proc, so I didn't used src, I'm lazeh. Regards, Rick |
![]() May 21 2008, 8:12 am
|
|
That would work in another language, but BYOND is very strict about where you can put equality operators. So, you need to change it like so:
chakra.value += chakra.max_value / ( resting ? rand(33,666) : rand(99,3333) ) |
Ifs and elses are a more readable way of using the ? operator. I use the ? operator sometimes, but not most of the time.
|