Gamestudio Links
Zorro Links
Newest Posts
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (VoroneTZ), 9,291 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
script() function that sets Script #477654
07/19/19 18:55
07/19/19 18:55
Joined: Feb 2017
Posts: 1,808
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,808
Chicago
jcl,

It would be handy if there was a function script() that sets Script, much like algo() sets Algo.

I have an application where I am producing a lot of log files in a batch-heavy setup, with many unique command line options. It would be useful if I can supply strf() as an input.

Thanks,
Andrew

EDIT: In retrospect, it looks like Script has no effect on the name of log files, but only LogNumber does. Nonetheless, I do need to change Script when I have multiple live zorros running the same script.

Last edited by AndrewAMD; 07/20/19 17:36.
Re: script() function that sets Script [Re: AndrewAMD] #477657
07/19/19 21:44
07/19/19 21:44
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Why not script(string s) { Script = s; } ?

Re: script() function that sets Script [Re: AndrewAMD] #477659
07/20/19 02:12
07/20/19 02:12
Joined: Feb 2017
Posts: 1,808
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,808
Chicago
Wouldn’t that cause undefined behavior?

For example, strf outputs a temporary pointer.

Re: script() function that sets Script [Re: AndrewAMD] #477661
07/20/19 05:47
07/20/19 05:47
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Youre right, but what about this

void script(string s) { static char S[50]; strcpy(S,s); Script = S; }

Re: script() function that sets Script [Re: AndrewAMD] #477667
07/20/19 14:18
07/20/19 14:18
Joined: Feb 2017
Posts: 1,808
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,808
Chicago
This works, thanks.

I think the newbies might appreciate a permanent implementation of this. (Rookie mistake: Script = strf(....))

Re: script() function that sets Script [Re: AndrewAMD] #477696
07/22/19 05:50
07/22/19 05:50
Joined: Jul 2000
Posts: 28,028
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,028
Frankfurt
We would then need such functions for all the predefined strings. But I'll put a remark in the manual for this case.

Re: script() function that sets Script [Re: AndrewAMD] #477701
07/22/19 13:28
07/22/19 13:28
Joined: Feb 2017
Posts: 1,808
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,808
Chicago
Makes sense, thanks.


Moderated by  Petra 

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