Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/08/26 22:41
Stooq now requires an API key
by VHX. 06/08/26 20:14
ZorroGPT
by TipmyPip. 06/06/26 12:36
Zorro 3.01 recoded MMI function issue
by TipmyPip. 06/04/26 05:44
SGT_FW
by Aku_Aku. 05/31/26 11:05
Issues resuming trades on Demo account
by Martin_HH. 05/22/26 13:31
XTB
by pr0logic. 05/18/26 12:27
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 3,506 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Seraphinang, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Changing Function/Action at runtime? #276030
07/03/09 09:19
07/03/09 09:19
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
I know this might sound strange but is it possible to redefine an entity's function or action at runtime?

I currently have a basic workaround that creates a new entity using ent_create, with the new function name, and then i get the properties of the existing entity (x,y,z,pan,roll etc), and set them to the new entity.

This sort of works, but it takes time and i don't know if i can set all properties, like flags etc.

Re: Changing Function/Action at runtime? [Re: DJBMASTER] #276033
07/03/09 09:36
07/03/09 09:36
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Couldn't you just end the currently assigned action and start the new function and set its my-pointer to the entity's pointer?

Regards,
Pegamode.

Re: Changing Function/Action at runtime? [Re: pegamode] #276035
07/03/09 09:44
07/03/09 09:44
Joined: Jul 2000
Posts: 28,101
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,101
Frankfurt
Yes, just call the new action from the entity's old action, and then terminate the old action.

Re: Changing Function/Action at runtime? [Re: jcl] #276043
07/03/09 09:57
07/03/09 09:57
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
hmm i know how to do that, i should of said i'm looking for something that can do it outside of the entity's action.

like ent_set_function(entity,function).

Re: Changing Function/Action at runtime? [Re: DJBMASTER] #276046
07/03/09 10:02
07/03/09 10:02
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
You could do it outside the entity's action.

Call a new function and inside this function set the my-pointer to the entity's pointer.

If you call the new function from inside the old action the my-pointer is set per default to the entity's pointer.


Re: Changing Function/Action at runtime? [Re: pegamode] #276048
07/03/09 10:08
07/03/09 10:08
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
What i'm doing is creating a small utility that generates actions. Entities are placed in WED and by default have no action applied to them. I'm trying to link the action i create using my utility, to the entity in WED.

I'm trying to do it programatically at the start of my script. I know the name of the action i generated, and which entity it must be linked to.

If there was a way to modify the .wmb file, and change the name of the action then it would be ok, but there isn't.

Re: Changing Function/Action at runtime? [Re: DJBMASTER] #276050
07/03/09 10:11
07/03/09 10:11
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Why should you write it into the .wmb file???

Why don't you set the my-pointer in your function if you know the name and the entity?

Re: Changing Function/Action at runtime? [Re: pegamode] #276051
07/03/09 10:11
07/03/09 10:11
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
Quote:
Call a new function and inside this function set the my-pointer to the entity's pointer.

you don't have to do it inside.
you can do it from outside like that:

my = entity;
new_function();

my simply is a global variable that always gets stored/restored by wait().

Quote:
I'm trying to do it programatically at the start of my script.
i do something very similar in my python wrapper. only with lite-c the WED actions get started automatically. in my python wrapper i have to do it manually. so i have my own level_load() function which reads the action names from the wmb file and then simply sets the my pointer before calling the right function. it works exactly like in lite-c.

and you could modify a wmb file of course. the file format specifications are in the manual. you could look into my a7_scheduler.py and the function get_actions() to see how i read the actions. writing the actions would only require some small changes.

Re: Changing Function/Action at runtime? [Re: ventilator] #276053
07/03/09 10:14
07/03/09 10:14
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
yes, that's another way to set the my-pointer.

Re: Changing Function/Action at runtime? [Re: ventilator] #276062
07/03/09 10:25
07/03/09 10:25
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Originally Posted By: ventilator
i have my own level_load() function which reads the action names from the wmb file and then sets the my pointer before calling the function.

Oh, would you mind telling me how you can read the action names?

Originally Posted By: ventilator
and you could changes wmb files of course.

I can actually edit the .wmb files, and update the names of the actions inside? I thought this couldn't be done. If so could you explain how i can do this? Thanks.

Page 1 of 3 1 2 3

Moderated by  old_bill, Tobias 

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