Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   xor and class? (https://forums.graalonline.com/forums/showthread.php?t=134267821)

Jiroxys7 01-30-2013 11:05 PM

xor and class?
 
I've been wondering what these do. When you type them into the compiler, they turn red like "if" and "function" do. How are they used on graal? And is there really any situation in which you would use these over alternative code?

Crow 01-30-2013 11:25 PM

xor, usually the ^ operator in other languages, is bitwise exclusive or. Compares the two inputs bit by bit, bit output is 1 if one bit is 1 and the other is 0, otherwise 0.

For example: 3 xor 5 == 6
Because:
3 == 011
5 == 101
6 == 110


Not sure if the class keyword is actually being used.

scriptless 02-01-2013 05:45 PM

Doesn't Graal have other logic gates? (NOT, AND, OR, NOR, XOR, XNOR, ...).

http://en.wikipedia.org/wiki/NAND_lo...ing_NAND_gates

Jiroxys7 02-01-2013 06:42 PM

Quote:

Originally Posted by scriptless (Post 1713008)
Doesn't Graal have other logic gates? (NOT, AND, OR, NOR, XOR, XNOR, ...).

http://en.wikipedia.org/wiki/NAND_lo...ing_NAND_gates

I think I recall trying other logic gates, but they didn't come up with red letters. So I'm guessing not. :p

Crow 02-01-2013 07:04 PM

& is bitwise and, | is bitwise or. GS2 also offers >> and << for right/left shift (respectively, duh). Not sure about others. It's possible that ! also works as bitwise negation, give it a try.

DustyPorViva 02-01-2013 07:29 PM

http://wiki.graal.net/index.php/Crea...uide#Operators

scriptless 02-01-2013 08:31 PM

Quote:

Originally Posted by DustyPorViva (Post 1713016)

Could have sworn I tried a %= b; one upon a time. Don't remember if it ever worked. I thought I was told it wouldn't :(


All times are GMT +2. The time now is 01:20 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.