Creating custom launch logic

Anything related to Game Scanner

Creating custom launch logic

Postby bdamage » 26 Apr 2009, 18:35

In this thread I will cover the basics for creating custom launch logic, this feature should pop-up in beta 7 and later.

Hence I haven't tested it 100%, hoping someone can help me with that.

The idea is to replace the old "Optional settings" in GS 1.x, for launching other game executables than default depeing of version or mod.
The new one will be script based similar to filters with less limitation and have full server rule support. Basicly what you can do is that you can use any server rule to check it's value and then run a specific executable automatic.
Nice feature if a game has lot of different mods, versions or protocols etc. Or if you just want to use your "clan config" for locked servers...

So instead of using "keep" or "remove" commands in filters those have been replaced by "run" and "norun" commands.


Example:
Code: Select all
if version == "*2.60b*" run
norun


This means if the server version rule contains 2.60b it will then return TRUE for that defined game path and execute, otherwise it will launch the default game path which is the first (top of the list) defined executable.

Below I will have set of screenshots how this could work.

*I hope this make some sense... atleast this was the fastest way for me to implement the logic. :D

execs.png


execs_details.png
execs_details.png (36.61 KiB) Viewed 720 times

execs_script.png
User avatar
bdamage
Site Admin
 
Posts: 275
Joined: 04 Jan 2009, 14:09

Re: Creating custom launch logic

Postby TomMRiddle » 26 Apr 2009, 20:42

good, just as I suggested, although I would say the renaming of keep and remove is a little abundant. adding words for this very specific feature is quite alot, unless you have technical reasons for the addition I would opt for sticking with keep and remove to as high extent as possible.
TomMRiddle
 
Posts: 130
Joined: 04 Apr 2009, 13:01

Re: Creating custom launch logic

Postby bdamage » 26 Apr 2009, 20:50

Well you can use the keep and remove also...
run and norun is just alias for keep and remove so they work exactly the same.
The reason of then ew keywords was to better understand the script itself.
User avatar
bdamage
Site Admin
 
Posts: 275
Joined: 04 Jan 2009, 14:09

Re: Creating custom launch logic

Postby Sentenza » 27 Apr 2009, 16:03

I've been playin with launch scripts for a while and a question came, this is the scenario: i created 3 different Install configs for Urban Terror, each with a specific and different Launch Condition script activated.
Install 1 script is:
Code: Select all
if hostname == "*SG*"  run
if g_followstrict == "1" norun
norun


Install 2 script is:
Code: Select all
if g_followstrict == "1" norun
if hostname != "*SG*"  run
norun


Install 3 script is:
Code: Select all
if g_followstrict == "1" run
norun


I then launched the game ( mouse double click on the server list) on a server which contained "SG" in the host name and which had server rule "g_followstrict" = 1: install 1 was launched.
That means as soon as GS evaluates "if hostname == "*SG*" run" it immediately runs the game, ignoring the remining part of the script.
I then inverted the first 2 Install num. 1 script lines so it became:
Code: Select all
if g_followstrict == "1" norun
if hostname == "*SG*"  run
norun


When i launched game, install 3 was correctly used because the first 2 failed and the 3d script condition was satisfied.

This means i MUST write a script keeping in mind that any "run" condition have to be placed after all of the "norun" conditions. I think this is a little bit confusing ppl who are writing their own scripts.
What about if GS could launch the game after the whole script was evaluated? In that case , using my scenario, install 3 would be launched no matter what the order of the 2 Install 1 script conditions was.


Another consideration is: if i launch the game (using the above described configuration) on a server which does NOT contain sg in its hostname and has server rule "g_followstrict" = 0 Install 1 is used because none of the 3 script conditions are satisfied and the default install ( num 1 ) is used. I'm not sure this is what should happen: since i defined active launch conditions on ALL of my installations, i'd suppose no game should be launched if none of em satisfies their condition. I'd expect the default installation to be called only if it had no active script ( so GS is using that 1 beacuse the rule is "When no install launch condition is satisfied ,use the default installation" ), but since my deafult install has been associated with an active script AND the script returns "norun" i think it should NOT be used.
Maybe u could just give the user an alert to warn him the game won't be launched beacuse of this reason, and suggest him to define a default installation with no active launch condition script associated to be used in such these cases.
Sentenza
 
Posts: 9
Joined: 04 Apr 2009, 15:53

Re: Creating custom launch logic

Postby TomMRiddle » 27 Apr 2009, 18:25

The filters work the same way ASE filters and run and norun are just aliases for keep and remove. every server on his own travel through the script from top to bottom, line by line, following the commands the script gives it, the commands are goto linenumber, keep and remove. commands preceded by a compare operation is only followed if that operation returns true. the goto commands lets servers skip lines of the filter, when a server get a keep or remove command it stops as keep and remove commands are final.

Servers that have SG in the hostname will run in your first example nomatter what g_followstrict is set to while servers without SG in the hostname will all get norun, first servers with g_followstrict set to 1 on line 2, and then the remaining servers in line 3. If I have understood your intention the script should be something like this:

Code: Select all
if hostname != "*SG*" norun
if g_followstrict == "1" norun

what this filter does is first remove servers that don't have SG in the hostname, then the servers that remain (has SG in hostname) get treated by the 2nd line and servers with g_followstrict set to 1 gets removed, leaving you with only servers with SG in the hostname without g_followstrict set to 1 as keep/run is assumed automatically at the end.

The reason not all lines are evaluated for all servers is to allow more serverspecific filters, one line can apply to some servers and not to other servers, which is a good thing allowing for more possibilities. To understand the basics of the filter syntax see the ASE filter documentation here: http://www.udpsoft.com/eye/advfilt.html
as I said norun=remove and run=keep use whichever you prefer. in other filters not used by the launch logic it might only work with keep and remove but I'm not sure

try making filters using ASE filter wizard, where you get a more verbose list of options and presentation of the results:
http://www.udpsoft.com/eye/wizard.html

the wizard game me this result:
ASE filter wizard wrote:If hostname contains SG AND
- g_follwostrict doesn't equal 1 THEN continue, otherwise reject.
Code: Select all
if hostname ~== "*SG*" goto 3
goto 4
if g_follwostrict != "1" goto 5
remove


the result is the same as my suggestion but not as concise and maybe easier to understand

Sentenza wrote:Another consideration is: if i launch the game (using the above described configuration) on a server which does NOT contain sg in its hostname and has server rule "g_followstrict" = 0 Install 1 is used because none of the 3 script conditions are satisfied and the default install ( num 1 ) is used. I'm not sure this is what should happen: since i defined active launch conditions on ALL of my installations, i'd suppose no game should be launched if none of em satisfies their condition. I'd expect the default installation to be called only if it had no active script ( so GS is using that 1 beacuse the rule is "When no install launch condition is satisfied ,use the default installation" ), but since my deafult install has been associated with an active script AND the script returns "norun" i think it should NOT be used.
Maybe u could just give the user an alert to warn him the game won't be launched beacuse of this reason, and suggest him to define a default installation with no active launch condition script associated to be used in such these cases.

I agree, I reported this as bug8 in the "Report bugs here" thread
TomMRiddle
 
Posts: 130
Joined: 04 Apr 2009, 13:01

Re: Creating custom launch logic

Postby Sentenza » 28 Apr 2009, 15:49

TomMRiddle wrote:The filters work the same way ASE filters and run and norun are just aliases for keep and remove. every server on his own travel through the script from top to bottom, line by line, following the commands the script gives it, the commands are goto linenumber, keep and remove. commands preceded by a compare operation is only followed if that operation returns true. the goto commands lets servers skip lines of the filter, when a server get a keep or remove command it stops as keep and remove commands are final.

Servers that have SG in the hostname will run in your first example nomatter what g_followstrict is set to while servers without SG in the hostname will all get norun, first servers with g_followstrict set to 1 on line 2, and then the remaining servers in line 3. If I have understood your intention the script should be something like this:

Code: Select all
if hostname != "*SG*" norun
if g_followstrict == "1" norun

what this filter does is first remove servers that don't have SG in the hostname, then the servers that remain (has SG in hostname) get treated by the 2nd line and servers with g_followstrict set to 1 gets removed, leaving you with only servers with SG in the hostname without g_followstrict set to 1 as keep/run is assumed automatically at the end.

The reason not all lines are evaluated for all servers is to allow more serverspecific filters, one line can apply to some servers and not to other servers, which is a good thing allowing for more possibilities. To understand the basics of the filter syntax see the ASE filter documentation here: http://www.udpsoft.com/eye/advfilt.html
as I said norun=remove and run=keep use whichever you prefer. in other filters not used by the launch logic it might only work with keep and remove but I'm not sure

try making filters using ASE filter wizard, where you get a more verbose list of options and presentation of the results:
http://www.udpsoft.com/eye/wizard.html

the wizard game me this result:
ASE filter wizard wrote:If hostname contains SG AND
- g_follwostrict doesn't equal 1 THEN continue, otherwise reject.
Code: Select all
if hostname ~== "*SG*" goto 3
goto 4
if g_follwostrict != "1" goto 5
remove


the result is the same as my suggestion but not as concise and maybe easier to understand


I got the point, it's ok so. Basically i just need to know that the very first condintion followed by a "run" command which returns true will launch the game and terminate any further evaluation , not just in the current launch script but also in the possible next scripts; so, if i got it right, while filter evaluates a second filter after a first one was evaulated and terminated with a "keep" result, launch scripts does not ... this is the main difference as far as i can see.
Sentenza
 
Posts: 9
Joined: 04 Apr 2009, 15:53

Re: Creating custom launch logic

Postby TomMRiddle » 28 Apr 2009, 17:18

I don't believe I understand you... both run/keep and norun/remove will terminate the evaluation no matter where it occurs in the script, but only for the servers that a compare operation returns true for, if it returns false for a server that server ignores that command and continue the evaluation. in the end all servers will have received a single remove or keep command each, if a server does not get a command by the filter then keep is assumed ending the script.

I wished I knew how to explain it better, if you have some ideas for filters you want to make, tell me about how you want them to work and show me how you would write them and I could point you in the right direction and hopefully you will be enlightened.

A good way to avoid problems is to write the filter in a way that you only use remove/norun(removing the servers you don't want), so that the ones you want to keep always returns false on the compare operations, then you are automatically left with the stuff you want to keep and you don't even have to say that you want to keep them because keep is assumed at the end anyway. this is obviously oversimplifying it but it works for simple filters.

example:
if hostname == "*SG*" keep
remove

could be written like this:
if hostname != "*SG*" remove

then you can continue with more conditions for servers with SG in the hostname, in the first example you have already terminated the evaluation and would have to change keep to "goto 3" to continue the evaluation.

the next step adding another condition:
if hostname != "*SG*" remove
if g_followstrict == "1" remove

now you are left with servers with SG in the hostname that don't have g_followstrict set to 1, and you could keep adding more conditions for the remaining servers as long as you don't end with keep and the compare operation returns false for one or more servers.
TomMRiddle
 
Posts: 130
Joined: 04 Apr 2009, 13:01

Re: Creating custom launch logic

Postby bdamage » 03 May 2009, 19:22

beta version of the filter wizard (rip off): http://www.bdamage.se/wizard.htm
however it has no support for launch condition yet...

Any html hackers are welcome to improve the wizard... :)
User avatar
bdamage
Site Admin
 
Posts: 275
Joined: 04 Jan 2009, 14:09


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron