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
1 registered members (TipmyPip), 18,449 guests, and 6 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
Bug passing variables in functions ! ! ! #260269
04/09/09 21:01
04/09/09 21:01
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
>>because check this:

void return_number(var number){
STRING* tt="number";
str_for_num(tt,number);
while(1){error(tt); wait(1);}
}


now on main...

return_number(10);
return_number(20);

This should make the engine , error output 10, and then 20, and then 10 and then 20, endless.. but thats not what happens, you get, 10, then 20, then 20 forever, 10 will disapear wuhuhu..

Re: Bug passing variables in functions ! ! ! [Re: MMike] #260280
04/09/09 22:54
04/09/09 22:54
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
That is an invalid used of the STRING* type.
INSIDE a function you MUST use ent_create.
Tyr this instead.

Code:
void return_number(var number)
{
   STRING* tt = str_create("");
   str_for_num(tt, number);
   while(1)
   {
      error(tt); 
      wait(1);
   }
   str_remove(tt);
}



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Bug passing variables in functions ! ! ! [Re: EvilSOB] #260285
04/09/09 23:36
04/09/09 23:36
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Oh my god.. cry
yeah thats the "lesson" you gave me the other day. i fell so bad now, anyway, i never think i read that on the manual. at last on the string index there is no reference to that..
Thanks Evilsob, i though strings could act like vars...

Last edited by MMike; 04/09/09 23:38.
Re: Bug passing variables in functions ! ! ! [Re: MMike] #260293
04/10/09 01:24
04/10/09 01:24
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Thats kewl, I still remember the MANY headaches strings first gave me too.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Bug passing variables in functions ! ! ! [Re: EvilSOB] #260308
04/10/09 04:16
04/10/09 04:16
Joined: Apr 2009
Posts: 4
A
archie Offline
Guest
archie  Offline
Guest
A

Joined: Apr 2009
Posts: 4
Feel free to remove / alter / expand the wiki entry for this instance.


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