saithan
September 23rd, 2010, 04:22
This is a little manipulation i made and found it to be helpful to GMs.
This allows the GM(host) to place a modifier +# or -# up to 999 to any player connected to the host.
first you will want to edit your chat_entry.lua by locating the onDeliverMessage function then just above the return massagedata; add:
if not User.isHost() then
local test1 = string.sub(messagedata.text, 1,5);
if string.find(test1,"%a") then
--do nothing passing it to screen
else
if string.match(test1,"%^%-%d+")or string.match(test1,"%^%+%d+")then
messagedata.text = " "..messagedata.text
end
end
end
next you want to open the chatmanager.lua and locate the processWhisper function. pay attention to where the ishost condition ends (around line 146) you will see:
local msg = {};
msg.font = "msgfont";
msg.text = params;
after that add:
local test1 = string.sub(msg.text, 1,5);
if string.match(test1,"%^%-%d+")or string.match(test1,"%^%+%d+")then
msg.text = " "..msg.text
end
next you will open chat_chat.lua
look for onReceiveMessage function (if it is not there then we will need to add it.
function onReceiveMessage(messagedata)
local test1 = string.sub(messagedata.text, 1,5);
local modnum ="";
if string.find(test1,"%a") or string.find(messagedata.text,"%s") then
--do nothing passing tothe screen
else
if string.match(test1,"%^%-%d+")or string.match(test1,"%^%+%d+")then
modnum = string.sub(test1,2);
ModifierStack.setFreeAdjustment(tonumber(modnum));
return true;
end
end
end
then the GM can simply apply a modifier to a player by typing as example:
^+5
then drag it to that players portrait or enter that into the chat to globally apply that modifier to all connected players (including host).
special thanks to Oberoten and DrZuess for their invaluable help.
This allows the GM(host) to place a modifier +# or -# up to 999 to any player connected to the host.
first you will want to edit your chat_entry.lua by locating the onDeliverMessage function then just above the return massagedata; add:
if not User.isHost() then
local test1 = string.sub(messagedata.text, 1,5);
if string.find(test1,"%a") then
--do nothing passing it to screen
else
if string.match(test1,"%^%-%d+")or string.match(test1,"%^%+%d+")then
messagedata.text = " "..messagedata.text
end
end
end
next you want to open the chatmanager.lua and locate the processWhisper function. pay attention to where the ishost condition ends (around line 146) you will see:
local msg = {};
msg.font = "msgfont";
msg.text = params;
after that add:
local test1 = string.sub(msg.text, 1,5);
if string.match(test1,"%^%-%d+")or string.match(test1,"%^%+%d+")then
msg.text = " "..msg.text
end
next you will open chat_chat.lua
look for onReceiveMessage function (if it is not there then we will need to add it.
function onReceiveMessage(messagedata)
local test1 = string.sub(messagedata.text, 1,5);
local modnum ="";
if string.find(test1,"%a") or string.find(messagedata.text,"%s") then
--do nothing passing tothe screen
else
if string.match(test1,"%^%-%d+")or string.match(test1,"%^%+%d+")then
modnum = string.sub(test1,2);
ModifierStack.setFreeAdjustment(tonumber(modnum));
return true;
end
end
end
then the GM can simply apply a modifier to a player by typing as example:
^+5
then drag it to that players portrait or enter that into the chat to globally apply that modifier to all connected players (including host).
special thanks to Oberoten and DrZuess for their invaluable help.