Management gaoesa Posted October 24, 2012 Management Share Posted October 24, 2012 It will be fixed in 0.6.1. The missing parameters are stripped from the command line if not given in the command. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted October 24, 2012 Author Share Posted October 24, 2012 Wow, that was fast! Thanks for looking into it! Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted October 29, 2012 Author Share Posted October 29, 2012 I found another area giving me problems in the admin commands with Lua. It seems like it is not possible to send text with spaces as a single parameter (even enclosing the text in quotes). Instead, the game uses the part after the space as the next parameter and seems to bump all the parameters to the next one. Here is a situation where this behavior would be pretty troublesome. Using the example of !sayname that we have been using, if the target player is named "a i" or similar, you probably wouldn't be able to target that player because passing 'a' or 'i' as the partial name will almost certainly give multiple results. In this case, it would be important to be able to pass ""a i"" as a parameter. Is this because the command line cannot read the quotation marks or is it that they are stripped from the command line when passed to the function? Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted November 4, 2012 Management Share Posted November 4, 2012 The quotes disappear when the custom commands are parsed in from the shrubbot.cfg. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 5, 2012 Author Share Posted November 5, 2012 Thanks for looking into it! Would you be able to fix that behavior so we can use quotes to allow spaces in arguments? I just tested how arguments are handled using et_ClientCommand() and the quotes work perfectly to allow spaces in the argument. I also discovered that arguments can begin or end with a space (or multiple spaces) as well. I feel that the shrubbot commands should behave in the same way. Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted November 5, 2012 Management Share Posted November 5, 2012 Yes. This will be fixed. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 5, 2012 Author Share Posted November 5, 2012 Alright, thanks! I'm looking forward to it! Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 12, 2012 Author Share Posted November 12, 2012 What's the best way to detect if a client is connected to a slot? Currently, I'm getting the silEnT guid using et.gentity_get(slot, "sess.guid") and checking that its length is greater than 0. However, I think there is another bug related to this. Occasionally, a client will disconnect, but I can still pull all of their gclient information from the slot number as if they are still on the server. This makes my current method somewhat unreliable at the moment. It doesn't happen very often (maybe once every 40 disconnects or so). When it does occur, it seems to last until the next map is loaded or until another player connects to the affected slot. Perhaps it's related to a client disconnecting using a more unconventional method? I'll try to do some more testing tonight to see if I can further pinpoint what is causing it. Quote Link to comment Share on other sites More sharing options...
Sol Posted November 12, 2012 Share Posted November 12, 2012 However, I think there is another bug related to this. Occasionally, a client will disconnect, but I can still pull all of their gclient information from the slot number as if they are still on the server.Yes, this is bug indeed probably related with zombie_time/timeout that Disconnect callback is not executed sometimes. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 12, 2012 Author Share Posted November 12, 2012 Do you know of another way to detect if a client is connected that could avoid the bug in the meantime until it's fixed? When it happens, I am pretty sure that the disconnected player doesn't show up in the built-in tab menu/scoreboard. Quote Link to comment Share on other sites More sharing options...
Sol Posted November 12, 2012 Share Posted November 12, 2012 (edited) et.gentity_get(slot, "ps.ping") < 999 and et.gentity_get(slot, "ps.ping") > 0 seems good Edited November 12, 2012 by Sol Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted November 13, 2012 Management Share Posted November 13, 2012 Yes, this is bug indeed probably related with zombie_time/timeout that Disconnect callback is not executed sometimes. Incorrect. The client data is cleared when new clients connect. The Lua does not check if the player is connected or not when accessing the data. You can check if "pers.connected" has exact value "2". et.gentity_get(slot, "pers.connected") Maybe this is a place to extend the Lua a bit. With a new function for checking the clientnumber. Additional info could be if the client is bot also. I don't think that that information is available anywhere. Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted November 13, 2012 Management Share Posted November 13, 2012 Ok. I reread and sol was talking about the script not getting the ClientDisconnected callback. If that is the case, then the "pers.connected" would have wrong information also. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 13, 2012 Author Share Posted November 13, 2012 et.gentity_get(slot, "ps.ping") < 999 and et.gentity_get(slot, "ps.ping") > 0 seems good This is why we should have the gentity fields documented somewhere. Creative solution! Incorrect. The client data is cleared when new clients connect. The Lua does not check if the player is connected or not when accessing the data. Are you saying that the client data is intended to be accessible after a client disconnect? Any clue why it is only sometimes but not often? You can check if "pers.connected" has exact value "2". et.gentity_get(slot, "pers.connected") This is exactly what I was looking for! Thanks! Maybe this is a place to extend the Lua a bit. With a new function for checking the clientnumber. Additional info could be if the client is bot also. I don't think that that information is available anywhere. I'm all for any additions to the lua api. It is a lot more powerful than I initially imagined. I've had a lot of fun learning it! Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 13, 2012 Author Share Posted November 13, 2012 Ok. I reread and sol was talking about the script not getting the ClientDisconnected callback. If that is the case, then the "pers.connected" would have wrong information also. I'll add a debug line in my script to see what value for pers.connected is returned next time I encounter the bug. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 13, 2012 Author Share Posted November 13, 2012 I was wrong. No matter how a person disconnects, the gclient information stays available until another player uses the slot or the map is restarted. I just didn't notice that it was always happening because we had a lot of people shuffling in and out of the server when I was testing the behavior. Luckily, pers.connected does show the correct number... 2 when a player is connected and 0 after they disconnect. This will be fine for my purpose, but is this the intended behavior? I would think that the info would clear when a player disconnects from the server. Perhaps the intent was for players that disconnect and reconnect right away (maybe during disconnected downloads or something)? Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted November 13, 2012 Management Share Posted November 13, 2012 Perhaps the intent was for players that disconnect and reconnect right away (maybe during disconnected downloads or something)? I don't know the intent. This is how it has been in the original source as well. But one reason for this could be that it is easy to ensure everything is cleared when new client connects. This is why we should have the gentity fields documented somewhere. Creative solution! I have added the bone of the Lua document to the Wiki. It is intended to be a complete reference of the Lua API for silEnT mod. I would give you the permissions to the Wiki if I knew how. For adding documentation and fixing English. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 13, 2012 Author Share Posted November 13, 2012 I don't know the intent. This is how it has been in the original source as well. But one reason for this could be that it is easy to ensure everything is cleared when new client connects.Since pers.connected is updated with the disconnect (I noticed that sess.sessionTeam changes as well), I would guess that it would be easy to clear all the info at that time. Although, this shouldn't be a problem as long as pers.connected continues to be reliable. I have added the bone of the Lua document to the Wiki. It is intended to be a complete reference of the Lua API for silEnT mod. I would give you the permissions to the Wiki if I knew how. For adding documentation and fixing English.Awesome! I skimmed over it and it looks like you have a great start! As for the permissions, my guess is somebody will have to create a wiki account for me since it doesn't seem to use the forum account (says my username isn't registered). I'd definitely love to help out on it if you can figure it out! Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 14, 2012 Author Share Posted November 14, 2012 Is there a way to modify the map game rules through lua (such as wm_axis_respawntime and wm_allied_respawntime)? I would like to be able to modify the spawntimes while the map is in progress and using the g_redlimbotime and g_bluelimbotime cvars only allow you to modify the times during the InitGame callback. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 16, 2012 Author Share Posted November 16, 2012 Is there a way to modify the map game rules through lua (such as wm_axis_respawntime and wm_allied_respawntime)? I would like to be able to modify the spawntimes while the map is in progress and using the g_redlimbotime and g_bluelimbotime cvars only allow you to modify the times during the InitGame callback. Anybody? I would have thought that there would be a way to modify the times through the server console, but I am having a hard time finding any info on how to do this online. If it isn't currently possible, would the silEnT devs consider adding a function to be able to modify these types of variables to the lua api? I'll give a little background on what I am working on. I'm trying to use lua to decrease the limbo times of every map by a universal factor. I want it so we don't need to use customized mapscripts every time we add new maps to the server (especially, since we tend to cycle our maps quite a bit). Modifying the g_redlimbotime and g_bluelimbotime cvars during the InitGame callback works great except for maps that change the limbo times in the mapscript for objectives such as building a CP. I would like to be able to decrease those objective modified times as well to keep everything consistent. Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted November 16, 2012 Management Share Posted November 16, 2012 Sorry, I started looking this but forgot it. Indeed these values can't be changed from rcon. For some reason these cvars are latched. However, it is possible using et.trap_Cvar_Set function. Using the g_redlimbotime and g_bluelimbotime works. Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted November 17, 2012 Management Share Posted November 17, 2012 Additionally if you want to override the script defined spawn times, the g_userAxisRespawnTime and g_userAlliedRespawnTime will do that. Thoe spawn times are set always when the scrip attempts to change the spawn times. If they are set to above 1. These cvars use seconds, not milliseconds unlike the g_redlimbotime and g_bluelimbotime. I'm not really sure what you're trying to do. But if you want to make it dynamic, then there is no way to know the original times after they are changed. I.e. you need to save the original times in the script. However, if the mapscript changes the time to the value you have set yourself, there is no way to know it has done that and then the re-adjustment would perhaps not trigger. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted November 28, 2012 Author Share Posted November 28, 2012 Sorry, I started looking this but forgot it. Indeed these values can't be changed from rcon. For some reason these cvars are latched. However, it is possible using et.trap_Cvar_Set function. Using the g_redlimbotime and g_bluelimbotime works. You where correct. I had a bug in my code that was making it appear like this wasn't possible. I've fixed it now and it works perfectly. Thanks gaoesa! Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted December 18, 2012 Author Share Posted December 18, 2012 Is there a way to get a client cvar value through lua (similar to cvarvalue = et.trap_Cvar_Get( cvarname ))? I didn't see a dedicated command, so perhaps it can be done through et.trap_SendConsoleCommand( when, command )? What I would like to do is allow clients to configure some settings related to lua scripts I am writing. I figure that the client setting some cvars for configuration and having the lua script read them would be a good way to do this. Quote Link to comment Share on other sites More sharing options...
JvIasterMind Posted December 21, 2012 Author Share Posted December 21, 2012 (edited) Anybody know the answer? I tried searching to see if you can get client cvar values through rcon and haven't had any luck. It seems that rcon is not documented very well in the ET community since many of the sites that used to be good are offline now. If it isn't currently possible, maybe it would be a good feature to add to the lua api. One thing to consider, however, is do you think that being able to read all cvars could potentially pose a little bit of a security risk for clients if they have there private password or rcon password set on there command line in their ET shortcut? If that's the case, a couple solutions could be to read all cvars starting with "lua_" or just keep any security related cvars disabled. Otherwise, it would be pretty useful in some cases for lua to be able to read all cvars. An example of this could be on a limited lives server, lua could display a message to any client (shortly after connecting to the server) that has cg_instanttapout set to 0, to change it to 1 if they don't want to see the limited lives popup menu. Additionally, this message could even be shown right after a player dies and they see the menu for the first time! The main way I want to use it currently is to have some configuration options available to the clients. For example, I am working on a script that plays custom sounds on our server. I would like to give the client the option to disable this functionality if they do not want to hear them. The way I am currently planning on doing this is to allow the clients to set a custom cvar such as playsound_disable, so they can just add the line "set playsound_disable "1"" to their config if they want them disabled on our server. This would be excellent functionality because setting cvars is mostly common knowledge in the ET community, and I would be able to avoid workarounds such as having to make players execute a custom command and recording the preference in some type of data file on the server. Edited December 21, 2012 by JvIasterMind Quote Link to comment Share on other sites More sharing options...
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.