Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,359 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Question about Entity flags #323108
05/11/10 17:26
05/11/10 17:26
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
I was hoping to understand the difference between using the following approaches in showing/hiding and Entity


Approach #1
Click to reveal..

if (CamMode == ThirdPersonCamera)
{
Badrizmo.flags2 |=VISIBLE;
}
else
{
Badrizmo.flags2 &= ~VISIBLE; // Fails to hide the player
}


Approach #2
Click to reveal..
if (CamMode == ThirdPersonCamera)
{
set(Badrizmo,VISIBLE);// Fails to show the player}
else
{
set(Badrizmo,INVISIBLE);
}

Thanks in advance

Re: Question about Entity flags [Re: Badrizmo] #323111
05/11/10 17:42
05/11/10 17:42
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
It is the same. The second one is a "#define macro"

#define set(obj,flag) obj.flags |= (flag)
#define reset(obj,flag) obj.flags &= ~(flag)

search for define in the manual

PS: set(Badrizmo,INVISIBLE); is false, use: reset(Badrizmo,VISIBLE);
INVISIBLE is another flag...

Last edited by Widi; 05/11/10 17:42.
Re: Question about Entity flags [Re: Badrizmo] #323112
05/11/10 17:43
05/11/10 17:43
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Approach #3:
Set the SHOW flag for view entities (flags2) or panels (set(panel,SHOW))
and set the INVISIBLE flag for (normal) level entities to show and reset(entity,INVISIBLE) to hide.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Question about Entity flags [Re: Widi] #323281
05/12/10 21:11
05/12/10 21:11
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
Okay, I wrote this simple (but complete) test code. but to my shock the entity was never hidden. I just want to know what did I do wrong. I'm sure I have assigned my action to a model because when I press F7 the model is moved by 20 quants as you will see later in code.



Click to reveal..

#include <acknex.h>
#include <default.c>

ENTITY* Badrizmo;


var ShowHideFlag = 0;
function ShowHideBadrizmo ()
{
if (ShowHideFlag == 0)
{
//Hide the entity
Badrizmo.flags &=~VISIBLE;

Badrizmo.x +=20;
ShowHideFlag = 1;
}
else
{
//Show the entity
Badrizmo.flags |= VISIBLE;
ShowHideFlag = 0;
}

}




function main()
{
level_load("shop.wmb");
wait (2);
on_f7 = ShowHideBadrizmo;
}

action move()
{
Badrizmo = me;

while (1)
{
if(key_w)
{
c_move(me,vector(5*time_step,0,0),nullvector, GLIDE);
}
if(key_s)
{
c_move(me,vector(5* -time_step,0,0),nullvector, GLIDE);
}
if(key_a)
{
me.pan +=4*time_step;
}
if(key_d)
{
me.pan -=4*time_step;
}
wait(1);
}
}


when I replaced
Badrizmo.flags &=~VISIBLE;
by
Badrizmo.flags &=~INVISIBLE;

and
Badrizmo.flags |= VISIBLE;
by
Badrizmo.flags |= INVISIBLE;

it worked fine and I was toggoleing between hidden and visible by F7, I need to know why did the original code didn't work (the one utilizing the VISIBLE flag).

Thanks in advance for your valuable help.

Re: Question about Entity flags [Re: Badrizmo] #323286
05/12/10 21:38
05/12/10 21:38
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
There is no VISIBLE flag anymore for entities, this is old C-Script code. Use the INVISIBLE flag.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Question about Entity flags [Re: Superku] #323324
05/13/10 07:35
05/13/10 07:35
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
Thanks a lot for the explanation,

Re: Question about Entity flags [Re: Badrizmo] #323330
05/13/10 09:15
05/13/10 09:15
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
and you dont need the var ShowHideFlag:
if (ShowHideFlag == 0)
replace with:
if(Badrizmo.flags & (INVISIBLE))

and with:
Badrizmo.flags ^= (INVISIBLE)
you can toggle between Visible and Invisible


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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