Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Assigning Entity Actions #136477
06/14/07 17:36
06/14/07 17:36
Joined: Nov 2006
Posts: 141
South Africa
quasarchangel Offline OP
Member
quasarchangel  Offline OP
Member

Joined: Nov 2006
Posts: 141
South Africa
Is there some way to assign an entity action to an entity via a string?
Example: ent_create("grass.mdl",my.x,"grass");
If not, would it be possible to write a plugin in C++ that would be able to do so?


God DID give us a manual on how to change this world...
Re: Assigning Entity Actions [Re: quasarchangel] #136478
06/14/07 17:42
06/14/07 17:42
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
you could use the execute(""); function. This allows you to build strings containing commands and execute them. It's a bit tricky to use, and won't be available in Lite-C


xXxGuitar511
- Programmer
Re: Assigning Entity Actions [Re: quasarchangel] #136479
06/14/07 17:42
06/14/07 17:42
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
you can try by str_cmpi:

string grass_str = "grass";
temp = str_cmpi(grass_str,"grass");
if(temp ==1){grass();}

but with using straight method... not sure


Never say never.
Re: Assigning Entity Actions [Re: tompo] #136480
06/14/07 17:45
06/14/07 17:45
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Simple answer: No, you need a function pointer.

Question: What do you want to achieve? maybe somebody around here knows another approach

Re: Assigning Entity Actions [Re: Xarthor] #136481
06/14/07 18:02
06/14/07 18:02
Joined: Nov 2006
Posts: 141
South Africa
quasarchangel Offline OP
Member
quasarchangel  Offline OP
Member

Joined: Nov 2006
Posts: 141
South Africa
Ok, it seems the execute function might do the job, but the function pointers might work better, if it works. The reason why I need it is quite complicated and I don't really feel like typing it all. In short I am working with arrays a lot and I need an array list of certain actions. So, the function pointers will probably work best.


God DID give us a manual on how to change this world...

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