- Joined
- Feb 23, 2007
- Messages
- 1,030
JASS:
scope AddChatMessage
globals
multiboard array MB [11]
integer MB_COUNTER = 0
force ALL_PLAYERS = CreateForce()
string TEMP_STRING
boolean TEMP_BOOLEAN
integer TEMP_INTEGER
player TEMP_PLAYER
string array MB_STRINGS [11][9]
integer array MB_CHATSIZE [11]
endglobals
private function UpdateMultiboard takes nothing returns nothing
local integer p = GetPlayerId(GetEnumPlayer())
local integer a = 0
if (IsPlayerAlly(Player(p), TEMP_PLAYER) == true) or (TEMP_BOOLEAN == true) or (Player(p) == TEMP_PLAYER) then
loop
call MultiboardSetItemValue(MultiboardGetItem(MB, a, 0), MB_STRINGS[a + 1])
set MB_STRINGS[a] = MB_STRINGS[a + 1]
set a = a + 1
exitwhen a >= MB_CHATSIZE - 1
endloop
if Player(p) != TEMP_PLAYER then
set MB_STRINGS[a] = "[|cffff9200" + GetPlayerName(TEMP_PLAYER) + "|r] " + TEMP_STRING
elseif TEMP_BOOLEAN == true then
set MB_STRINGS[a] = "[|cffff0000Allies|r]: " + TEMP_STRING
else
set MB_STRINGS[a] = "[|cff6464ffAllies|r]: " + TEMP_STRING
endif
call MultiboardSetItemValue(MultiboardGetItem(MB, a, 0), MB_STRINGS[a])
endif
endfunction
private function Actions takes nothing returns nothing
local string s = GetEventPlayerChatString()
if SubString(s, 0, 1) == "+" then
if SubString(s, 1, 2) == "+" then
set TEMP_BOOLEAN = true
set TEMP_STRING = SubString(s, 2, StringLength(s))
else
set TEMP_BOOLEAN = false
set TEMP_STRING = SubString(s, 1, StringLength(s))
endif
set TEMP_PLAYER = GetTriggerPlayer()
call ForForce(ALL_PLAYERS, function UpdateMultiboard)
endif
set s = null
endfunction
//===========================================================================
function InitTrig_AddChatMessage takes nothing returns nothing
set gg_trg_AddChatMessage = CreateTrigger()
call TriggerAddAction(gg_trg_AddChatMessage, function Actions)
endfunction
endscope
The problem is, whenever I type something with "++" in front of it, the next thing I type erases it.
I attached an image that shows the problem.
Attachments
Last edited: