Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/23/26 21:52
WFO Training with parallel cores Zorro64
by Martin_HH. 02/23/26 15:29
Camera always moves upwards?
by clonman. 02/21/26 09:29
Zorro version 3.0 prerelease!
by TipmyPip. 02/20/26 13:22
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (AndrewAMD), 6,385 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Error [STRINGS] #339197
08/25/10 09:33
08/25/10 09:33
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I saved name of the function and name of the model in two different strings, and then I try to create a model with the name and with the function from that strings. But I'm getting SYS error crazy What am I doing wrong here?!
Code:
STRING* s_view = "#30";
STRING* s_function = "#30";

function v_change()
{
	ent_create(s_view,camera.x,s_function);
}

action v_model()
{
	str_cpy(s_view, "v_model.mdl");
	str_cpy(s_function, "v_model");
}

When I create model with the name from the string, but with function v_model, it works just perfect!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Error [Re: 3run] #339198
08/25/10 09:37
08/25/10 09:37
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
ent_create wants a pointer to a function, not a STRING pointer.
engine_getscript() is the function you are looking for


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Error [Re: WretchedSid] #339200
08/25/10 09:42
08/25/10 09:42
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I would do it this way. (untested)
Code:
STRING* s_view = "#30";
void*   v_function = NULL;

function v_change()
{
	ent_create(s_view,camera.x,v_function);
}

action v_model()
{
	str_cpy(s_view, "v_model.mdl");
	//or maybe : str_cpy(s_view, _str(my.type));
	v_function = v_model;
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Error [Re: WretchedSid] #339201
08/25/10 09:42
08/25/10 09:42
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I've tried to do like this:
Code:
STRING* s_view = "#30";

var s_function;

function v_change()
{
	ent_create(s_view,camera.x,s_function);
}

action v_model()
{
	s_function = engine_getscript("v_model");
	str_cpy(s_view, "v_model.mdl");
}

Same result frown


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Error [Re: 3run] #339202
08/25/10 09:47
08/25/10 09:47
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
var is not a type that is supposed to hold a pointer. This should work:
Code:
STRING *s_view = "#30";
void      *s_function;

function v_change()
{
	if(!s_function)
	{
		error("s_function == NULL!");
		return;
	}

	ent_create(s_view,camera.x,s_function);
}

action v_model()
{
	s_function = engine_getscript("v_model");
	str_cpy(s_view, "v_model.mdl");
}




Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Error [Re: WretchedSid] #339203
08/25/10 09:49
08/25/10 09:49
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I'm getting 'v_model' undeclared identifier cry I could define all function before the 'v_model' action, but there are too many functions, and all of them will appear in WED... and I don't want them to. It will be two v_models in Behavior list that way... May be there is an other way to avoid getting undeclared identifier error?

Last edited by 3run; 08/25/10 10:00. Reason: ---

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Error [Re: 3run] #339209
08/25/10 10:49
08/25/10 10:49
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
If you have an action that you dont want to appear in WED,
just make it a normal function. Your script wont care...
eg:
Code:
action v_model()  { ... }

//becomes 

function v_model()  { ... }
//or
var v_model()  { ... }
//or
int v_model()  { ... }



Did my code give an "undeclared identifier" error?
Then try this.
Code:
var v_model();  //function prototype
STRING* s_view = "#30";
void*   v_function = NULL;


function v_change()
{
	ent_create(s_view,camera.x,v_function);
}


var v_model()   //now a normal function to keep it out of WED
{
	str_cpy(s_view, "v_model.mdl");
	//or maybe : str_cpy(s_view, _str(my.type));
	v_function = v_model;
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Error [Re: EvilSOB] #339214
08/25/10 11:18
08/25/10 11:18
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
I'm trying to call v_function inside other function, but I'm getting:
"Call function v_function error". What is that? crazy


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Error [Re: 3run] #339221
08/25/10 11:41
08/25/10 11:41
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
No idea, not without see the code causing the problem...
I dont know what you mean by trying to call the v_function?
You cant CALL it through the v_function pointer, you can only
assign it as an action to an entity...

Please explain EVERYTHING you are trying to achieve here...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Error [Re: EvilSOB] #339222
08/25/10 11:49
08/25/10 11:49
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Ohh. You just said, what I'm trying to do laugh I've try to call if through the v_function pointer grin
Code:
...
v_function();
...

I've tried to store it with engine_getscript, and then to call, but same result frown
I'm trying to store and call function (they need to be store and change in every function, where I store it or change it to new function).

Last edited by 3run; 08/25/10 12:24.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Page 1 of 2 1 2

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