Hi all,
(Trying to get back to dev...)
Is it possible to pass arguments to an Zge generated aplication?
(Is it available on all platforms?)
Thanks,
Luis.
Passing arguments ZGE Application
Moderator: Moderators
Passing arguments ZGE Application
Close, but not there yet.
Hi Lupo,
Would be nice if a cross-platform solution gets built-in though
K
There's currently no property / functionality built-in to determine which arguments have been passed when executing a standalone. However, it's pretty simple to pull off yourself. Here's a example for Windows ( attached is a build + batch + shortcut for C:\Test.exe ).Lupo wrote:Is it possible to pass arguments to an Zge generated aplication?
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" NoSound="1">
<OnLoaded>
<ZExternalLibrary ModuleName="kernel32" Source="string GetCommandLineA(){}"/>
<ZExpression Expression="Foo.Text = GetCommandLineA();"/>
</OnLoaded>
<OnRender>
<RenderText Name="Foo" Scale="0.25" StretchY="2"/>
</OnRender>
</ZApplication>
Not exactly sure what the functions are called on Linux / OS X, but i'm sure each platform has its own equivalent.Lupo wrote:Is it available on all platforms?
Would be nice if a cross-platform solution gets built-in though

K
- Attachments
-
- Test.zip
- (32.99 KiB) Downloaded 513 times
Maybe I solved it. 

Code: Select all
string InputString = GetCommandLineA();
int FindUser = indexOf("name=", InputString, 0);
int FindUserEnd = indexOf("gjapi_token", InputString, 0);
FindUser += 5;
FindUserEnd -= 1;
UserName = subStr(InputString, FindUser, FindUserEnd - FindUser);
int FindToken = indexOf("token=", InputString, 0);
int FindTokenEnd = length(InputString);
FindToken += 6;
UserToken = subStr(InputString, FindUser, FindTokenEnd - FindToken);