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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,632 guests, and 5 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
Panels and ENTITY Skills #223531
08/24/08 23:47
08/24/08 23:47
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
How can I get the skills of an entity to show up in a panel. For example ...

#define Name skill50 ***This creates a problem ***
#define Health skill51

ENTITY* Person = NULL;

function main()
{
you = ent_create("person.mdl",target.x,Human_Act);
}

action Human_Act()
{
***** this next line causes an error "can't convert array to fixed" why is this. *******

my.name = "Paul";
my.heath = 100;

while(1)
{
*** some actions ***

}

}

PANEL* info =
{
pos_x = 0; pos_y = 100;
bmap = ppl_info;

digits = 5,15,"Name: %s",*,1,mouse_ent.name;
digits = 5,25,"Health: %s",*,1,mouse_ent.health;
}

this isn't the actual code I am playing around with I just typed it in quickly so you get the idea. As you can see I'm trying to get a panel to display information about a entity that has been "clicked" mouse_ent from what I understand is supposed to hold all information on an entity that has been clicked, then why is the panel info always 0 or null in the case of the name ... I can't even give name a value because of the error. This seems that it should be this hard to figure out, can someone point me in the right direction.

Re: Panels and ENTITY Skills [Re: phmenard] #223538
08/25/08 00:43
08/25/08 00:43
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
im pretty sure defines cannot use text only numbers because they are like a var you would need to use strings i think

Re: Panels and ENTITY Skills [Re: badapple] #223566
08/25/08 08:05
08/25/08 08:05
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
Code:
STRING* str_a = "";
STRING* str_b = "";

PANEL* info =
{
pos_x = 0; pos_y = 100;
bmap = ppl_info;

digits = 5,15,"Name: %s",*,1,str_a;
digits = 5,25,"Health: %s",*,1,str_b;
}


function mouse_str()
{
	while(1)
	{
		if(mouse_ent)
		{
			str_num(str_a,mouse_ent.name);
			str_num(str_b,mouse_ent.health);
		}
		wait(1);
	}
}

function main()
{
	...
	mouse_str();
	...



"empty"
Re: Panels and ENTITY Skills [Re: flits] #223665
08/25/08 20:41
08/25/08 20:41
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
Yea that all seems to work fine, but I thought ENTITY was global??? so why would I have to create TWO more variables ... this doesn't make sense. Why couldn't I just use ...

PANEL* info =
{
pos_x = 0; pos_y = 100;
bmap = ppl_info;

digits = 5,15,"Name: %s",*,1,mouse_ent.name;
digits = 5,25,"Health: %s",*,1,mouse_ent.health;
}


instead of your panel code above flits?? And not only am I creating TWO more variables I'm also creating another infinite loop, why would I want to do that ... this seems like a waist of resources. Shouldn't these calculations be able to take place in an action and "mouse_ent" updated every step of the way?? seems odd to me ... can anyone help???

Re: Panels and ENTITY Skills [Re: phmenard] #224728
08/31/08 22:46
08/31/08 22:46
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
hmmm anybody else have any ideas??

Re: Panels and ENTITY Skills [Re: phmenard] #224731
08/31/08 23:14
08/31/08 23:14
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
if you're not using 'player' anywhere you could use that?

player = mouse_ent; etc... you get how it work :P

Re: Panels and ENTITY Skills [Re: MrGuest] #224747
09/01/08 00:37
09/01/08 00:37
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
and then what ... do somthing like this ...

PANEL* info =
{
pos_x = 0; pos_y = 100;
bmap = ppl_info;

digits = 5,15,"Name: %s",*,1,player .name;
digits = 5,25,"Health: %s",*,1,player .health;
}

Re: Panels and ENTITY Skills [Re: phmenard] #224806
09/01/08 09:40
09/01/08 09:40
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
aye, but lose the spaces in player .name -> player.name

Re: Panels and ENTITY Skills [Re: MrGuest] #224823
09/01/08 11:57
09/01/08 11:57
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
The problem you are probably going to get is that unless "player" is defined in WED, your going to get
compile errors from the panel on the "player.???" lines.
Because if player is undefined ay compile time, the panel cant find "player.name" because "player==NULL".

UNLESS you cheat. It can get messy but if you are careful you can get away with it.

At the top of your code somewhere define "player" like this
Code:
ENTITY* player = { x=x; }

instead of

ENTITY* player;
This creates a dummy global entity for your panel to compile with.
The rest of your coding can stay the same.


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

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