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

[Trigger] Multiboard disappears

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I don't know JASS at all, but I got some help with multiboards here at the Hive. I found a bug in a multiplayer game, and I'm not sure how to find it. The problem is that a player's multiboard either disappeared or never appeared (he doesn't remember).

The multiboard is created in a trigger that fires at .5 seconds into the game. The relevant part is here:

  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Multiboard - Create a multiboard with 2 columns and 7 rows, titled Dashboard
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Lasers
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 2 to Missiles
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 3 to Engine
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 4 to Stabilizer
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 5 to Target
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 6 to Sensors
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 7 to Shields
      • For each (Integer B) from 1 to 7, do (Actions)
        • Loop - Actions
          • Multiboard - Set the width for (Last created multiboard) item in column 1, row (Integer B) to 8.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 2, row (Integer B) to 3.00% of the total screen width
          • Multiboard - Set the color for (Last created multiboard) item in column 1, row (Integer B) to (20.00%, 80.00%, 20.00%) with 0.00% transparency
          • Multiboard - Set the color for (Last created multiboard) item in column 2, row (Integer B) to (20.00%, 80.00%, 20.00%) with 0.00% transparency
          • Multiboard - Set the display style for (Last created multiboard) item in column 2, row (Integer B) to Show text and Hide icons
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 1 to ReplaceableTextures\PassiveButtons\PASBTNFlakCannons.blp
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 2 to ReplaceableTextures\CommandButtons\BTNClusterRockets.blp
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 3 to ReplaceableTextures\CommandButtons\BTNAnimalWarTraining.blp
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 4 to ReplaceableTextures\CommandButtons\BTNWhirlwind.blp
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 5 to ReplaceableTextures\CommandButtons\BTNUndeadLoadOn.blp
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 6 to ReplaceableTextures\CommandButtons\BTNWindWalkOn.blp
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 7 to ReplaceableTextures\CommandButtons\BTNNeutralManaShield.blp
      • Multiboard - Minimize (Last created multiboard)
      • Set MultiBoard[(Integer A)] = (Last created multiboard)
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set Show = False
      • Set MBint = ((Integer A) - 1)
      • Custom script: if GetLocalPlayer() == Player(udg_MBint) then
      • Set Show = True
      • Multiboard - Show MultiBoard[(Integer A)]
      • Custom script: endif
Ordinarily this appears to work; so I'm not sure what went wrong before. (I haven't been able to replicate it). I looked in the object editor, and I never use the "destroy multiboard" action. I use the "show/hide" multiboard command only once; in the trigger above.

Can anyone see why this wouldn't create a multiboard? Is the "Set MBint = Integer A -1" correct for a game that takes between 1-10 players?
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Ordinarily this appears to work; so I'm not sure what went wrong before. (I haven't been able to replicate it). I looked in the object editor, and I never use the "destroy multiboard" action. I use the "show/hide" multiboard command only once; in the trigger above.

Can anyone see why this wouldn't create a multiboard? Is the "Set MBint = Integer A -1" correct for a game that takes between 1-10 players?

I cant see anything wrong with it from this code up there.

The "Set MBint = Integer A -1" is correct as the custom script is code directly written in Jass, and in Jass:
GUI Player 1 is JASS Player 0
GUI Player 2 is JASS Player 1
and so on ...

so u have to use "Playernumber - 1" in this small custom script.

Further on, it does show every MB created only for this specific player from 1 to 10.

Where and for what purpose do you use this variable "Show"?

your code could be optimized by the way
 
Level 18
Joined
Nov 21, 2012
Messages
835
Where and for what purpose do you use this variable "Show"?
The same question ;]
@darwin You can show only 1 multiboard for a player at a time.
So if you are using someting like ShareEverythingWithAllies when player leaves a game then original multiboard will be overwritten by new one with list of leaver's resources (its war3 build-in board)
 
Level 14
Joined
Aug 30, 2004
Messages
909
Thanks everyone.

I have no idea what the "show" variable was doing. That part of the code was all greek to me. I really only know how to use the World Editor and remove leaks with custom script.

Emm, I know this code isn't as pretty as it could be; but this isn't a repeating trigger so I tend not to worry too much about it.

ZiBi, that is a clever idea! Unfortunately it was not the case here though. There were only the two of us playing when it disappeared.

My problem is that I don't know how to show a multiboard only to one player. That command doesn't seem to be in the World Editor. Hence the code here I don't understand.

I think adding a bug fixer could be a good idea. What kind of custom script would I use to show Multiboard[5] for Player 5 only? Or is this unnecessary because of the way the multiboards were made?
 
Level 18
Joined
Nov 21, 2012
Messages
835
Dr SG suggestion:

  • mbPlayer
    • Events
      • Player - Player 1 (Red) types a chat message containing -mb as An exact match
      • Player - Player 2 (Blue) types a chat message containing -mb as An exact match
      • Player - Player 3 (Teal) types a chat message containing -mb as An exact match
      • Player - Player 4 (Purple) types a chat message containing -mb as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -mb as An exact match
      • Player - Player 6 (Orange) types a chat message containing -mb as An exact match
      • Player - Player 7 (Green) types a chat message containing -mb as An exact match
      • Player - Player 8 (Pink) types a chat message containing -mb as An exact match
      • Player - Player 9 (Gray) types a chat message containing -mb as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -mb as An exact match
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Triggering player))
      • Custom script: if GetLocalPlayer() == Player(udg_TempInt-1) then
      • Custom script: call MultiboardDisplay( udg_MultiBoard[udg_TempInt], true )
      • Custom script: endif
zibi
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Where and for what purpose do you use this variable "Show"?

The same question ;]

The "Show" variable seems to be meant if the multiboard is shown for a specific player.
The values differ between each local client as the variable is set in local blocks.
However, it is implemented wrong because it will be reset to false every loop interval.
So at the end of this trigger, the variable "Show" will be false for everyone except player 10.

I suppose that this variable is also the cause of the problem as I cant see anything else suspicious in this trigger.
My assumption is that "Show" will be used somewhere else as local variable but only reads in that it is not shown aka false.

Try to remove the line "Set Show = false".
 
Status
Not open for further replies.
Top