• 🏆 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!

JASS Problem - Expects a name and an end loop which already exists

Status
Not open for further replies.
I am new to JASS, and I am having trouble with the following section of code:
JASS:
        if ( GetLocalPlayer() == Player( udg_GameStats[GetForLoopIntegerA()-1]) ) then
        call MultiboardDisplayBJ( true, udg_GameStats[GetForLoopIndexA()] )
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
The first line "if ( GetLocalPlayer() == Player( udg_GameStats[GetForLoopIntegerA()-1]) ) then" comes with the error "Expects a name"
The third line "endif" expects an "endloop", but said loop already exists at the end of the code.
What do these mean, and how do I fix them?
 
Variables:
GameStats: Multiboard Array, size of 4
Player: String Array, Size of 4 (Name of the Player)
PlayerColor: String Array, Size of 4 (Warcraft Color code for player.)
There are no events; this trigger is run from another trigger.

  • MakeMultiboard
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Multiboard - Create a multiboard with 2 columns and 7 rows, titled |cffffcc00Game Stat...
          • Set GameStats[(Integer A)] = (Last created multiboard)
          • Multiboard - Set the width for GameStats[(Integer A)] item in column 1, row 0 to 12.50% of the total screen width
          • Multiboard - Set the width for GameStats[(Integer A)] item in column 2, row 0 to 10.00% of the total screen width
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 2 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_01.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 2 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_01.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 3 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_03.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 4 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_05.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 5 to ReplaceableTextures\CommandButtons\BTNSkeletonWarrior.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 6 to ReplaceableTextures\WorldEditUI\Editor-Ally-NoPriority.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 7 to ReplaceableTextures\WorldEditUI\Editor-ItemSet.blp
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 2 to Gold
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 3 to Silver
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 4 to Copper
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 5 to Deaths
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 6 to AchievScore
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 7 to AchievPoints
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 2, row 1 to (PlayerColor[(Integer A)] + (Name of Player[(Integer A)]))
          • Multiboard - Set the display style for GameStats[(Integer A)] item in column 2, row 0 to Show text and Hide icons
          • Multiboard - Set the display style for GameStats[(Integer A)] item in column 1, row 1 to Hide text and Hide icons
          • Multiboard - Hide GameStats[(Integer A)]
          • Custom script: if ( GetLocalPlayer() == Player( udg_GameStats[GetForLoopIndexA()-1]) ) then
          • Multiboard - Show GameStats[(Integer A)]
          • Custom script: endif
 
Variables:
GameStats: Multiboard Array, size of 4
Player: String Array, Size of 4 (Name of the Player)
PlayerColor: String Array, Size of 4 (Warcraft Color code for player.)
There are no events; this trigger is run from another trigger.

  • MakeMultiboard
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • -------- The Loop is right above. --------
          • Multiboard - Create a multiboard with 2 columns and 7 rows, titled |cffffcc00Game Stat...
          • Set GameStats[(Integer A)] = (Last created multiboard)
          • Multiboard - Set the width for GameStats[(Integer A)] item in column 1, row 0 to 12.50% of the total screen width
          • Multiboard - Set the width for GameStats[(Integer A)] item in column 2, row 0 to 10.00% of the total screen width
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 2 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_01.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 2 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_01.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 3 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_03.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 4 to ReplaceableTextures\CommandButtons\BTNMisc_Coin_05.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 5 to ReplaceableTextures\CommandButtons\BTNSkeletonWarrior.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 6 to ReplaceableTextures\WorldEditUI\Editor-Ally-NoPriority.blp
          • Multiboard - Set the icon for GameStats[(Integer A)] item in column 1, row 7 to ReplaceableTextures\WorldEditUI\Editor-ItemSet.blp
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 2 to Gold
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 3 to Silver
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 4 to Copper
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 5 to Deaths
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 6 to AchievScore
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 1, row 7 to AchievPoints
          • Multiboard - Set the text for GameStats[(Integer A)] item in column 2, row 1 to (PlayerColor[(Integer A)] + (Name of Player[(Integer A)]))
          • Multiboard - Set the display style for GameStats[(Integer A)] item in column 2, row 0 to Show text and Hide icons
          • Multiboard - Set the display style for GameStats[(Integer A)] item in column 1, row 1 to Hide text and Hide icons
          • Multiboard - Hide GameStats[(Integer A)]
          • Custom script: if ( GetLocalPlayer() == Player( udg_GameStats[GetForLoopIndexA()-1]) ) then
          • Multiboard - Show GameStats[(Integer A)]
          • Custom script: endif


The loop is right there at the top. Please read though all the posts before replying. I also stated I wasn't very good at JASS, and I don't know that the best stuff to use is.:wink:
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
And me does not like GUI, for example I cannot simply copy your code this way to test it myself. Well, you can surely debug it yourself. Integrate debug messages to check up to where the code sequence runs to, if your trigger even fires and in case it doesn't, check the parameters and processes that conclude to it.
 
Level 13
Joined
May 11, 2008
Messages
1,198
The loop is right there at the top. Please read though all the posts before replying. I also stated I wasn't very good at JASS, and I don't know that the best stuff to use is.:wink:

i'm sorry. i was VERY sleepy at the time and i did read through the posts but i skipped information i thought was irrelevant, and i misread some things. i didn't realize for one thing that the person posting gui trigger was you, the original poster. at any rate it's never a good idea to just post so little of the code as you did in the first post...it doesn't let the posters understand much about what you're doing.
 
And me does not like GUI, for example I cannot simply copy your code this way to test it myself. Well, you can surely debug it yourself. Integrate debug messages to check up to where the code sequence runs to, if your trigger even fires and in case it doesn't, check the parameters and processes that conclude to it.

...and that is exactly what I did. Even though I know how easy it is to copy JASS code, it's really confusing to me. I understand the "actions" as GUI would call it, but I don't really get the "function (name) takes (something) returns (something)". That's the part that confuses me most.
 
Level 13
Joined
May 11, 2008
Messages
1,198
well, if you need a working multiboard, you can use the one i'm using in my latest maps. it was a 98% completed project(a few minor bugs) by magentix that i snatched up over at thehelper.net from a coder that moved onto things other than war3 apparently.
both of the multiboards i use you can learn from looking at them as they are quite different, them being quite different games...
i found it's the best multiboard system around...there is somewhat of a drawback in that it's very unusual compared to normal vjass coding, but i think it retains a lot of charm in that. the advantages outweigh the strangeness of the system.

i recommend reading others' coding(in maps is best, but a lot of good jassers lock their maps).
you can learn a lot, even if you learn from a system that you don't forsee yourself using. if you're new to jass, then it's hard to know what will help unless you go find out.

as for hiding and displaying entire multiboards though for certain players...i never wanted to do it in my games so(well i thought about it for my tdht map and then decided that i'd rather have a smaller board ) i'm not sure if jboard can do it, and if you have trouble with it, let me know maybe i can help you out there.
 
Status
Not open for further replies.
Top