Showing multiboard to specific player (JASS)

Level 5
Joined
Feb 1, 2009
Messages
107
ok, so I'm a real noob with JASS and I was wondering if someone would want to help me understand this JASS code I found and need to edit:

JASS:
if GetLocalPlayer() == player_to_display_to then
  call MultiboardDisplay(my_multiboard, true)
endif

So, I only need to change "player_to_display_to" to the player I want to display the multiboard. How do I do that in JASS? I want to show my multiboard to a triggering player, so I should replace "player_to_display_to" with "TriggerPlayer"?

For the multiboard. I want to set variables to each multiboard I create. So if I create my multiboard and then do "Set Multiboard[Player number of Triggering Player] = Last created Multiboard", then can i add "udg_Multiboard[GetConvertedPlayerId(GetTriggerPlayer())]" to the JASS code, replacing "my_multiboard"? Will the JASS script understand the variable array, too?

So I would end up with something like...

JASS:
if GetLocalPlayer() == TriggerPlayer then
  call MultiboardDisplay(udg_Multiboard[GetConvertedPlayerId(GetTriggerPlayer())], true)
endif

That's what I've learned making having some GUI triggers translated into JASS by the editor, so I could have an idea of what to use on the script... How far am I from what I want? =P
 
Level 5
Joined
Feb 1, 2009
Messages
107
I think you're totally right. However, replace (GetPlayerConvertedId( GetTriggerPlayer() )) with (GetPlayerId(GetTriggerPlayer()) + 1...

hmm, I didn't understand the need for the "+1". I'm not adding values to my variable... I'm specifying the array for the variable as the triggering player number...

Also, what's the difference between "GetPlayerConvertedId" and "GetPlayerId"?
 
Level 5
Joined
Feb 1, 2009
Messages
107
So it's just a shorter way WE understands my JASS code?

In the end I'll have this, then:
JASS:
if GetLocalPlayer() == TriggerPlayer then
  call MultiboardDisplay(udg_Multiboard[(GetPlayerId(GetTriggerPlayer()) + 1], true)
endif
 
Level 12
Joined
Dec 31, 2005
Messages
712
Maybe you should do

JASS:
local player ShowTo = GetTriggerPlayer()
if GetLocalPlayer() == ShowTo then
  call MultiboardDisplay(udg_Multiboard[(GetPlayerId(ShowTo) + 1], true)
endif

When you repeat functions like GetTriggerUnit(), store that in a variable to avoid unecessary work for your computer :p

And GetConvertedPlayerId is what we call a BJ. That is, functions created by Blizzard to make the use of JASS easier for starters, but slower. Whenever you see a BJ, take a look at its code (I suggest JassCraft (available in Tools section) to see the code) and, if it's not too complex, use the code instead of the function.

Using BJ is like when you're copying something from one page to the other side of it - you'll have to turn the page everytime you need to read what you're copying, slowing your work.

Hope you understand :p
 
Top