if , else if , else .. in rotation.txt ..need help
I need help get my rotation to see what config is currently running and execute commands based on it. My current code just seems to run the first statement even though the config isn't running.
Thanks for any help.
Here is the code. -dis
if ( $xp_config == "dc01.cfg" ) { if ( $xp_config == "fn1.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*CA*FTAG*" g_gametype: 8 q3dm6 } else if ( $xp_config == "fn2.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*VANILLA*TDM*" g_gametype: 3 pro-q3dm6 } else if ( $xp_config == "fn3.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*INSTAGIB*FTAG*" g_gametype: 8 q3dm6 } else if ( $xp_config == "fn4.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*INSTAGIB*CTF*" g_gametype: 5 q3ctf1 } else { sv_hostname: "*error*" q3dm0 } } else
man, will you please re-format it, so it would be as much readable as possible.
btw, i like it:
else { sv_hostname: "*error*" q3dm0 }
edit: it seems there's not enough closing curly brackets check it
edit2: and plz, remove those lines
edit3: damn, brackets are fine, sry
here's formatting:
if ( $xp_config == "check.cfg" ) { if ( $xp_config == "sample1.cfg" ) { //keeps just stopping here, even though check.cfg isn't running. g_gametype: 8 q3dm6 } else if ($xp_config == "sample2.cfg") { g_gametype: 3 pro-q3dm6 } else { sv_hostname: "*error*" q3dm0 } } else { q3dm1 }
maybe only one if-else level allowed in rotation?
It's completely useless to test $xp_config inside the first block because you already know that $xp_config == "check.cfg" is true.
I think you need to do it like this:
if ( $xp_config == "check.cfg" ) { sv_hostname: "*error*" q3dm0 } else if ( $xp_config == "sample1.cfg" ) { //keeps just stopping here, even though check.cfg isn't running. g_gametype: 8 q3dm6 } else if ($xp_config == "sample2.cfg") { g_gametype: 3 pro-q3dm6 } else { q3dm1 }
Not sure whether this is what you were looking for.
it's obvious logical mistake, bozo. was just about to write about it. but that's not the point, the point is that he claims the flow stops where 'sample1' condition is met o_O
Of course it works in multiple levels, but not in the way you did in your first post.
After that you know that $xp_config == "dc01.cfg" is true it's completely useless to test $xp_config for fn1.cfg, fn2.cfg, fn3.cfg, fn4.cfg. These can never be true!
if ( $xp_config == "dc01.cfg" ) { if ( $xp_config == "fn1.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*CA*FTAG*" g_gametype: 8 q3dm6 } else if ( $xp_config == "fn2.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*VANILLA*TDM*" g_gametype: 3 pro-q3dm6 } else if ( $xp_config == "fn3.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*INSTAGIB*FTAG*" g_gametype: 8 q3dm6 } else if ( $xp_config == "fn4.cfg" ) { sv_hostname: "*FRAGGEDNATION*E+*INSTAGIB*CTF*" g_gametype: 5 q3ctf1 } else { sv_hostname: "*error*" q3dm0 } }
the above code doesn't make sense, cuz no of the subconditions will be ever met. so could you plz explain what you are trying to achieve?
ok, you have an advisor i'm out. it's too crowded here
well fixed a bit.. best i can do without the line breaks.. or this weird bbcode formatting