HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Make A clock?

04-16-2005, 08:30 PM#1
macho271
hI, need some help.. I try to make some kind of clock..
With multiboard function but cant figure out how..
I mean, How can I update a number in multiboard? Is it made for tekst only? Because the only thing I can put in is "set item text".
Any ideas?
04-16-2005, 09:12 PM#2
Anitarf
You can only put strings into multiboards, but pretty much everything can be converted to strings, including numbers. Just use the function "conversion - convert integer to string" when choosing the string to put into your multiboard.
04-16-2005, 09:26 PM#3
macho271
Jup, I figured that out now.. :S
But.. Still cant figure a way to show the clock.. So I made a trigger like this:

Clock 13
Events
Game - The in-game time of day becomes Equal to 21.00
Conditions
Actions
Multiboard - Set the text for ClockBoard item in column 1, row 1 to 21:00

And Yes i made a trigger for every hour.. and YES it was VERY boring to do so! :p

any suggestions to improve it?

And since we talk about multiboards.. Followupquestion:
Ive seen many maps that use multiboards for scoreboard! But how can numbers be updated if mboard only supports strings?
04-16-2005, 09:57 PM#4
macho271
Ah, one more thing.. Can I only have one multiboard on the screen at a time? Because if i try to show another mboard, the existing one disapears! :s
04-16-2005, 11:41 PM#5
macho271
Sorry to bother you with all these questions but I need to know if I can customize the mboard to each player? Or must it show the same to all players?
04-17-2005, 12:21 AM#6
Azhag
I don't mean to be a jerk or anything macho, but please just edit your last post instead of triple posting. Better I get to you then the mods...
04-17-2005, 08:19 AM#7
Anitarf
We already went through this, didn't we? You can update the kills the same way you update the clock: whenever the kills change, you set the multiboard to display a string that is a converted integer.

You can display different multiboards for different players using the function GetLocalPlayer(). First, make all the multiboards, set them to a multiboard variable array and hide them. Then, show them only to their corresponding players with this code:
Code:
For each Integer A from 1 to 12 do actions
    Loop - Actions:
        Custom script:   if GetLocalPlayer() == Player( GetForLoopIndexA() ) then
        Multiboard - show MultiboardVariable[(Integer A)]
        Custom script:   endif
This will display MultiboardVariable[1] to Player 1, MultiboardVariable[2] to Player 2...
04-19-2005, 02:28 PM#8
macho271
hmm, this is what I did:

Board Init Copy
Events
Time - Elapsed game time is 2.00 seconds
Conditions
Actions
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Multiboard - Create a multiboard with 2 columns and 7 rows, titled Information
Multiboard - Set the display style for (Last created multiboard) item in column 0, row 0 to Show text and Hide icons
Multiboard - Set the width for (Last created multiboard) item in column 0, row 0 to 7.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 2, row 0 to 10.00% of the total screen width
Multiboard - Maximize (Last created multiboard)
Set Multiboard[(Integer A)] = (Last created multiboard)
Multiboard - Show Multiboard[1]


So, how can I get the show multiboard[1] for player 1 and 2 for player 2, didnt realy understand the customscript thing you got..
04-19-2005, 08:36 PM#9
Skwee
Events
Time - Periodic Event every one second of game time
Conditions
Actions
Multiboard - Set the text for (Last created multiboard) item in column x, row y to (String((In-game time of day)))


or something like that. That should change the time in the multiboard to the actual game time every second. Change X and Y to what you need
04-19-2005, 08:44 PM#10
Anitarf
Quote:
Originally Posted by macho271
hmm, this is what I did:

Board Init Copy
Events
Time - Elapsed game time is 2.00 seconds
Conditions
Actions
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Multiboard - Create a multiboard with 2 columns and 7 rows, titled Information
Multiboard - Set the display style for (Last created multiboard) item in column 0, row 0 to Show text and Hide icons
Multiboard - Set the width for (Last created multiboard) item in column 0, row 0 to 7.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 2, row 0 to 10.00% of the total screen width
Multiboard - Maximize (Last created multiboard)
Set Multiboard[(Integer A)] = (Last created multiboard)
Multiboard - Show Multiboard[1]


So, how can I get the show multiboard[1] for player 1 and 2 for player 2, didnt realy understand the customscript thing you got..

You don't need to understand it (although we try to encourage that around here), you just need to copy it. In your trigger, in the loop, after you set your multiboard to the variable, put the last 3 lines of the trigger I posted there. The "custom script" action is in the general category. If I didn't do any syntax errors, which I'm almost completely sure I didn't, you should get it to work by just copying what I wrote here into your custom script lines.
04-20-2005, 09:54 AM#11
macho271
Ok, Im going to try that now.. Uhm, but I also want to understand it, and, i is not possible to do it without customscript? I understand the triggers in the editor better than customscript, but Il give it a try.. thanks

And Skwee thanks for the clock example! :=)
04-20-2005, 01:00 PM#12
Anitarf
Ok, I'll try to explain how and why this thing works.

Basically, all we have is an action that displays a multiboard to all players, what we don't have is an action that would display a multiboard to a single player.

Now, if you think how triggers work in multiplayer, they are synchronously processed on all player's computers. When player 1 gets to a trigger action that does something for player 2 only, for example "game - display text message for player 2", it ignores that action. However, we have no such action for showing multiboards, so when we use the "show multiboard" action, all players' computers will display the board... unless we use GetLocalPlayer()

GetLocalPlayer() is a player function, the same as GetTriggeringPlayer() (which is "Triggering player" in GUI) or GetOwningPlayer( unit ) (which is "owner of unit" in GUI). GetOwningPlayer( unit ) gives you the owner of a unit, while GetLocalPlayer() gives you the player on who's computer the function is run. So, in a multiplayer game, this function gives a different player on each computer.

Now we use this function in a player comparison as a condition in an if-then-else statement. The actions in the if statement will only be exectued if the condition is true. Because the condition is only true on one player's computer, the actions inside the if will only run there, so, even if you use the action "display multiboard (to all players)", it will only display the board to one player because on other computers, the trigger won't get to that action because the condition, the player comparison, will be false.

WARNING! This cannot be applied to just about everything. If you do anything that affects gameplay on just one computer, like creating a unit or anything else incredibly stupid, the game will desync, because of the inconsistency between the status of the game on one (or more) player's computer, you will get a server split. Only actions that don't affect how the game runs can be safely used, such as graphic effects.

A list of some actions that desync and some that don't when used in a GetLocalPlayer() if sentence can be found here.
04-21-2005, 05:25 PM#13
macho271
Board Init Copy Copy
Events
Time - Elapsed game time is 2.00 seconds
Conditions
Actions
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Multiboard - Create a multiboard with 1 columns and 1 rows, titled Test
Multiboard - Set the display style for (Last created multiboard) item in column 0, row 0 to Show text and Hide icons
Multiboard - Set the width for (Last created multiboard) item in column 0, row 0 to 7.00% of the total screen width
Multiboard - Maximize (Last created multiboard)
Set Multiboard[(Integer A)] = (Last created multiboard)
Custom script: if GetLocalPlayer() == Player( GetForLoopIndexA() ) then Show Multiboard[(Integer A)] endif


this is what I came up with.. And it doesent work at all!
04-21-2005, 05:54 PM#14
Anitarf
Quote:
Originally Posted by macho271
Custom script: if GetLocalPlayer() == Player( GetForLoopIndexA() ) then Show Multiboard[(Integer A)] endif

Look again at what I posted 7 posts above this, it's not the same. I have three lines, two custom texts and in between those a GUI action, you just put it all together which is of course completely wrong. So once again, replace this last line I quoted with this, and this has to work, it's a copy&paste from a map of mine where it works just swell:
Code:
        Custom script:   if GetLocalPlayer() == Player( GetForLoopIndexA() ) then
        Multiboard - show MultiboardVariable[(Integer A)]
        Custom script:   endif
04-21-2005, 06:25 PM#15
Raptor--
Quote:
Originally Posted by Anitarf
Look again at what I posted 7 posts above this, it's not the same. I have three lines, two custom texts and in between those a GUI action, you just put it all together which is of course completely wrong.

it would be nice if jass used braces so you didn't have to put everything on one line each, completely OT