• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] Dialog problems

Status
Not open for further replies.
Level 7
Joined
Nov 19, 2007
Messages
253
Hey everyone.. I got this huge problem i made this code:

JASS:
scope duel1on1 initializer i

    globals
        private dialog duelDialog=DialogCreate()
    endglobals
    
    private function duelRequestC takes nothing returns boolean
        call DialogClear(duelDialog)
        call DialogSetMessage(duelDialog,"Choose your opponent:")
        call DialogAddButton(duelDialog,"Button 1",0)
        call DialogDisplay(GetTriggerPlayer(),duelDialog,true)
        return false
    endfunction

    private function i takes nothing returns nothing
        local trigger duelRequest=CreateTrigger()
        local integer index=1
        loop
        exitwhen index>9
            call TriggerRegisterPlayerChatEvent(duelRequest,Player(index),"-duel",true)
        endloop
        call TriggerAddCondition(duelRequest,function duelRequestC)
        set duelRequest=null
    endfunction
    
endscope

Well basicly when player types -duel dialog window should appear with buttons but somehow it doesnt work, game freezes for about 5 seconds and nothing happens. Can anyone tell me whats wrong here?

EDIT:

I fixed the problem somehow loop in i function caused this to stop working. This thread should be closed or deleted.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
you never set index = index + 1 so it causes a thread crash lol because it loops to infinity
 
Status
Not open for further replies.
Top