| 01-14-2007, 10:59 AM | #1 |
Whenever I try saving the editor with this code it crashes, could anyone assist me with possible bugs? JASS:function mvpfuncA takes nothing returns nothing local integer x = 1 loop exitwhen x>12 set udg_PlayerScores[x]=0 set x=x+1 endloop set x=2 loop exitwhen x>12 if(x==7) then call DoNothing() else set udg_PlayerScores[x]=I2R(udg_Stats_Ints[x]*3) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Sacks[x]+udg_Stat_Tackles[x]) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Touchdowns[x]*2) set udg_PlayerScores[x]=udg_PlayerScores[x]+(udg_Stat_YardsGained[x]/3) x=x+1 endloop set x=2 local real b=2 loop set b=2 exitwhen x>12 if(x==7) then call DoNothing() else loop exitwhen b>12 if(b==7) then call DoNothing() else if(x==b) then call DoNothing() else if(x>b) then set udg_MVP=Player(x) endif endif endif set b=b+1 endloop endif set x=x+1 endloop call DisplayTextToForce(GetPlayersAll(),("Most valuable player is: |CFFFF0303"+GetPlayerName(udg_MVP))) call DisplayTextToForce(GetPlayersAll(),"Scores...") set x = 2 loop exitwhen x>12 if (x==7) call DoNothing() else call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(udg_MVP)+R2S(udg_PlayerScores[x]))) endif set x=x+1 endloop call RemovePlayer(udg_MVP) set udg_MVP=null endfunction function InitTrig_mvpfunc takes nothing returns nothing local trigger mvpfunc takes nothing returns nothing call TriggerAddAction(mvpfunc, fuction mvpfuncA) set mvpfunc=null endfunction |
| 01-14-2007, 11:06 AM | #2 |
Missing endif. |
| 01-14-2007, 11:11 AM | #3 |
I added the missing endif, WE still errors when I attempt to enable the trigger. JASS:loop exitwhen x>12 if(x==7) then call DoNothing() else set udg_PlayerScores[x]=I2R(udg_Stats_Ints[x]*3) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Sacks[x]+udg_Stat_Tackles[x]) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Touchdowns[x]*2) set udg_PlayerScores[x]=udg_PlayerScores[x]+(udg_Stat_YardsGained[x]/3) x=x+1 endif endloop |
| 01-14-2007, 11:15 AM | #4 |
Use jass craft from resources section |
| 01-14-2007, 11:31 AM | #5 |
JASS:loop exitwhen x>12 if(x==7) then call DoNothing() else set udg_PlayerScores[x]=I2R(udg_Stats_Ints[x]*3) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Sacks[x]+udg_Stat_Tackles[x]) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Touchdowns[x]*2) set udg_PlayerScores[x]=udg_PlayerScores[x]+(udg_Stat_YardsGained[x]/3) x=x+1 endloop Missing : Endif, set x=x+1 JASS:loop set b=2 exitwhen x>12 if(x==7) then call DoNothing() else loop exitwhen b>12 if(b==7) then call DoNothing() else if(x==b) then call DoNothing() else if(x>b) then set udg_MVP=Player(x) endif endif endif set b=b+1 endloop Missing endif again and missing one endloop. JASS:loop exitwhen x>12 if (x==7) call DoNothing() else call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(udg_MVP)+R2S(udg_PlayerScores[x]))) endif set x=x+1 endloop Missing x=7 instead of x==7, and missing then. JASS:call RemovePlayer(udg_MVP) Missing one argument (player game result). JASS:local trigger mvpfunc takes nothing returns nothing Not allowed. JASS:call TriggerAddAction(mvpfunc, fuction mvpfuncA) function instead of fuction. JASS:function mvpfuncA takes nothing returns nothing local integer x = 1 local real b=2 loop exitwhen x>12 set udg_PlayerScores[x]=0 set x=x+1 endloop set x=2 loop exitwhen x>12 if(x==7) then call DoNothing() else set udg_PlayerScores[x]=I2R(udg_Stats_Ints[x]*3) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Sacks[x]+udg_Stat_Tackles[x]) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Touchdowns[x]*2) set udg_PlayerScores[x]=udg_PlayerScores[x]+(udg_Stat_YardsGained[x]/3) set x=x+1 endif endloop set x=2 loop set b=2 exitwhen x>12 if(x==7) then call DoNothing() else loop exitwhen b>12 if(b=!7 and x=!b and x<b) then set udg_MVP=Player(x) set b=b+1 endif endloop set x=x+1 call DisplayTextToForce(GetPlayersAll(),("Most valuable player is: |CFFFF0303"+GetPlayerName(udg_MVP))) call DisplayTextToForce(GetPlayersAll(),"Scores...") set x = 2 loop exitwhen x>12 if x==7 then call DoNothing() else call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(udg_MVP)+R2S(udg_PlayerScores[x]))) endif set x=x+1 endloop //call RemovePlayer(udg_MVP) set udg_MVP=null endfunction function InitTrig_mvpfunc takes nothing returns nothing local trigger mvpfunc call TriggerAddAction(mvpfunc, function mvpfuncA) set mvpfunc=null endfunction 3 errors still there : -> Missing endloop in loop-endloop -> if(b=!7 and x=!b and x<b) differant types. -> Disabled call RemovePlayer(udg_MVP) |
| 01-14-2007, 11:46 AM | #6 |
Thanks for the help Chocobo, still trying to remember the simple JASS syntax errors :(. Which parameter should be used in RemovePlayer() to have no effect on the game? PLAYER_GAME_RESULT_NEUTRAL? Or is there none? |
| 01-14-2007, 11:53 AM | #7 | |
Quote:
Do you know first, what exactly RemovePlayer() does? btw the parameters are : PLAYER_GAME_RESULT_VICTORY or PLAYER_GAME_RESULT_DEFEAT I don't know for what you are going to use this. |
| 01-14-2007, 12:14 PM | #8 |
I have 6 compile errors which I cannot figure out: Line 820: Expected 'endif' Line 823: Expected a variable name Line 829: Expected a name Line 830: Expected a name Line 832: Expected a variable name Line 833: Expected 'endloop' JASS:function mvpfuncA takes nothing returns nothing local integer x=1 loop exitwhen x>12 set udg_PlayerScores[x]=0 set x=x+1 endloop set x=2 loop exitwhen x>12 if(x==7) then call DoNothing() else set udg_PlayerScores[x]=I2R(udg_Stat_Ints[x]*3) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Sacks[x]+udg_Stat_Tackles[x]) set udg_PlayerScores[x]=udg_PlayerScores[x]+I2R(udg_Stat_Touchdowns[x]*2) set udg_PlayerScores[x]=udg_PlayerScores[x]+(udg_Stat_YardsGained[x]/3) set x=x+1 endif endloop set x=2 //[b]line 820[/b] local integer b=2 loop set b=2 //[b]line 823[/b] exitwhen x>12 if(x==7) then call DoNothing() else loop exitwhen b>12 //[b]line 829[/b] if(b=!7 and x=!b and x>b) then //[b]line 830[/b] set udg_MVP=Player(x) set b=b+1 //[b]line 832[/b] endif //[b]line 833[/b] endloop endif set x=x+1 endloop call DisplayTextToForce(GetPlayersAll(),("Most valuable player is: |CFFFF0303"+GetPlayerName(udg_MVP))) call DisplayTextToForce(GetPlayersAll(),"Scores...") set x = 2 loop exitwhen x>12 if (x==7) then call DoNothing() else call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(udg_MVP)+R2S(udg_PlayerScores[x]))) endif set x=x+1 endloop set udg_MVP=null endfunction function InitTrig_mvpfunc takes nothing returns nothing local trigger mvpfunc = CreateTrigger() call TriggerAddAction(mvpfunc, function mvpfuncA) set mvpfunc=null endfunction |
| 01-14-2007, 12:26 PM | #9 |
I said, 3 errors missing because I don't know really how it will end : 3 errors still there : -> Missing endloop in loop-endloop -> if(b=!7 and x=!b and x<b) differant types. -> Disabled call RemovePlayer(udg_MVP) Line 832/823: Expected a variable name Put the local at the top just after local integer x. |
| 01-14-2007, 12:37 PM | #10 |
Putting the declaration at the top solved 4 errors, and the not-equal should be != not =!, which solved the other two errors. Thank you for your help. |
| 01-14-2007, 12:49 PM | #11 |
lol, use gui |
| 01-14-2007, 01:34 PM | #12 | |
I wrote the function again and optimized it a bit. That's all i changed
|
| 01-14-2007, 08:22 PM | #13 | |
Quote:
_________ Whatever, just get yourself something nice like WEHelper so your editor won't crash if you make mistakes in code and it will actually tell you correct error messages in the correct line numbers |
| 01-14-2007, 10:50 PM | #14 | |
Quote:
Failure to the extreme. |
