Blockland Forums > Modification Help

| and & vs || and &&?

Pages: << < (5/5)

phflack:


--- Quote from: Chrono on March 12, 2012, 02:41:05 PM ---if(player.getDatablock().getName() $= "PlayerTest" && player.addHealth(25) >= 80)
The player will never gain the health if they aren't the PlayerTest datablock.

--- End quote ---
i was thinking of that in java, but i didn't see any functions that would do it in BL, thanks

Ipquarx:


--- Quote from: Kalphiter on March 12, 2012, 03:03:14 PM ---Oh my gosh, even Ipquarx had to correct someone.
--- End quote ---
I don't understand why you think so lowly of me.

Ontopic, here is what the bitwise operators do:

The bit wise operators work on lengths of bits, 1's and 0's.

For example, the & operator looks through each bit from both arguments, and if both are true, sets the corresponding bit in the result to 1. Ex:
1001011010 &
0101001001 =
0001001000

Here are the bitwise operators:
&
^
~
|

Destiny/Zack0Wack0:


--- Quote from: Greek2me on March 11, 2012, 02:55:58 PM ---This is the topic for you: http://forum.blockland.us/index.php?topic=178383.0

--- End quote ---
Just noticed I made a few mistakes in that topic (can't edit them). Most of the 1 << 2 bits should be 1 << 1 and so forth.

Pages: << < (5/5)

Go to full version