HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

HELP: "Fatal Error" through custom script: loop

04-21-2006, 09:23 PM#1
MasterofSickness
I'm trying to make a multiboard, but already in the beginning I have the problem, that although the editor saves the map without showing an error, I get one when I play the map...
When I don't run the trigger, the map also runs fine.
So here is the trigger code (sorry, but it's a german editor!) :

Trigger:
MultiboardErstellen
Ereignisse
Bedingungen
Collapse Aktionen
Custom script: local integer udg_Integer_loop=1
Custom script: loop
Custom script: exitwhen udg_Integer_loop>12
Spiel - Display to (All players) the text: (String(Integer_Counter[7]))
If (((Player(Integer_loop)) slot status) Gleich Spielt) then do (Set Integer_Counter[7] = (Integer_Counter[7] + 1)) else do (Do nothing)
Set Integer_loop = (Integer_loop + 1)
Custom script: endloop
Spiel - Display to (All players) the text: (String(Integer_Counter[7]))

(The integer "Integer_Counter[7]" is a normal integer array I assigned in the Initialisations as set to 0)
Hope you can help me any further.
Need more infos about the error? No prob, just ask please.
04-21-2006, 09:27 PM#2
Earth-Fury
why not jsut use the GUI action that loops throgh players? Why use a JASS loop? =/ (when using GUI..)
04-21-2006, 09:40 PM#3
MasterofSickness
I'm not good enough to write triggers completly in jass, but where it is possible for me and where it makes sense I use custom scripts.
I thought it would be better to use loops through custom scripts then the For each integer A / B, because this is a global variable and I want to make it with local variables...
Can you give me a suggestion of what the error can be?

And thx for the fast answer!
04-21-2006, 09:47 PM#4
Blade.dk
Can you convert the trigger to JASS (without changing anything) and then post it here? It would be easier to help for people who don't know German, or the german GUI function names.
04-21-2006, 09:53 PM#5
Earth-Fury
Quote:
Originally Posted by MasterofSickness
I'm not good enough to write triggers completly in jass, but where it is possible for me and where it makes sense I use custom scripts.
I thought it would be better to use loops through custom scripts then the For each integer A / B, because this is a global variable and I want to make it with local variables...
Can you give me a suggestion of what the error can be?

And thx for the fast answer!

If you can use the GUI and understand JASS enogh to make a proper loop, then you can code enterly in JASS. Its a bit more difficult then GUI, because you have to type it instead of clicking to generate it, but its just better >_>

If you can use the GUI, you can code in JASS.
04-21-2006, 09:54 PM#6
MasterofSickness
@ Blade.dk
Ah, right, I already thought of something like that!
So the same in JASS:

Collapse JASS:
function Trig_MultiboardErstellen_Func005001 takes nothing returns boolean
    return ( GetPlayerSlotState(ConvertedPlayer(udg_Integer_loop)) == PLAYER_SLOT_STATE_PLAYING )
endfunction

function Trig_MultiboardErstellen_Actions takes nothing returns nothing
    local integer udg_Integer_loop=1
    loop
    exitwhen udg_Integer_loop>12
    call DisplayTextToForce( GetPlayersAll(), I2S(udg_Integer_Counter[7]) )
    if ( Trig_MultiboardErstellen_Func005001() ) then
        set udg_Integer_Counter[7] = ( udg_Integer_Counter[7] + 1 )
    else
        call DoNothing(  )
    endif
    set udg_Integer_loop = ( udg_Integer_loop + 1 )
    endloop
    call DisplayTextToForce( GetPlayersAll(), I2S(udg_Integer_Counter[7]) )
endfunction

//===========================================================================
function InitTrig_MultiboardErstellen takes nothing returns nothing
    set gg_trg_MultiboardErstellen = CreateTrigger(  )
    call TriggerAddAction( gg_trg_MultiboardErstellen, function Trig_MultiboardErstellen_Actions )
endfunction

EDIT: Jass-code is NOW the exactly same as shown at the very beginning of the thread.
04-21-2006, 10:17 PM#7
MasterofSickness
@ Earth-Fury
Yeah, it is properly much better to write in jass, but then I have to learn that in a way too (it's a change in editing)... I mean I already learned a lot of things for warcaft 3 (I also made own animated models), but someday I want to finish my map, and for now I'm working for already arround 3 years at one map idea, and I want to come to an end ...
04-21-2006, 10:22 PM#8
Earth-Fury
Collapse JASS:
function Trig_MultiboardErstellen_Actions takes nothing returns nothing
    local integer i = 1
    loop
    exitwhen i > 12
        call DisplayTextToForce( GetPlayersAll(), I2S(udg_Integer_Counter[7]) )
        
        if ( GetPlayerSlotState(ConvertedPlayer(i)) == PLAYER_SLOT_STATE_PLAYING ) then
        set udg_Integer_Counter[7] = ( udg_Integer_Counter[7] + 1 )
        else
           call DoNothing(  )
        endif
    
    set i = ( i + 1 )
    endloop
    call DisplayTextToForce( GetPlayersAll(), I2S(udg_Integer_Counter[7]) )
endfunction

//===========================================================================
function InitTrig_MultiboardErstellen takes nothing returns nothing
    set gg_trg_MultiboardErstellen = CreateTrigger(  )
    call TriggerAddAction( gg_trg_MultiboardErstellen, function Trig_MultiboardErstellen_Actions )
endfunction

Parses sucsessfully in jasscraft.

Quote:
Originally Posted by MasterofSickness
@ Earth-Fury
Yeah, it is properly much better to write in jass, but then I have to learn that in a way too (it's a change in editing)... I mean I already learned a lot of things for warcaft 3 (I also made own animated models), but someday I want to finish my map, and for now I'm working for already arround 3 years at one map idea, and I want to come to an end ...

You know basic programing, you knwo basic JASS syntax... downlaod jasscraft and use the built in function library and code templates... You have no valid excuse for not learning JASS, unless you have a mere 20 minutes a week to work on your map. if thats the case, stop playing WC3 and relax for a bit >_>
04-21-2006, 10:32 PM#9
MasterofSickness
It feels like a feeling of stupidity overwhelms me...
I mean, the WE also announces no problems.
It is "only" the game which quits with an Fatal error.

Perhaps the mistake lies in the way I trigger my trigger?

-> I trigger it namely from another trigger which has the event:
Dialog - A dialog button is clicked for ...
And then later in it I use the trigger command:
Trigger - Run MultiboardErstellen <gen> (checking conditions)


Can there be a connection?
I don't know how to solve this...
04-21-2006, 10:33 PM#10
Earth-Fury
post that trigger.
Edit: in GUI AND JaSS please =) (i still use the GUI allot to format rough code, and it just reads easyer ^^)
04-21-2006, 10:40 PM#11
Blade.dk
The variable is not the same in the function generated that is the top of the script, it is not the global one there, that might be the problem.

The problem is in this function:

Collapse JASS:
function Trig_MultiboardErstellen_Func005001 takes nothing returns boolean
    return ( GetPlayerSlotState(ConvertedPlayer(udg_Integer_loop)) == PLAYER_SLOT_STATE_PLAYING )
endfunction

You will need jass to do this so it works, I think this is the problem.
04-21-2006, 10:41 PM#12
MasterofSickness
Ok, thanks for staying tough
So here is the trigger which triggers the above one (it's a lttle bit longer!):

1) In GUI:
Trigger:
MenueAuswahl
Collapse Ereignisse
Dialog - A dialog button is clicked for Temp_Dialog_Array[1]
Bedingungen
Collapse Aktionen
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Bedingungen
(Clicked dialog button) Gleich Temp_DialogButton_Array[1]
Collapse 'THEN'-Aktionen
Video - Einblenden over 3.00 seconds using texture Schwarze Maske and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Wait 7.50 game-time seconds
Video - Turn off letterbox mode (show interface) for (All players): fade in over 2.00 seconds
Wait 3.00 game-time seconds
Wait 1.00 game-time seconds
Auslöser - Run MultiboardErstellen <gen> (checking conditions)
Wait 3.00 game-time seconds
Wait 0.50 game-time seconds
Wait 1.00 game-time seconds
-------- Nächster Auslöser --------
If (Integer_LebenMom[1] Ungleich 0) then do (Auslöser - Run WSpawner <gen> (checking conditions)) else do (Do nothing)
If (Integer_LebenMom[2] Ungleich 0) then do (Auslöser - Run OSpawner <gen> (checking conditions)) else do (Do nothing)
Wait 3.00 game-time seconds
'ELSE'-Aktionen
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Bedingungen
(Clicked dialog button) Gleich Temp_DialogButton_Array[2]
Collapse 'THEN'-Aktionen
Auslöser - Run Intro <gen> (checking conditions)
'ELSE'-Aktionen

2) In JASS:
Collapse JASS:
function Trig_MenueAuswahl_Func001Func011001 takes nothing returns boolean
    return ( udg_Integer_LebenMom[1] != 0 )
endfunction

function Trig_MenueAuswahl_Func001Func012001 takes nothing returns boolean
    return ( udg_Integer_LebenMom[2] != 0 )
endfunction

function Trig_MenueAuswahl_Func001C takes nothing returns boolean
    if ( not ( GetClickedButtonBJ() == udg_Temp_DialogButton_Array[1] ) ) then
        return false
    endif
    return true
endfunction

function Trig_MenueAuswahl_Func002C takes nothing returns boolean
    if ( not ( GetClickedButtonBJ() == udg_Temp_DialogButton_Array[2] ) ) then
        return false
    endif
    return true
endfunction

function Trig_MenueAuswahl_Actions takes nothing returns nothing
    if ( Trig_MenueAuswahl_Func001C() ) then
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 3.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 100.00, 100.00, 100.00, 0 )
        call PolledWait( 7.50 )
        call ShowInterfaceForceOn( GetPlayersAll(), 2.00 )
        call PolledWait( 3.00 )
        call PolledWait( 1.00 )
        call ConditionalTriggerExecute( gg_trg_MultiboardErstellen )
        call PolledWait( 3.00 )
        call PolledWait( 0.50 )
        call PolledWait( 1.00 )
        // Nächster Auslöser
        if ( Trig_MenueAuswahl_Func001Func011001() ) then
            call ConditionalTriggerExecute( gg_trg_WSpawner )
        else
            call DoNothing(  )
        endif
        if ( Trig_MenueAuswahl_Func001Func012001() ) then
            call ConditionalTriggerExecute( gg_trg_OSpawner )
        else
            call DoNothing(  )
        endif
        call PolledWait( 3.00 )
    else
    endif
    if ( Trig_MenueAuswahl_Func002C() ) then
        call ConditionalTriggerExecute( gg_trg_Intro )
    else
    endif
endfunction

//===========================================================================
function InitTrig_MenueAuswahl takes nothing returns nothing
    set gg_trg_MenueAuswahl = CreateTrigger(  )
    call TriggerRegisterDialogEventBJ( gg_trg_MenueAuswahl, udg_Temp_Dialog_Array[1] )
    call TriggerAddAction( gg_trg_MenueAuswahl, function Trig_MenueAuswahl_Actions )
endfunction

EDIT: I will have a look what I can delete, so you can understand the code better...
EDIT2: Ok, deleted a few parts for easier understanding.
(Also tried it with the posted code and still the same error, so the deleted parts weren't in any connection to the problem!)
04-21-2006, 11:04 PM#13
MasterofSickness
@ Blade.dk
So you mean the error happens, because of the "if then else" - statement (which uses the local variable Integer_loop) which I wrote in GUI between the loop. And then when GUI is compiled to jass the "if then else" - function is set to another place and the local variable becomes a global?
04-21-2006, 11:11 PM#14
Earth-Fury
Quote:
Originally Posted by MasterofSickness
@ Blade.dk
So you mean the error happens, because of the "if then else" - statement (which uses the local variable Integer_loop) which I wrote in GUI between the loop. And then when GUI is compiled to jass the "if then else" - function is set to another place and the local variable becomes a global?

exactly.

The modified version i posted fixes this for you.
04-21-2006, 11:12 PM#15
MasterofSickness
Ok, it seems you are right Blade.dk!

I tested everything the same,
only that I deleted the "if then else" - function and the showtext - functions and it worked!
Looks like this now:

GUI:
Trigger:
MultiboardErstellen
Ereignisse
Bedingungen
Collapse Aktionen
Custom script: local integer udg_Integer_loop=1
Custom script: loop
Custom script: exitwhen udg_Integer_loop>12
Set Integer_loop = (Integer_loop + 1)
Custom script: endloop

EDIT:
@ Earth-Fury
You mean the upper one you tested?
W8 I reread...