Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AbrahamR, 1 invisible), 858 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
What's the meaning of this |=? #319044
04/11/10 19:19
04/11/10 19:19
Joined: Jan 2010
Posts: 15
M
mygame4 Offline OP
Newbie
mygame4  Offline OP
Newbie
M

Joined: Jan 2010
Posts: 15
I have a silly question smile

I found some scripts have |=
For example, p.flags |= (BRIGHT | MOVE);
or p.flags |= MOVE;
I don't know what's the meaning of |=

Re: What's the meaning of this |=? [Re: mygame4] #319045
04/11/10 19:24
04/11/10 19:24
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz

Re: What's the meaning of this |=? [Re: Widi] #319070
04/12/10 00:45
04/12/10 00:45
Joined: Jan 2010
Posts: 15
M
mygame4 Offline OP
Newbie
mygame4  Offline OP
Newbie
M

Joined: Jan 2010
Posts: 15
Thanks, but I can hardly understand what it is for.

Re: What's the meaning of this |=? [Re: mygame4] #319078
04/12/10 05:21
04/12/10 05:21
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Well this | is a so called "bitwise" or.
If you have a binary number like 0110 and another binary number like 0100 you can use the OR to connect them and "calculate" a resulting number.
In this case:
0110 | 0100 = 0110
What you do:
You look at each "position" in both number strings and if one of them 1 you write a 1 to the result:
0 | 0 = 0
0 | 1 = 1
1 | 1 = 1
0 | 0 = 0
result = 0110

The |= operatator does the same but also includes an assignment to another variable.
a |= b
is the same as:
a = a | b

Hope this makes some sense to you.

Re: What's the meaning of this |=? [Re: Xarthor] #319087
04/12/10 09:20
04/12/10 09:20
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
The flags in 3dgs (SHOW, POLLYGON and so on) are all saved in one Bit. With this Operator (|=) you can set only the bit you need. (SHOW is set now).

Re: What's the meaning of this |=? [Re: mygame4] #319189
04/12/10 20:23
04/12/10 20:23
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
In Lite-C there is an operator to make decision about equality.
In this language, as like as all "C" like languages, this operator is the "==".
Sometime in programming we need to examine the reversed equality for this purpose is being the "|=".
So just imagine
  • 1. == equal
  • 2. |= not equal
  • 3. >= greater than
  • 4. <= less than

and so on...

Re: What's the meaning of this |=? [Re: Aku_Aku] #319193
04/12/10 20:30
04/12/10 20:30
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
^ That's wrong, != is the not equal comparison, not |=.

Re: What's the meaning of this |=? [Re: DJBMASTER] #319271
04/13/10 16:55
04/13/10 16:55
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
Budapest
True, that is my fault. I am sorry.

Re: What's the meaning of this |=? [Re: Aku_Aku] #319275
04/13/10 18:05
04/13/10 18:05
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Now is:
Aku_Aku == true; wink wink

Re: What's the meaning of this |=? [Re: Widi] #319399
04/14/10 18:24
04/14/10 18:24
Joined: Jun 2009
Posts: 258
behind this enternet window
zeusk Offline
Member
zeusk  Offline
Member

Joined: Jun 2009
Posts: 258
behind this enternet window
Originally Posted By: Widi
Now is:
Aku_Aku == true; wink wink


Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1