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,791 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
How do I get a model's name in C-Lite #153595
09/12/07 02:12
09/12/07 02:12
Joined: Aug 2007
Posts: 26
S
SteveA Offline OP
Newbie
SteveA  Offline OP
Newbie
S

Joined: Aug 2007
Posts: 26
I added a model in WED named somemodel_mdl_001. I have an event function that is called on EVENT_IMPACT. In my event function, how can I find the name of the model (i.e., somemodel_mdl_001)? (I know that "me" points to the entity, but I want access to the name used in WED. Something like me.name?)

Thanks!

Steve

Re: How do I get a model's name in C-Lite [Re: SteveA] #153596
09/12/07 03:31
09/12/07 03:31
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
ent_for_name is just what you're looking for. It returns the WED name of an entity in the form of a string.

Unless you want to return the filename. In that case, use str_for_entfile.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: How do I get a model's name in C-Lite [Re: MrCode] #153597
09/12/07 16:18
09/12/07 16:18
Joined: Aug 2007
Posts: 26
S
SteveA Offline OP
Newbie
SteveA  Offline OP
Newbie
S

Joined: Aug 2007
Posts: 26
It looks like ent_for_name() returns the entity from a given entity name. I want to get the entity name from a specific entity.

Steve

Re: How do I get a model's name in C-Lite [Re: MrCode] #153598
09/12/07 17:40
09/12/07 17:40
Joined: Aug 2007
Posts: 26
S
SteveA Offline OP
Newbie
SteveA  Offline OP
Newbie
S

Joined: Aug 2007
Posts: 26
I found entity.string1 which sounds like it returns "String 1" from WED. However, it is always null.

I setup my event action like this. It does get called on startup.

action SetPrizeAction()
{
my.emask |= ENABLE_IMPACT;
my.event = PrizeEvent;
my.push = 1;
}

I handle the impact event like this. It does get called when another model runs into it. However, when I try to access string1 (I really want it from "me", the model being hit), string1 is always null. I also tried to access you.string1 (just for the heck of it), and it is also null. The "behaviour" page for both models has "String 1" set to a recognizeable value.

Any ideas?

Thanks!

STRING* sName = "#50";
function PrizeEvent()
{
switch (event_type)
{
case EVENT_IMPACT:
str_cpy(sName,"In PrizeEvent()");
if( me.string1 != NULL )
str_cpy(sName,me.string1);
if( my.string1 != NULL )
str_cpy(sName,my.string1);
if( you.string1 != NULL )
str_cpy(sName,you.string1);
beep();
break;
}
}

Re: How do I get a model's name in C-Lite [Re: SteveA] #153599
09/12/07 17:48
09/12/07 17:48
Joined: Apr 2007
Posts: 249
Louisana, USA
Ilidrake Offline
Member
Ilidrake  Offline
Member

Joined: Apr 2007
Posts: 249
Louisana, USA
I've been having the same problem with ent_for_name. Perhaps it's a bug? If anyone figures it out could you post your code and results here? Thanks in advance...


Just Because Your Paranoid Doesn't Mean They Aren't After You...Because They Really Are

http://spearbang.awardspace.com/news.php
Re: How do I get a model's name in C-Lite [Re: SteveA] #153600
09/12/07 17:57
09/12/07 17:57
Joined: Aug 2007
Posts: 26
S
SteveA Offline OP
Newbie
SteveA  Offline OP
Newbie
S

Joined: Aug 2007
Posts: 26
Ah-ha!

It appears to be a bug. If I only set "String 1" in WED (and leave "String 2" empty), entity.string1 is always NULL when accessed from SED. However, if I set "String 2" to any non-blank value in WED, I can then access entity.string1 from WED.

Steve

Re: How do I get a model's name in C-Lite [Re: SteveA] #153601
09/12/07 19:28
09/12/07 19:28
Joined: Apr 2007
Posts: 249
Louisana, USA
Ilidrake Offline
Member
Ilidrake  Offline
Member

Joined: Apr 2007
Posts: 249
Louisana, USA
Could you give me an example please. this sounds VERY useful for my own work. Thanks


Just Because Your Paranoid Doesn't Mean They Aren't After You...Because They Really Are

http://spearbang.awardspace.com/news.php
Re: How do I get a model's name in C-Lite [Re: Ilidrake] #153602
09/13/07 03:10
09/13/07 03:10
Joined: Aug 2007
Posts: 26
S
SteveA Offline OP
Newbie
SteveA  Offline OP
Newbie
S

Joined: Aug 2007
Posts: 26
Well, I'm a noob too, so I can only give the instructions as I understand them:

1. Insert a model in WED (Object | Add Model).
2. Double-click on the model in the Level list (on the left of the screen).
3. Select the "behaviour" tab (lower left of screen).
4. Specify a string for "String 1"
5. Specify a string for "String 2". This is needed (in my experience) or you can't access "String 1".

Then when you have access to that entity, you can retrieve "String 1" like this:

str_cpy(sEntityName, me.string1);

Again, if I don't set "String 2", then me.string1 will always be null.

Hope that helps...

Steve


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