/slap 5
/slap 5
I'd like to add slap command and slay command to a automod (savefile).
Is there a way to capture messages from chat?
eg. /slap 5 /slap 30 /slap d /slay
slap would be a few teleportations.
Is there a way to capture messages from chat?
eg. /slap 5 /slap 30 /slap d /slay
slap would be a few teleportations.
Re: /slap 5
For 0.15 you can register your own console commands in mods.
If you want to get ahold of me I'm almost always on Discord.
-
- Long Handed Inserter
- Posts: 71
- Joined: Mon Oct 17, 2016 10:33 am
- Contact:
Re: /slap 5
Will this be available in scenarios? Or will it have to be registered in the data section?Rseding91 wrote:For 0.15 you can register your own console commands in mods.
Re: /slap 5
It's done the same way custom events are done now.Articulating wrote:Will this be available in scenarios? Or will it have to be registered in the data section?Rseding91 wrote:For 0.15 you can register your own console commands in mods.
If you want to get ahold of me I'm almost always on Discord.
- cpeosphoros
- Inserter
- Posts: 40
- Joined: Fri Dec 23, 2016 10:57 pm
- Contact:
Re: /slap 5
Nice!Rseding91 wrote:It's done the same way custom events are done now.Articulating wrote:Will this be available in scenarios? Or will it have to be registered in the data section?Rseding91 wrote:For 0.15 you can register your own console commands in mods.
Re: /slap 5
Can mods write to chat/console? And read any text from it?Rseding91 wrote:For 0.15 you can register your own console commands in mods.
Re: /slap 5
Write: yes - player.print()darkfrei wrote:Can mods write to chat/console? And read any text from it?Rseding91 wrote:For 0.15 you can register your own console commands in mods.
Read: no - why would you want to read from the console? It's going to be boring player conversation 99% of the time or localized string keys: "item-name.copper-ore".
If you want to get ahold of me I'm almost always on Discord.
Re: /slap 5
Maybe he want to check if the last message starts with "slap". If so, then phase the number next to it as the slap count. So this will allow custom slap count other than the registered numbers.Rseding91 wrote:Write: yes - player.print()darkfrei wrote:Can mods write to chat/console? And read any text from it?Rseding91 wrote:For 0.15 you can register your own console commands in mods.
Read: no - why would you want to read from the console? It's going to be boring player conversation 99% of the time or localized string keys: "item-name.copper-ore".
I have a similar idea too before.
Re: /slap 5
For now I added an extra console under a top button.
Code: Select all
function gui_send_command(player)
local textbox = player.gui.left["sl-extended-frame"]["sl-extended-frame-a"]["sl-extended-input-text"]
local text = trim(textbox.text)
local split = splitString(text, nil)
if split[1] == "/slap" then
if game.players[split[2]] then
if game.players[split[2]].connected then
local amount = tonumber(split[3])
if amount and amount > 0 and amount <= 25 then
startSlapping(game.players[split[2]], player, amount)
else
startSlapping(game.players[split[2]], player, SLAP_DEFAULT_AMOUNT)
end
else
slSays(player, game.players[split[2]].name .. " is not online")
end
else
slSays(player, "Player not found")
end
elseif split[1] == "/commands" or split[1] == "/command" then
slShowCommandsText(player)
elseif split[1] == "/up" then
slShowUpText(player)
elseif split[1] == "/host" then
slShowHostText(player)
elseif split[1] == "/online" then
slShowOnlineText(player)
elseif split[1] == "/afk" then
slShowAfkText(player)
else
slSays(player, "Unknown command: /commands for all commands")
end
textbox.text = ""
end
Re: /slap 5
That's great ! :dRseding91 wrote:For 0.15 you can register your own console commands in mods.
Will the custom commands be available to all clients even with the "commands for admin only" ?Rseding91 wrote: Read: no - why would you want to read from the console? It's going to be boring player conversation 99% of the time or localized string keys: "item-name.copper-ore".
Parsing the chat is typically how modders implement their built-it permission / right management system and custom commands (often starting with "!", i'm thinking of GoldSrc/Source engine games or minecraft) as chat is available to anyone. This way you keep the native commands limited to admins yet you provide commands (or even "evolved" command-line menus) to everyone.
With this and remote calls, one could build a powerful and flexible permission system.
-
- Long Handed Inserter
- Posts: 71
- Joined: Mon Oct 17, 2016 10:33 am
- Contact:
Re: /slap 5
Consider the /evolution or /time commands, they are commands that are open to anyone. I assume that these custom commands will fire for anybody and it will be up to the modders to check player.admin if the command is for admins only, as this is a more flexible solution in several ways.
Re: /slap 5
I am pretty sure it will be up to the modder to check for .admin or a mod stored list of people allowed in their code.LotA wrote:Will the custom commands be available to all clients even with the "commands for admin only" ?
Re: /slap 5
I disagree.Articulating wrote:Consider the /evolution or /time commands, they are commands that are open to anyone. I assume that these custom commands will fire for anybody and it will be up to the modders to check player.admin if the command is for admins only, as this is a more flexible solution in several ways.
A permission system allow to manage different rights to different people, and even groups if needed.
the .admin boolean checks your are an "server admin" but you might want to give "random" people access to some customs commands while not allowing them to use /kick or anything "sensitive".
Re: /slap 5
LotA wrote:I disagree.Articulating wrote:Consider the /evolution or /time commands, they are commands that are open to anyone. I assume that these custom commands will fire for anybody and it will be up to the modders to check player.admin if the command is for admins only, as this is a more flexible solution in several ways.
A permission system allow to manage different rights to different people, and even groups if needed.
the .admin boolean checks your are an "server admin" but you might want to give "random" people access to some customs commands while not allowing them to use /kick or anything "sensitive".
The mod could keep a list of power-users.
Re: /slap 5
You can do that in a mod already. (simplified a bit but..)LotA wrote:I disagree.Articulating wrote:Consider the /evolution or /time commands, they are commands that are open to anyone. I assume that these custom commands will fire for anybody and it will be up to the modders to check player.admin if the command is for admins only, as this is a more flexible solution in several ways.
A permission system allow to manage different rights to different people, and even groups if needed.
the .admin boolean checks your are an "server admin" but you might want to give "random" people access to some customs commands while not allowing them to use /kick or anything "sensitive".
Code: Select all
global.allowed_because_permissions = {["Nexela"]=true ["LotA"]=true}
local allowed_players = function(player_index) return game.players[player_index].admin or (global.allowed_because_permissions[game.players[player_index].name) end
script.on_event("my_custom_command", function (event) if allowed_players(event.player_index) then dostuffhere end end
Re: /slap 5
A question came into my mind: what will happen if more than one mods registered the same command? Are they both triggered when user enter the command?
Re: /slap 5
It errors the same way as if you try to have 2 mods register the same remote interface.Mooncat wrote:A question came into my mind: what will happen if more than one mods registered the same command? Are they both triggered when user enter the command?
If you want to get ahold of me I'm almost always on Discord.
-
- Long Handed Inserter
- Posts: 71
- Joined: Mon Oct 17, 2016 10:33 am
- Contact:
Re: /slap 5
Exactly, that's why commands should be open to anyone and the mod should have to discern who is allowed or who isn't.LotA wrote:I disagree.Articulating wrote:Consider the /evolution or /time commands, they are commands that are open to anyone. I assume that these custom commands will fire for anybody and it will be up to the modders to check player.admin if the command is for admins only, as this is a more flexible solution in several ways.
A permission system allow to manage different rights to different people, and even groups if needed.
the .admin boolean checks your are an "server admin" but you might want to give "random" people access to some customs commands while not allowing them to use /kick or anything "sensitive".