Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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