Sarken Posted August 6, 2015 Posted August 6, 2015 I am working on class selector script for NQ server. My qeustion is there anyway to check if joining to team is impossible. I mean script offer u way to change team but script won't know if team are balanced and if u will be able to change team. Anyway to make an exception here and there just isn't such tool from player side? Quote
Shana Posted August 7, 2015 Posted August 7, 2015 With class&team selector you could use admin commands to ignore unbalanced teams(ie team has too many players to join).With normal scripts you can join from team to specs then wait for bots to even then go to other team.I recommend checking /scores before changing teams so they are even Here are scripts I'm using right now, feel free to use them bind LEFTARROW "team r 1 3 38;vstr xcls_default;echo ^iAxis" bind RIGHTARROW "team b 1 8 37;class c 3;vstr xcls_default;echo ^dAllies" bind DOWNARROW "team s" bind UPARROW "" bind KP_UPARROW "class m 1;echo ^?M^wedic" bind KP_PGUP "class c 3;echo ^?C^wover-ops ^?G^wrand" bind KP_HOME "class c 1 39;echo ^?C^wover-ops ^?S^wten" bind KP_5 "class f 1;echo ^?F^wield-ops" bind KP_RIGHTARROW "class e 1;echo ^?E^wngi" bind KP_INS "setspawnpt 0; echo ^l.^k>Spawnpoint: ^lDefault" bind KP_END "setspawnpt 1; echo ^l.^k>Spawnpoint: ^l1" bind KP_DOWNARROW "setspawnpt 2; echo ^l.^k>Spawnpoint: ^l2" bind KP_PGDN "setspawnpt 3; echo ^l.^k>Spawnpoint: ^l3" bind KP_ENTER "mp_fireteamadmin" Explanation:leftarrow - join axis as medic with single pistolrightarrow - join allies as medic with single pistoldownarrow - join team specoratorsuparrow - no script therekeypad8(kp_uparrow) - medic with pistolkeypad9 - covertops with m1grandkeypad7 - covertops with stenkp5 - fieldops with thompsonkp6 - engineer with thompsonkp4 is freekp 0-3 are spawn selectskp0 is default spawnpointkp1 - 1st spkp2 - 2nd spkp3 - 3rd spkpenter for joining fireteamsEvery command is set as echo so you'll see in your cpm area only, not in chat/teamchat. 3 1 Quote
Sarken Posted August 7, 2015 Author Posted August 7, 2015 (edited) Those things I already know. I wanted to script decide if joining team is possible or not. This is player script so can't use admin commands or lua scripts from server side. Silly thing... My script is really huge, it let you choose team/both weapons and adjust the configurations of sharing informations on chat (class/weapons/team/voice etc.) I am sad there is no tool for it :/ EDIT What are spawnpoints? Edited August 7, 2015 by Sarken Quote
Platonic Posted August 7, 2015 Posted August 7, 2015 EDIT What are spawnpoints? You're scripting and you don't know spawnpoints? Intriguing, glad I can help you with that Spawnpoints indicate the spot where you spawn on the map. For example if you construct a command post, you could set your spawnpoint there. Quote
Sarken Posted August 7, 2015 Author Posted August 7, 2015 I am scripting, Just never used it. But read about it for while. I don't think it is easy to make decent script to work properly on every map (where are 2 spawns and where are 5). 2 Quote
Platinum VIP Dest!Ny Posted August 8, 2015 Platinum VIP Posted August 8, 2015 I am scripting, Just never used it. But read about it for while. I don't think it is easy to make decent script to work properly on every map (where are 2 spawns and where are 5). personally I just use a script where you can select spawnpoint 1-5 and default. works pretty well, There is a possibility to make a different config for every map, so you can give all the spawnpoints names but if you just play with them regularly youll learn them eventually p.s. screw et_beach and the million spawnpoints on axis side 2 Quote
DrPotato Posted August 8, 2015 Posted August 8, 2015 (edited) There doesn't seem to be any function that could possible do this, it was something I wanted to try as well when I made a overly complicated class selector just to learn. Scripting is very basic in function, unless I missed a major part of it while researching there is no capacity to check the state of a variable or run any "if" kind of action even if you somehow could. I could be wrong though, never done scripting before and still haven't done much. Edited August 8, 2015 by SadElf Quote
Sarken Posted August 9, 2015 Author Posted August 9, 2015 Ye there isn't if-statement which would let you implement everything, ofc in much harsh way but if-statement can work as for/while/switch etc. But I think there isn't such thing coz of logical conditions in syntax of this statement, how to deal with it without introducing dozens of additional commands. Quote
menatwork Posted August 9, 2015 Posted August 9, 2015 (edited) Technically this would be possible though, though I'm assuming ET writes log messages directly to the disk. So firstly, ET should log to a log file - and I'm assuming ET will also log messages such as "<team> is full." to said log file. Let's say you have two binds (the wait might not be necessary but I haven't tested this): bind f6 "team r; wait 5; exec xyz.cfg" bind f7 "team b; wait 5; exec xyz.cfg" Then you have a script (not an ET config-script but an actual script, say something written in Python) that monitors ET's log file (tailing it) and parsing messages looking for the '<team> is full.' message, upon finding that message, you'll have your script write to xyz.cfg, for instance if axis is full: echo "Axis is full." team b If axis isn't full, the script should write a blank line to xyz.cfg, meaning - the /exec would load xyz.cfg but it wouldn't do anything. ---- Now, a small disclaimer: I haven't tested this - I don't know if it'll work - I don't know if the wait will work - and most importantly, I don't know if this is going to trigger some anti-cheat (though I don't see why it would; but... it might). So, it's on your own risk but I do see the beauty in this option. ^ Thinking outside the box. --- Edit, just realized the original question was: "I am working on class selector script for NQ server. My qeustion is there anyway to check if joining to team is impossible. I mean script offer u way to change team but script won't know if team are balanced and if u will be able to change team. " I didn't understand it fully at first, but I'm guessing what he/you actually want is a way for a script to check if teams are balanced and if not - make an offer for you to join the other team; well, there is (I think)! So; essentially you'd still need the log file and an actual script (say Python, just mentioning it specifically so there's no confusion between ET & actual scripting) that'll monitor the log file. I am assuming the ET 'wait' command is non-blocking (I might be wrong! I don't generally use it! If it is blocking and there's no alternative, this will NOT work). The script will need to keep track of several things: - Players in teams (when first joining the server, your ET's autoexec.cfg could simply do a /scores) ( - Whenever a player join another team - Whenever a player disconnects (either by free-will, time out, kick, ban) ) - though, the ET-config could also occasionally poll /scores (at least, that is - if 'wait' is non-blocking). Now, whenever the script indicates the teams aren't fair, you'll simply write XYZ.cfg with: echo "^1Teams aren't fair, <team> has X players whilst <team2> has only X. Press f1 to switch to <team2>." bind f1 "team <team2>; bind f1 vote yes" // Again assuming 'wait' is non-blocking: wait 60 echo "^1Assuming you don't want to switch teams!" bind f1 "vote yes" // Set up polling... wait 300 exec XYZ.cfg If they are fair, you'll only have the '// Set up polling..' part. --- Now cool thing is, you could even monitor K/D - though, I'll leave that as an exercise to the reader. --- Disclaimer 2: Don't lynch me if '/wait' is blocking. Like I said, I don't generally use it. I really don't know, I suppose I could test it - but I'm a bit lazy atm; I'm actually making the assumption that wait is blocking when used in a sequence (/bind x "thing1;wait 10; thing2" whilst not blocking when using like in the last code example). Edited August 9, 2015 by w00tw00t Quote
DrPotato Posted August 9, 2015 Posted August 9, 2015 Does it work like that? I assumed this was is a server side thing, so when you try and join a team the client tries to join and the server is what blocks it by stating the team is full. Quote
Sarken Posted August 9, 2015 Author Posted August 9, 2015 (edited) Hmm you make me to think about it a little. There is something like etconsole.txt file which is created when you toogle /logfile "1".It store all your console data/, ofc without breaks everything in one line but good script would find necessery data. One problem is that whole data is stored after game closing if I understand it well. Second problem is no matter which code language you will use to write script which would search for special text and executing file which will do something as a reaction for it (for example clicking some button which is binded to executing it) you can't execute script from ET you will have to execute it as a different program. I don't know if it would be possible to make lua script and attach it from player side to the game, coz these script are server side scripts even when ETPro/NQ mods are supporting LUA. So in summary: - logfile is created after closing game - in logfile there aren't onscreen messages, only this what was in console (usually text about unbalanced teams is displayed on screen) and I don't know if you can switch it to console, I don't think so, coz it also is server side message. - script what you will have to create wouldn't be (probably) connected with et game client, but just different program which will affect et game. And generally even if first 2 points would be possible to get trough them, with 3rd point it start to be a bit too complicated for normal ET player. Making it just for myself is stupid, if I would create something like that I would share with it with others. But I don't think many people will download additional script to have magnificient class selector script which would work no matter of situation. Maybe you have more ideas or something what I wrote above is not true? EDIT: wait x; don't block anything. This command stop the executed line for x FPS, and during the wait period it trigger action which will be made during this period, so for example if you u will make wait 1000 and start shooting, u will shoot to end of wait period - something like that, but in case of low duration 10-25 you wouldn't be able to do anything. Edited August 9, 2015 by Sarken Quote
menatwork Posted August 9, 2015 Posted August 9, 2015 Right - the log file is an issue. Though the 3rd point I had already solved - instead of having ET execute it - you'd have it running in the background (tailing the log - which is a problem! since it doesn't work that way as per your comment) and the script would (over)write a 'xyz.cfg' which would be executed by a bind (for team-switching, there'd be a bind like: bind x "team r; wait 5; exec xyz.cfg" (xyz.cfg would be written by the script) So the 'wait x' is in-fact blocking. Blocking means only one-thing can happen at the time (say, when it keeps firing - it's 'blocking' everything else except that - same like not being able to do anything for 10-25) which isn't helpful either. Doesn't ET have an alternative for 'wait'? Anyway (I understand the log file is the issue - but let's pretend for a moment it wasn't): Second problem is no matter which code language you will use to write script which would search for special text and executing file which will do something as a reaction for it (for example clicking some button which is binded to executing it) you can't execute script from ET you will have to execute it as a different program. ^ This would be easily resolved: bind mouse1 "+attack;echo [script]Attacking!" // Now you could watch for [script]Attacking! messages from the log (if it was updated in real time) . I don't know if it would be possible to make lua script and attach it from player side to the game, coz these script are server side scripts even when ETPro/NQ mods are supporting LUA. Yeah, I'm fairly sure these are server side only. - in logfile there aren't onscreen messages, only this what was in console (usually text about unbalanced teams is displayed on screen) and I don't know if you can switch it to console, I don't think so, coz it also is server side message. You mean CPM & BPM messages? CPM messages are essentially 'echo'd' as for BPM messages I'm not sure - but I wasn't aware that you actually wanted to keep track of those messages the way I suggested was a bit more complicated (as in, the script itselfs keeps track of the amount of players in both teams - on connecting at first, the ET-config would do an '/scores' which the script would parse - and then just keep up.) - script what you will have to create wouldn't be (probably) connected with et game client, but just different program which will affect et game. That's actually the thing now isn't it. The script would not be connected - it wouldn't do anything for the game on its own. My thought was - if the game was to log directly (perhaps there's a setting to flush it's buffer straight to the log-file) then the script could simply parse the log file and write configuration files with the proper instructions. Take for instance a 'now playing' script (i.e. the music you're playing) - it would be extremely simple - You have a music player, you write a plugin for it - the plugin would simply write the Artist & Song title to a file in the following format: say "^1Now Playing: Artist - Song Title" and you'd have a bind, i.e. bind f5 "exec nowplaying.cfg" now every time your music player changes to a new song - the plugin would write a new 'nowplaying.cfg' - and whenever you press f5 - it'd exec the nowplaying.cfg and thereby it would tell everyone on the server what song you're playing. Similar concept here; change team - (script gets from log) get team is full msg - (script) write config - exec it; that's why in my first example I had a 'wait 5' just in case it needed some time. And generally even if first 2 points would be possible to get trough them, with 3rd point it start to be a bit too complicated for normal ET player. Making it just for myself is stupid, if I would create something like that I would share with it with others. But I don't think many people will download additional script to have magnificient class selector script which would work no matter of situation. Right, I wasn't thinking about the normal ET player. I'm not sure why it would be stupid to just make it for yourself - you can always share it if you like. Heck, you could even make a small script - that'll start ET for people and then monitors it's log file! Though - my point here mostly was to give an 'out-of-the-box' solution for a complicated problem (i.e. ET isn't a scripting/programming language - it's just a place where you define things - and have a little bit of flexibility - but that's it). Quote
Sarken Posted August 9, 2015 Author Posted August 9, 2015 (edited) Ahh okay I understand u know. U wanted to know the teams balance all the time. About score thing, I think faster after first teams counting which probably u would do via /score or /players command (second is easier i think) which be just registring "joining Axis/Allies/Spectator" and changing counter (with spectator again /players and parsing). So generally problem is this logfile. I am wondering where this data is kept when et.exe is working and if they can be copied to some .txt file. But I find out another way, don't test it but there is command /condump which saves ur console on ur demand in file of ur choice in mod folder. U can bind this command to one key and make script which will force this binded key to execute /condump and then script will open file and parse text, saves data and change what needs to be changed in cfg files then close file. Lets say bind will be executed in 10s intervals or 5s intervals. There won't be much text so parsing will be really fast and script will update team info per 5/10 seconds. Ofc next condumps commands rewrite file (if name is the same). As I said I don't try this method but I think this work without closing game and I think before it rewrite old file, it first cleaned, if not it would be impossible coz we can end with file containing data from 2 different intervals. What you think? Sorry for my english, but it's late and I am in a hurry. #EDIT: bind would like this: >bind x "players; wait 1; condump file_name" Edited August 9, 2015 by Sarken 1 Quote
Bynke Posted June 24, 2023 Posted June 24, 2023 (edited) On 8/7/2015 at 5:32 PM, Shana said: With class&team selector you could use admin commands to ignore unbalanced teams(ie team has too many players to join). With normal scripts you can join from team to specs then wait for bots to even then go to other team. I recommend checking /scores before changing teams so they are even Here are scripts I'm using right now, feel free to use them bind LEFTARROW "team r 1 3 38;vstr xcls_default;echo ^iAxis" bind RIGHTARROW "team b 1 8 37;class c 3;vstr xcls_default;echo ^dAllies" bind DOWNARROW "team s" bind UPARROW "" bind KP_UPARROW "class m 1;echo ^?M^wedic" bind KP_PGUP "class c 3;echo ^?C^wover-ops ^?G^wrand" bind KP_HOME "class c 1 39;echo ^?C^wover-ops ^?S^wten" bind KP_5 "class f 1;echo ^?F^wield-ops" bind KP_RIGHTARROW "class e 1;echo ^?E^wngi" bind KP_INS "setspawnpt 0; echo ^l.^k>Spawnpoint: ^lDefault" bind KP_END "setspawnpt 1; echo ^l.^k>Spawnpoint: ^l1" bind KP_DOWNARROW "setspawnpt 2; echo ^l.^k>Spawnpoint: ^l2" bind KP_PGDN "setspawnpt 3; echo ^l.^k>Spawnpoint: ^l3" bind KP_ENTER "mp_fireteamadmin" Explanation: leftarrow - join axis as medic with single pistol rightarrow - join allies as medic with single pistol downarrow - join team specorators uparrow - no script there keypad8(kp_uparrow) - medic with pistol keypad9 - covertops with m1grand keypad7 - covertops with sten kp5 - fieldops with thompson kp6 - engineer with thompson kp4 is free kp 0-3 are spawn selects kp0 is default spawnpoint kp1 - 1st sp kp2 - 2nd sp kp3 - 3rd sp kpenter for joining fireteams Every command is set as echo so you'll see in your cpm area only, not in chat/teamchat. If i want a simple spawnselector script. Im sick of having to open the map and choose a spawnpoint. But i want it simple and idealy a toggle with at most two buttons. Maybe the first for team second a toggle spawn 1,2,3,4,5? Maybe like from above beginning at KP_ins would writing this in console work bind F6 "setspawnpt 0; echo ^l.^k>Spawnpoint: ^lDefault" bind KP_END "setspawnpt 1; echo ^l.^k>Spawnpoint: ^l1" bind F7 "setspawnpt 2; echo ^l.^k>Spawnpoint: ^l2" bind KP_PGDN "setspawnpt 3; echo ^l.^k>Spawnpoint: ^l3" Edited June 24, 2023 by Bynke Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.