Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-30-2013, 11:05 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
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?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 01-30-2013, 11:25 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
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.
__________________
Reply With Quote
  #3  
Old 02-01-2013, 05:45 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Doesn't Graal have other logic gates? (NOT, AND, OR, NOR, XOR, XNOR, ...).

http://en.wikipedia.org/wiki/NAND_lo...ing_NAND_gates
Reply With Quote
  #4  
Old 02-01-2013, 06:42 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by scriptless View Post
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.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #5  
Old 02-01-2013, 07:04 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
& 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.
__________________
Reply With Quote
  #6  
Old 02-01-2013, 07:29 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
http://wiki.graal.net/index.php/Crea...uide#Operators
Reply With Quote
  #7  
Old 02-01-2013, 08:31 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by DustyPorViva View Post
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:06 PM.


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