Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TedMar, dr_panther), 1,049 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
The concept of 'player' confuses me ?? #249616
02/03/09 15:08
02/03/09 15:08
Joined: Apr 2008
Posts: 437
dracula Offline OP
Senior Member
dracula  Offline OP
Senior Member

Joined: Apr 2008
Posts: 437
I understand me (my). This is similar to 'this' in C++ and ActionScript. What is 'player' ?

(please don't refer me to the manual, I wouldn't ask if it was clear)

Thanks

Re: The concept of 'player' confuses me ?? [Re: dracula] #249618
02/03/09 15:12
02/03/09 15:12
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
player is just a global entity pointer.


3333333333
Re: The concept of 'player' confuses me ?? [Re: dracula] #249619
02/03/09 15:17
02/03/09 15:17
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
To the best of my knowledge, the "player" pointer as an engine defines pointer
for use (exclusively?) with the templates and some default.c functions.
Its equivalent is simply a global declare like
Code:
ENTITY* player;

Other than that, it doesnt really DO anything, or be affected by anything.

I try to avoid using it in lite-c, because it "feels" like an old legacy
pointer...

But I will still welcome other peoples opinions.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: The concept of 'player' confuses me ?? [Re: EvilSOB] #249622
02/03/09 15:25
02/03/09 15:25
Joined: Oct 2008
Posts: 218
Nashua NH
heinekenbottle Offline
Member
heinekenbottle  Offline
Member

Joined: Oct 2008
Posts: 218
Nashua NH
Originally Posted By: EvilSOB
To the best of my knowledge, the "player" pointer as an engine defines pointer
for use (exclusively?) with the templates and some default.c functions.
Its equivalent is simply a global declare like
Code:
ENTITY* player;

Other than that, it doesnt really DO anything, or be affected by anything.

I try to avoid using it in lite-c, because it "feels" like an old legacy
pointer...

But I will still welcome other peoples opinions.


There is nothing wrong with using "player".

Just use "player = my;" in the action of whatever entity you chose and it'll work fine as a pointer.

So it is not just exclusive with the templates and default.c, it can be used like any other pointer.


I was once Anonymous_Alcoholic.

Code Breakpoint;
Re: The concept of 'player' confuses me ?? [Re: heinekenbottle] #249623
02/03/09 15:29
02/03/09 15:29
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
XD.. as the name sais.. i use it as PLAYER pointer..

So the Script knows my hero as "player" ^^

But there´s no difference when you call the pointer "hero", or "Shit-what-a-long-pointer"


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: The concept of 'player' confuses me ?? [Re: Espér] #249632
02/03/09 15:53
02/03/09 15:53
Joined: Apr 2008
Posts: 437
dracula Offline OP
Senior Member
dracula  Offline OP
Senior Member

Joined: Apr 2008
Posts: 437
Thanks, I am going to study this for a while

drac.

Re: The concept of 'player' confuses me ?? [Re: dracula] #249737
02/03/09 22:49
02/03/09 22:49
Joined: Sep 2005
Posts: 75
CA, Orange County
Gerrit Offline
Junior Member
Gerrit  Offline
Junior Member

Joined: Sep 2005
Posts: 75
CA, Orange County
You can create your own pointers:

ENTITY* enemyOne;
ENTITY* enemyTwo;

etc. player is simply a predifined pointer. You can use me (or my) in an action but if you want to do something to or with an entity outside of the action the me and my words may not work.

So you can add the above mentioned statements in an action and then use that pointer in the other parts of the game..
Hope that sheds some light on the issue
Gerrit

Re: The concept of 'player' confuses me ?? [Re: Gerrit] #249740
02/04/09 00:04
02/04/09 00:04
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

To add to this discussion.

Let's say that you have 3 entities using the same action.
If you use "my" they will all do the same action.
Now if you give each one a name (from handle)
You can call them by name and only the one called will do something specific.
The others will not.

Ottawa smile

Re: The concept of 'player' confuses me ?? [Re: Ottawa] #249783
02/04/09 08:54
02/04/09 08:54
Joined: Apr 2008
Posts: 437
dracula Offline OP
Senior Member
dracula  Offline OP
Senior Member

Joined: Apr 2008
Posts: 437
Is the following correct ?

me = my ie same thing. This pointer is like a local variable in as much that 'me' is the entity in THAT particular function.

Player is a global pointer. This is similar to a global variable in as much that 'player', once defined, can exist in any function.

Correct ??

Now I need to understand 'you'

Thanks

ps wht would help, if someone was to write a simple working example that demonstrate the use of 'me', 'player' and 'you'. If I am confused, I suspect others are too frown

Re: The concept of 'player' confuses me ?? [Re: dracula] #249813
02/04/09 12:38
02/04/09 12:38
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Thats all correct, except that player is always defined, but is empty
until you point it at something.

The you pointer is a bit trickier, it is 'like' the me/my pointer but it
is changed by many engine functions. Especially c_??? functions and particles.
Look in the manual under events for more help.

Overly simplified description of YOU, but here goes
YOU is assigned by an event to be the target of an event, that is if ME gets
shot, YOU is set to the bullet-entity. If ME walkes into a tree, YOU is set
to the Tree-Entity.
YOU is assigned by particle function somehow too, Im a bity blurry but heres
how I understand it. When you call effect(...), if ME is a valid entity,
then all the particle sub-functions can see that 'parent' entity as YOU.
See, I told you the YOU was a tricky one, and theres more to it than that,
its just thats all I can remember off the top of my head...

Code:
action setup_player()   //gets assigned to an entity in WED, or through an ent_create
{
   player = me;   //me was assigned by the engine to be the entity in WED or ent_create.
   // 'player' now is pointing to that entity from WED, and ANY other 
   // function in the script will also see that entity if you say 'player'.
   //
   while(me!=NULL)  //keep running until ME is destroyed and set to NULL.
   {
      if(key_w) my.x += 5;    //move me(move player) if w pressed  etc.
      wait(1);
   }
   printf("Player is dead");
}

action Missile_Pod()   //gets assigned to MANY entities in WED, or through an ent_create
{  
   while(my.skill5<100)    //damage level
   {
      if(key_space)
      {
          //creating a new entity, it will remember ME as YOU (see missile_act)
          ent_create("missile.mdl", my.x, missile_act);
          wait(-5);   //reload time
      }
      wait(1);
   }
   //explode effects
   ent_remove(me);
}

action missile_act()
{
   // ME = the missile.mdl entiry
   // YOU = THE Missile_pod ENTITY that fired this missile.
}


Hope this helps a bit.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 1 of 2 1 2

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

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