- Joined
- Nov 30, 2007
- Messages
- 1,202
Basically every other command is ignored. I have to write it twice for it to work.
Here is an example of a executed trigger loaded from the hash.
JASS:
library StringLib
struct Words
string array word[120]
static method create takes string s returns Words
local thistype this = .allocate()
local integer i = 0
local integer j = 0
local integer sLength = StringLength(s)
local string char = ""
set sLength = StringLength(s)
loop
exitwhen i > sLength
set char = SubString(s, i, i + 1)
if char != " " then
set word[j] = word[j] + char
else
set j = j + 1
endif
set i = i + 1
endloop
return this
endmethod
endstruct
endlibrary
private function Main takes nothing returns nothing
local trigger t
local integer i
set chat = GetEventPlayerChatString()
set w = Words.create(chat) // This is probably the reason
if not (SubString(chat, 0, 1) == "-") then
return
endif
set i = StringHash(w.word[0])
if HaveSavedHandle(hash, i, 0) then
set t = LoadTriggerHandle(hash, i, 0)
else
return
endif
if TriggerEvaluate(t) then
call TriggerExecute(t) // Combined with this
endif
call w.destroy() // and this.
set t = null
endfunction
Here is an example of a executed trigger loaded from the hash.
JASS:
private function SetBoard takes nothing returns nothing
local string s = SubString(chat, 7, 8)
local integer i = S2I(w.word[1])
local integer pid = GetPlayerId(GetTriggerPlayer())
if s == "0" then
call msgBoard[pid].addDisplacement(-msgBoard[pid].getDisplacement())
call msgBoard[pid].update()
else
call msgBoard[pid].addDisplacement(i)
call msgBoard[pid].update()
endif
endfunction
Last edited: