absimiliard Posted March 1, 2015 Share Posted March 1, 2015 So I'm running into two issues, the first is pretty simple, just docs, the second is more vexing as I think I'm missing something basic. 1) So I like the construction "for _,v in pairs(AllPlayers) do v:PushEvent('respawnfromghost') end" a lot. Is there a list somewhere of callable PushEvents? Specifically, can I use this to do things like "c_sethunger(1)" via the correct PushEvent, and how could I ID that event? 2) So I can open the console, bring up remote, and then do stuff like spawn or give things, and port around. However when I try "c_listallplayers()" or "TheInput:GetWorldEntityUnderMouse():Remove()" {with my mouse placed over an item on the map, like a Maxwell's light, or a firepit} I get no result. Nothing comes up on the console either in most cases. In some few instances of "c_listallplayers()" I get one return, for myself, once it listed me and one other player but not the other three on the server at the time. Vis a vis #2, all in all it feels very erratic, which makes me think I'm missing something basic. Any suggestions as to what that might be and how to fix it? Link to comment Share on other sites More sharing options...
rezecib Posted March 1, 2015 Share Posted March 1, 2015 @absimiliard, For (1), I know it sounds reasonable to you, but you're basically asking "what are all the things the Lua code can do?". In the specific case you provided, though, you can set player stats like this:for _,v in pairs(AllPlayers) do v.components.hunger:SetPercent(1) endWhich, if you look at scripts/consolecommands.lua, is basically all that c_sethunger(...), etc do. For sanity and health, just change the "hunger" part. For (2), since it's a remote command, it's printing out the information on the dedicated server's console, so you have to read it from there. Although it would be nice to have remote log output, too... If you can't look at that, then you can locally use c_listplayers(), although it prints out a bit too much information. You could use this to pare it down:for k,v in pairs(TheNet:GetClientTable()) do print(k, v.name, v.prefab, v.userid) endAs for removing entities, the easiest method I've found is this:c_select() c_sel():Remove()It has a local function for getting the entity under the remote mouse that you can't call directly, but it gets used by c_select() to set the result of c_sel(). Edit: You might find it helpful to make a very simple mod for yourself that defines custom console commands. For example:GLOBAL.c_rezall = function() --call this with c_rezall() for _,v in pairs(AllPlayers) do v:PushEvent("respawnfromghost") endendGLOBAL.c_remove = function() c_select() c_sel():Remove() endGLOBAL.c_sethungerall = function(percent) for _,v in pairs(AllPlayers) do v.components.hunger:SetPercent(percent) endendIn the modinfo you can make this a client-only mod so it doesn't show up in the mods list and mark your server as modded. (by setting all_clients_require_mod = false, and client_only_mod = true) Link to comment Share on other sites More sharing options...
absimiliard Posted March 1, 2015 Author Share Posted March 1, 2015 @absimiliard, For (1), I know it sounds reasonable to you, but you're basically asking "what are all the things the Lua code can do?". In the specific case you provided, though, you can set player stats like this:for _,v in pairs(AllPlayers) do v.components.hunger:SetPercent(1) endWhich, if you look at scripts/consolecommands.lua, is basically all that c_sethunger(...), etc do. For sanity and health, just change the "hunger" part. Actually sir, or madam, that is EXACTLY what I was looking for. Now I just need to hunt down where consolesommands.lua lives and I can hunt and pick through stuff myself. Thank you. As for the server console, I should have access to viewing it if I can use it, correct? Maybe I just missed that when I hit CTL to dump into the remote I was also getting changed visual input from the console, though that would seem odd for me to miss this game does obsess me at the moment. I was initially nervous about the thought of setting up GLOBALs until you mentioned how I could make them client-only. I want my server to be a dedicated, boring, survival one, just for some fun for now. I just need to test this stuff out, it's cool, and it's up my alley. (and think of the stuff I could do, set up stories with waves of spider-queen invaders by script and rewards for valiant players, it's totally usable) Link to comment Share on other sites More sharing options...
rezecib Posted March 1, 2015 Share Posted March 1, 2015 As for the server console, I should have access to viewing it if I can use it, correct? If you're running the dedicated server on your computer through Steam, it comes up with a console window. I'm not sure about other setups, but when I was administering some of the early Klei dedicated servers I would see it with a remote shell (ssh) connection to the cloud server that was hosting it. Link to comment Share on other sites More sharing options...
absimiliard Posted March 1, 2015 Author Share Posted March 1, 2015 If you're running the dedicated server on your computer through Steam, it comes up with a console window. I'm not sure about other setups, but when I was administering some of the early Klei dedicated servers I would see it with a remote shell (ssh) connection to the cloud server that was hosting it. This is something I rent from someone for around $10/mos. I do have access to the server's local console, via their infrastructure. (a web-site) It just took me half a second to realize it was that console you were talking about. Link to comment Share on other sites More sharing options...
rezecib Posted March 1, 2015 Share Posted March 1, 2015 @absimiliard, To get it to continuously display the log output on there, you have to use this command, if I remember correctly:tail -f /var/log/dontstarve/currentthe location might've changed, though. Link to comment Share on other sites More sharing options...
absimiliard Posted March 2, 2015 Author Share Posted March 2, 2015 I'm not sure they'll actually provide shell access to whatever VM they're running it on. Maybe if I asked and offered a public key to auth against. What they're giving now is just a browser-based console that shows N lines of output, basically until it scrolls off the screen. It's pretty basic, but certainly consumer-friendly. Link to comment Share on other sites More sharing options...
Zheng Posted March 6, 2015 Share Posted March 6, 2015 @absimiliard, For (1), I know it sounds reasonable to you, but you're basically asking "what are all the things the Lua code can do?". In the specific case you provided, though, you can set player stats like this:for _,v in pairs(AllPlayers) do v.components.hunger:SetPercent(1) endWhich, if you look at scripts/consolecommands.lua, is basically all that c_sethunger(...), etc do. For sanity and health, just change the "hunger" part. For (2), since it's a remote command, it's printing out the information on the dedicated server's console, so you have to read it from there. Although it would be nice to have remote log output, too... If you can't look at that, then you can locally use c_listplayers(), although it prints out a bit too much information. You could use this to pare it down:for k,v in pairs(TheNet:GetClientTable()) do print(k, v.name, v.prefab, v.userid) endAs for removing entities, the easiest method I've found is this:c_select() c_sel():Remove()It has a local function for getting the entity under the remote mouse that you can't call directly, but it gets used by c_select() to set the result of c_sel(). Edit: You might find it helpful to make a very simple mod for yourself that defines custom console commands. For example:GLOBAL.c_rezall = function() --call this with c_rezall() for _,v in pairs(AllPlayers) do v:PushEvent("respawnfromghost") endendGLOBAL.c_remove = function() c_select() c_sel():Remove() endGLOBAL.c_sethungerall = function(percent) for _,v in pairs(AllPlayers) do v.components.hunger:SetPercent(percent) endendIn the modinfo you can make this a client-only mod so it doesn't show up in the mods list and mark your server as modded. (by setting all_clients_require_mod = false, and client_only_mod = true)Hello, the code above worked perfectly in remote command window, I'm wondering if it's possible to give somebody else God mode through commands, I've been trying to achieve this Link to comment Share on other sites More sharing options...
DarkXero Posted March 6, 2015 Share Posted March 6, 2015 AllPlayers[x].components.health:SetInvincible(true) -- Godmode: trueAllPlayers[x].components.health:SetInvincible(false) -- Godmode: falsex being the number in the player table. Link to comment Share on other sites More sharing options...
Zheng Posted March 6, 2015 Share Posted March 6, 2015 Also, a quick question: Can I make myself's name disappear from the player list, cause I'm hosting the server Link to comment Share on other sites More sharing options...
Zheng Posted March 6, 2015 Share Posted March 6, 2015 AllPlayers[x].components.health:SetInvincible(true) -- Godmode: trueAllPlayers[x].components.health:SetInvincible(false) -- Godmode: falsex being the number in the player table. Thanks, I found that I can revive myself by giving myself god mode command in game,( c_godemode()) but it seems I can't do so through this code Link to comment Share on other sites More sharing options...
DarkXero Posted March 6, 2015 Share Posted March 6, 2015 The godmode command from consolecommands has a PushEvent("respawnfromghost") and a SetInvincible packaged into into command. Regarding your name disappearance, it's feasible, with mods, but you would have to edit the playerstatusscreen and make the mod mandatory for other players, because you can't edit the client net table that others would be accessing to feed their widgets. So I would say the trouble is very not worth the hassle. Link to comment Share on other sites More sharing options...
JurkerKunde Posted March 6, 2015 Share Posted March 6, 2015 Edit: You might find it helpful to make a very simple mod for yourself that defines custom console commands. For example:GLOBAL.c_rezall = function() --call this with c_rezall() for _,v in pairs(AllPlayers) do v:PushEvent("respawnfromghost") endendGLOBAL.c_remove = function() c_select() c_sel():Remove() endGLOBAL.c_sethungerall = function(percent) for _,v in pairs(AllPlayers) do v.components.hunger:SetPercent(percent) endendIn the modinfo you can make this a client-only mod so it doesn't show up in the mods list and mark your server as modded. (by setting all_clients_require_mod = false, and client_only_mod = true)I tried to make such a mod. It seems like this code doesn't work (anymore?). AllPlayers is always nil. It seems, like it is out of scope in the mod context. At the end, I managed to make it work like this: GLOBAL.c_me = function() local players = GLOBAL.AllPlayers local inst = nil if players then for k,v in ipairs(players) do if v.userid == 'something' and v.name ~= '[Host]' then inst = players[k] end end end return instend Link to comment Share on other sites More sharing options...
JurkerKunde Posted March 6, 2015 Share Posted March 6, 2015 AllPlayers[x].components.health:SetInvincible(true) -- Godmode: trueAllPlayers[x].components.health:SetInvincible(false) -- Godmode: falsex being the number in the player table.Another (and shorter) way of doing this isc_select(c_inst(someguid))) c_godmode()c_select() stores a reference to the instance it selected internally (effectively debug_entity in mainfunctions.lua), which is read by c_godmode(). If it is a player, it will enable godmode on it. Link to comment Share on other sites More sharing options...
Zheng Posted March 6, 2015 Share Posted March 6, 2015 Another (and shorter) way of doing this is c_select(c_inst(someguid))) c_godmode()c_select() stores a reference to the instance it selected internally (effectively debug_entity in mainfunctions.lua), which is read by c_godmode(). If it is a player, it will enable godmode on it. Thank you, I'm fine with the first command though, even though more complex. Do you know how to use command to change the whether? etc. WeatherManager only works in RoG, that's all I know Link to comment Share on other sites More sharing options...
rezecib Posted March 6, 2015 Share Posted March 6, 2015 @Zheng, http://dont-starve-game.wikia.com/wiki/Console/Don%27t_Starve_Together_Commands#World_commands Link to comment Share on other sites More sharing options...
Zheng Posted March 6, 2015 Share Posted March 6, 2015 @Zheng, http://dont-starve-game.wikia.com/wiki/Console/Don%27t_Starve_Together_Commands#World_commandsPlz don't throw this at me, RoG commands don't work at here Link to comment Share on other sites More sharing options...
rezecib Posted March 6, 2015 Share Posted March 6, 2015 @Zheng, Did you actually look at the link and try the commands? Go do it. Link to comment Share on other sites More sharing options...
Zheng Posted March 7, 2015 Share Posted March 7, 2015 @Zheng, Did you actually look at the link and try the commands? Go do it.haha, sorry for that. It seems it has been updated, this is really great! Link to comment Share on other sites More sharing options...
JurkerKunde Posted March 7, 2015 Share Posted March 7, 2015 Thank you, I'm fine with the first command though, even though more complex. Do you know how to use command to change the whether? etc. WeatherManager only works in RoG, that's all I knowThe benefit of my approach is that this function toggles godmode, so you dont have to keep track of the state for yourself. Which may be a downside, too Plus: If the player has died (aka is a ghost), it will resurrect the player and set the health, hunger and sanity of the player to 1. Link to comment Share on other sites More sharing options...
Zheng Posted March 7, 2015 Share Posted March 7, 2015 how about locating a player's position coordinates Link to comment Share on other sites More sharing options...
DarkXero Posted March 7, 2015 Share Posted March 7, 2015 print(AllPlayers[x].Transform:GetWorldPosition()) Link to comment Share on other sites More sharing options...
Zheng Posted March 8, 2015 Share Posted March 8, 2015 Emm, there are so many interesting things going on with commands. I'm just curious can I talk to players through commands without getting into the game? Link to comment Share on other sites More sharing options...
DarkXero Posted March 8, 2015 Share Posted March 8, 2015 You can use:c_announce("Hello everybody")To make messages appear on top of the screen. To make chat messages appear, you can try:TheNet:Say("Message in chat", false)false because I don't know what would happen by whispering, talk to guys close to spawn where you should be right before spawning? Link to comment Share on other sites More sharing options...
Zheng Posted March 8, 2015 Share Posted March 8, 2015 You can use:c_announce("Hello everybody")To make messages appear on top of the screen. To make chat messages appear, you can try:TheNet:Say("Message in chat", false)false because I don't know what would happen by whispering, talk to guys close to spawn where you should be right before spawning?Thank you, can you also tell me how to move things around. For example, I want to move an item to my base in the world, I think it would be like the items's prefab and the location's prefab, I need the code to connect them Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.