• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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