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-15-2006, 06:41 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Strange operators

Explain these to me! Please.
NPC Code:
Bitwise-Or                a | b
Bitwise-And a & b
Bitwise-Shift left a << b
Bitwise-Shift right a >> b
Bitwise-Invert ~a
Bitwise-Xor a xor b (operator ^ already used for power)
Bitwise-Or Assignment a |= b
Bitwise-And Assignment a &= b
Shift Left Assignment a <<= b
Shift Right Assignment a >>= b



Also, why do people use := sometimes, instead of =?
Reply With Quote
  #2  
Old 01-15-2006, 07:32 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
They aren't strange. Honestly, there is a big internet out there and some pages actually exist to explain such things. And, there are even tools which make locating these pages quick and easy. Imagine that!
Reply With Quote
  #3  
Old 01-15-2006, 08:10 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
>_> I tried that. I couldn't find much on what they do, just big formulas.. That were really confusing.
Reply With Quote
  #4  
Old 01-15-2006, 09:23 AM
Chicken_l33t Chicken_l33t is offline
Banned
Join Date: Sep 2002
Location: NewZealand
Posts: 467
Chicken_l33t is on a distinguished road
http://en.wikibooks.org/wiki/Program...harp/Operators

Here's some I found in C#, i'm sure they will have the same principles in GS2.


Quote:
Also, why do people use := sometimes, instead of =?
I'm not 100% sure on this one, but I believe it's to do thinks like..

From this: a = a + 1
to this: a := +1

Something like that, as I said i'm not sure, and I havent actually tryed because I just use a = a + 1 :P

Last edited by Chicken_l33t; 01-15-2006 at 09:36 AM..
Reply With Quote
  #5  
Old 01-15-2006, 09:46 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
No, := is the same thing as =. In Delphi, assignment is done with :=.

As for the bit operators, they adjust the bits in a number.

A google of 'bitwise operators' produces plenty of pages explaining them.

Such as : http://download.cdsoft.co.uk/tutorials/bitops/
Reply With Quote
  #6  
Old 01-15-2006, 08:01 PM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
i haven't seen := used as an assignment operator since I took classes in Pascal. Good memories. C++ and Gscript are better tho.
Reply With Quote
  #7  
Old 01-15-2006, 10:40 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by Prozac
i haven't seen := used as an assignment operator since I took classes in Pascal. Good memories. C++ and Gscript are better tho.
:= is valid in GScript2.
Reply With Quote
  #8  
Old 01-16-2006, 06:26 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally Posted by Yen
Explain these to me! Please.
NPC Code:
Bitwise-Or                a | b
Bitwise-And a & b
Bitwise-Shift left a << b
Bitwise-Shift right a >> b
Bitwise-Invert ~a
Bitwise-Xor a xor b (operator ^ already used for power)
Bitwise-Or Assignment a |= b
Bitwise-And Assignment a &= b
Shift Left Assignment a <<= b
Shift Right Assignment a >>= b



Also, why do people use := sometimes, instead of =?
Maybe this will help

Bitwise Operators (GameDev)
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #9  
Old 01-16-2006, 03:20 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Yen
Also, why do people use := sometimes, instead of =?
It's the same thing as =, unfortunately.

It would be nice if this operator was given unique functionality as a "delayed assignment operator," meaning not to assign the value until the next time it's modified (kindof like preincrement, but more in a sense of preassignment). Considering it's definition in the language is already defined, though.. doubt it will change. The question of modify it to behave this way would be, would you want to save the value that it would be assigned as it is called, or delay the execution until the assigned operator is modified.
Reply With Quote
  #10  
Old 01-16-2006, 03:42 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by jake13jake
It's the same thing as =, unfortunately.

It would be nice if this operator was given unique functionality as a "delayed assignment operator," meaning not to assign the value until the next time it's modified (kindof like preincrement, but more in a sense of preassignment). Considering it's definition in the language is already defined, though.. doubt it will change. The question of modify it to behave this way would be, would you want to save the value that it would be assigned as it is called, or delay the execution until the assigned operator is modified.
Of course, because you know.. there aren't scripts writtin using := that would completely screw up if they changed what the operator does.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #11  
Old 01-16-2006, 09:45 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by ApothiX
Of course, because you know.. there aren't scripts writtin using := that would completely screw up if they changed what the operator does.
That's quite exactly what I'm saying. Don't think you needed to reiterate.
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 10:06 PM.


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