wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 12-30-2006, 12:39 AM   #1
Mapz_Maker
User
 
Mapz_Maker's Avatar
 
Join Date: Nov 2006
Posts: 198

Submissions (1)

Mapz_Maker is on a distinguished road (12)

Default A Guide to Multiboard Menus

What is a Multiboard-based Menu System?
A multiboard-based menu system, is a multiboard made to function like a menu

I heard you just updated it not to need Custom Script!
Correct, i made GUI functions for this!
Read at the bottom for more info!

But i thought multiboards showed for all players or not at all?
this is a common perception but by the use of a certain if/then statement it is possible to over come that, the if/then statement is
Collapse JASS:
if GetLocalPlayer() == (your player comparison)
show the multiboard
endif

Wait a second, this is going to cause desyncs, isnt it?
no, this has been tested time and time again, no desyncs dont worry about it.

When can i make my own menu?
Infact let's get started making a menu that fits your needs right now!


1) first you are going to want to have several variables so that you can create/use the menu

Boolean Array inmultiboard
integer TempPNumber //temporary player number
integer Array CurrentRow
Multiboard Array Multiboards

2) you will need an initialization trigger so that when you would like to show a player their menu, the menu is ready to be used.

Trigger:
Menu Init
Collapse Events
Time - Elapsed game time is 0.75 seconds //when doesnt really matter, within the first second is preferable.
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 4, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
((Player((Integer A))) controller) Equal to User
Collapse Then - Actions
Multiboard - Create a multiboard with 2 columns and 30 rows, titled The Help Menu
Set Multiboards[(Integer A)] = (Last created multiboard)
Multiboard - Set the display style for (Last created multiboard) item in column 0, row 0 to Show text and Hide icons
Collapse Multiboard - Set the text for (Last created multiboard) item in column 1, row 4 to What is this?
you usually want to start at about row 4 so that it isnt right at the top of the screen, and you usually want to start on an item that explains how to manipulate the menu.
Multiboard - Set the text for (Last created multiboard) item in column 1, row 5 to <Option 2>
Multiboard - Set the width for (Last created multiboard) item in column 1, row 0 to 30.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 2, row 0 to 70.00% of the total screen width// set this to take up the screen
Multiboard - Hide(Last created multiboard) //you only want them to see when they need it.
Else - Actions
Collapse For each (Integer A) from 1 to 4, do (Actions)
Collapse Loop - Actions
Set inmultiboard[(Integer A)] = False
Set TempPNumber = (Integer A)
Collapse For each (Integer A) from 1 to 4, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
((Player((Integer A))) controller) Equal to User
Collapse Then - Actions
-------- A weird little thing that will only show a multiboard if the local player is appropriate. --------
-------- The concept is that if the current "local player" is being considered, we can show them a multiboard that corresponds to the player number in the loop. --------
Custom script: if( GetLocalPlayer() == ConvertedPlayer(bj_forLoopAIndex) ) then
Multiboard - Hide Multiboards[(Integer A)] // make sure they are hidden
Custom script: endif
Else - Actions

3) Now that you have an initialization trigger, you need a trigger to show the multiboard once they want/need it, this way they will be able to use your menu that you create

Trigger:
Show Menu
Collapse Events
Player - Player 1 (Red) types a chat message containing -menu as An exact match
Player - Player 2 (Blue) types a chat message containing -menu as An exact match
Player - Player 3 (Teal) types a chat message containing -menu as An exact match
Player - Player 4 (Purple) types a chat message containing -menu as An exact match
Conditions
Collapse Actions
Set CurrentRow[(Player number of (Triggering player))] = 4
Set inmultiboard[(Player number of (Triggering player))] = True
Set TempPNumber = (Player number of (Triggering player))
Trigger - Run Alter onEvent <gen> (checking conditions) // we will get to this later
Custom script: if( GetLocalPlayer() == GetTriggerPlayer() ) then
Multiboard - Show Multiboards[(Player number of (Triggering player))]
Custom script: endif

4) ok, now you will be able to show your multiboards, but now you ask "but how do i set descriptions? how do i move around?? Now we come to that, you need a general response trigger i title them Alter onEvent because they merely alter the menu, This trigger alters the individual menus so that the appropriate player can tell what they are doing
Trigger:
Alter onEvent
Events
Conditions
Collapse Actions
Multiboard - Set the text for Multiboards[TempPNumber] item in column 2, row 0 to <Empty String>
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentRow[TempPNumber] Equal to 4
Collapse Then - Actions
Multiboard - Set the text for Multiboards[TempPNumber] item in column 2, row 5 to This is an interactive menu.
Multiboard - Set the text for Multiboards[TempPNumber] item in column 2, row 6 to To use it, press the up/down arrow keys for movement,
Multiboard - Set the text for Multiboards[TempPNumber] item in column 2, row 7 to use the right arrow to exit the help menu
//I seperated the parts of the description out so that i alwas used one line of text (max) per row, giving it a more/less uniform look.
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentRow[TempPNumber] Equal to 5
Collapse Then - Actions
Multiboard - Set the text for Multiboards[TempPNumber] item in column 2, row 5 to <description 2a> Multiboard - Set the text for Multiboards[TempPNumber] item in column 2, row 6 to future, <description 2b>
Multiboard - Set the text for Multiboards[TempPNumber] item in column 2, row 7 to <description 2c>
Else - Actions
Multiboard - Set the color for Multiboards[TempPNumber] item in column 1, row 0 to (0.00%, 100.00%, 0.00%) with 0.00% transparency// make all items look the same
Multiboard - Set the color for Multiboards[TempPNumber] item in column 2, row 0 to (50.00%, 50.00%, 75.00%) with 0.00% transparency //this gives a bluish/purplish color to the item description text for nice effect.
Multiboard - Set the color for Multiboards[TempPNumber] item in column 1, row CurrentRow[TempPNumber] to (0.00%, 0.00%, 100.00%) with 0.00% transparency //highlight the current item so they know where they are

5) ok now you have the general response trigger, now you need to know they want to look around so we create response triggers for those, in this way we can use the trigger we just made so that they can actually have a use for your menu, that you are making.

the up arrow trigger so that when they press the up arrow the select the item above that which they have selected.

Trigger:
Event Response up
Collapse Events
Player - Player 1 (Red) Presses the Up Arrow key
Player - Player 2 (Blue) Presses the Up Arrow key
Player - Player 3 (Teal) Presses the Up Arrow key
Player - Player 4 (Purple) Presses the Up Arrow key
Collapse Conditions
CurrentRow[(Player number of (Triggering player))] Greater than 4 // so they dont go off the menu
inmultiboard[(Player number of (Triggering player))] Equal to True
Collapse Actions
Set TempPNumber = (Player number of (Triggering player))
Set CurrentRow[TempPNumber] = (CurrentRow[TempPNumber] - 1) // it is important to note, up = - down = +
Trigger - Run Alter onEvent <gen> (ignoring conditions)

The down arrow trigger so when they press the down arrow they select the item beneath that which they are selected on

Trigger:
Event Response down
Collapse Events
Player - Player 1 (Red) Presses the Down Arrow key
Player - Player 2 (Blue) Presses the Down Arrow key
Player - Player 3 (Teal) Presses the Down Arrow key
Player - Player 4 (Purple) Presses the Down Arrow key
Collapse Conditions
CurrentRow[(Player number of (Triggering player))] Less than 9 // again, so they dont go off the menu
inmultiboard[(Player number of (Triggering player))] Equal to True
Collapse Actions
Set TempPNumber = (Player number of (Triggering player))
Set CurrentRow[TempPNumber] = (CurrentRow[TempPNumber] + 1)
Trigger - Run Alter onEvent <gen> (ignoring conditions)

the right arrow trigger so that they can select an item, or exit, or just a general action function

Trigger:
Event Response right
Collapse Events
Player - Player 1 (Red) Presses the Right Arrow key
Player - Player 2 (Blue) Presses the Right Arrow key
Player - Player 3 (Teal) Presses the Right Arrow key
Player - Player 4 (Purple) Presses the Right Arrow key
Collapse Conditions
inmultiboard[(Player number of (Triggering player))] Equal to True
Collapse Actions
Set inmultiboard[(Player number of (Triggering player))] = False
Custom script: if( GetLocalPlayer() == GetTriggerPlayer() ) then
Multiboard - Hide Multiboards[(Player number of (Triggering player))]
Custom script: endif

a left arrow one could be made, but i didnt need one so i didnt make one since i would have no explanation for it.


if you would like to have more than one menu then for each menu, repeat steps 1 - 5 just add prefixes/suffixes like Help_ or _Help onto the variables after copy and pasting so that you can have more than one menu.

Ok so you now know the basics, but you want to know more.

This type of menu system is best if it is response based not time elapse based. I have noticed rare instances where the system will corrupt and needs to be remade (ingame) (by corrupt i mean for instance showing the wrong menu, this is discussed further just keep reading.) so i usually have a debug function on the init trigger that registers player 1 saying like -menuerror and it remakes the menus from scratch. the times this almost always will happen is if you display them ALL at the same time. some people are rather dense and will refuse to read help/descriptions (one of the most irksome things) so i usually have it be like Bob's Help Menu at the title so if nothing else a more experinced person may ask "hey bob does it say "Bob's Help Menu" at the top? to make sure that it isnt an error just refusal to read the description, if it is an error that is where the debug comes into play because it would remake all the menus so that the error would go away. errors are not a normal event as Genesis of Empires II will tell you since 90% of the controls are menus not dislike this system. i ,however, could not access the code because it is protected so i asked the makers on their forums how they did it. they were kind and taught me how to do by sending me vague example maps.

KEY FACTS:
1) do not display all menus at the same time, more likely to cause an error
2) remember to add a debug function and tell in a help section somewhere that Player 1 can type that to fix the errors, however unlikely.
3) Player 1's menu is the very least likely to fail, so another reason that fact 2 should be usable by player 1

I have attached a sample map that portrays this tutorial, errors and comments are very welcome.

please download my example map so that you will further understand this concept, thank you.

UPDATE: GUI functions for this!
Download the zip and extract it into your war3 directory take the UI folder out and place it in the directory!

Note: You MUST copy the following code into your header (thingy that says name of your map at top of trigger section)
Collapse JASS:
function MultiboardDisplayforPlayer takes player p, multiboard board ,boolean bool returns nothing
    if( GetLocalPlayer() == p ) then
    call MultiboardDisplay( board, bool )
    endif
endfunction

function MultiboardMinimizeforPlayer takes player p, multiboard board, boolean bool returns nothing
    if( GetLocalPlayer() == p ) then
    call MultiboardMinimize( board, bool )
    endif
endfunction

function CreateMultiboardforPlayer takes integer cols, integer rows, string title, player p returns multiboard
    if( GetLocalPlayer() == p ) then
    set bj_lastCreatedMultiboard = CreateMultiboard()
    call MultiboardSetRowCount(bj_lastCreatedMultiboard, rows)
    call MultiboardSetColumnCount(bj_lastCreatedMultiboard, cols)
    call MultiboardSetTitleText(bj_lastCreatedMultiboard, title)
    call MultiboardDisplayforPlayer(p, bj_lastCreatedMultiboard, true)
    endif
    return bj_lastCreatedMultiboard
endfunction

Then you won't have to touch jass again for that map (if you dont want to)!!

This GUI patch gives you 3 new functions under the multiboard section
Multiboard - Create for Player
Multiboard - Minimize/Maximize for Player
Multiboard - Show/Hide for Player
Attached Files
File Type: w3x Menu System Example.w3x (22.0 KB, 437 views)
File Type: zip Multiboard GUI.zip (150.6 KB, 312 views)

Last edited by Mapz_Maker : 01-19-2007 at 02:42 AM. Reason: added the GUI
Mapz_Maker is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 12-30-2006, 01:19 AM   #2
wyrmlord
User
 
wyrmlord's Avatar
 
Join Date: Feb 2006
Posts: 399

Submissions (2)

wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)wyrmlord has a spectacular aura about (77)

Default

I would suggest explaining each trigger instead of just doing "we need a trigger for this, here it is!". I just looked over it quickly, so I cannot fully rate its usefulness, but the issue I mentioned is important. I personally look at a tutorial to learn how to do something and why it works that way. Your tutorial looks like posted triggers from a map and not having them fully explained.
__________________
A member of Clan TDG - Quality mapmaking and playtesting.

Tired of boring old GUI? Want to learn JASS? Take a look at these tutorials.
wyrmlord is offline   Reply With Quote
Old 12-30-2006, 03:04 AM   #3
Mapz_Maker
User
 
Mapz_Maker's Avatar
 
Join Date: Nov 2006
Posts: 198

Submissions (1)

Mapz_Maker is on a distinguished road (12)

Default

ok, updated
Mapz_Maker is offline   Reply With Quote
Old 12-30-2006, 02:56 PM   #4
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,794

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default

Quite useful and also has a demo map.
Approved.
__________________
Zoom (requires log in)
PitzerMike is offline   Reply With Quote
Old 12-30-2006, 04:53 PM   #5
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I liked a lot this menu system, it's easy to configure.

+rep
moyack is offline   Reply With Quote
Old 12-30-2006, 05:00 PM   #6
Anopob
Yay!
 
Anopob's Avatar
 
Join Date: May 2006
Posts: 870

Anopob has a spectacular aura about (120)

Default

Cool...but why is the description a little bit "above" the topics?
__________________
Give +REP to people who help you with things or make good resources.
Better Ways of Requesting For Help - Race Contest #2 WIP Thread (Bone Race)
As of December 1st I have my blue rep. Yay :D
Anopob is offline   Reply With Quote
Old 12-30-2006, 11:03 PM   #7
mikke95
User
 
mikke95's Avatar
 
Join Date: Mar 2006
Posts: 92

Submissions (2)

mikke95 is on a distinguished road (18)

Default

Cool

Last edited by mikke95 : 12-30-2006 at 11:03 PM.
mikke95 is offline   Reply With Quote
Old 12-31-2006, 11:55 PM   #8
Mapz_Maker
User
 
Mapz_Maker's Avatar
 
Join Date: Nov 2006
Posts: 198

Submissions (1)

Mapz_Maker is on a distinguished road (12)

Default

Quote:
Originally Posted by Anopob
Cool...but why is the description a little bit "above" the topics?
what?
other than that,
Thanks guys, this is my first tutorial!
Mapz_Maker is offline   Reply With Quote
Old 01-01-2007, 01:37 AM   #9
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Isn't it an issue in multiplayer that key events have a delay?
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 01-01-2007, 01:54 AM   #10
Anopob
Yay!
 
Anopob's Avatar
 
Join Date: May 2006
Posts: 870

Anopob has a spectacular aura about (120)

Default

The description (on the right) starts at the top of the multiboard. The topics (on the left) are a little lower than the description. But again, it isn't much a difference, so gj!
__________________
Give +REP to people who help you with things or make good resources.
Better Ways of Requesting For Help - Race Contest #2 WIP Thread (Bone Race)
As of December 1st I have my blue rep. Yay :D
Anopob is offline   Reply With Quote
Old 01-01-2007, 06:41 PM   #11
Mapz_Maker
User
 
Mapz_Maker's Avatar
 
Join Date: Nov 2006
Posts: 198

Submissions (1)

Mapz_Maker is on a distinguished road (12)

Default

@vexorian: key events do have delay, depending on a bunch of things but it doesnt really matter since it is a fraction of a second delay and it is not FPS Unit Control.

@anopob: i may have done that, but you just adjust the rows of the descriptions accordingly to make them have 'uniformity' if it bothers you.
Mapz_Maker is offline   Reply With Quote
Old 01-19-2007, 02:41 AM   #12
Mapz_Maker
User
 
Mapz_Maker's Avatar
 
Join Date: Nov 2006
Posts: 198

Submissions (1)

Mapz_Maker is on a distinguished road (12)

Default

Uploaded GUI Format for multiboard creation.
Mapz_Maker is offline   Reply With Quote
Old 10-18-2007, 07:31 PM   #13
Pinzu
User
 
Pinzu's Avatar
 
Join Date: Apr 2007
Posts: 180

Pinzu is on a distinguished road (21)

Default

Great!

Should require a screenshot so that I can see how it looks. But I guess it looks like a multiboard.
Pinzu is offline   Reply With Quote
Old 11-25-2007, 11:51 PM   #14
Dreadnought
User
 
Join Date: Oct 2007
Posts: 7

Dreadnought has little to show at this moment (0)

Default

Nice tutorial... but I'm kinda stuck... I make 2 multiboards and I only want them to show for player 1 and 7... It worx fine but it causes server split I think and everyone gets kicked.

For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
Custom script: if( GetLocalPlayer() == ConvertedPlayer(bj_forLoopAIndex) ) then
Multiboard - Hide Multiboard1
Custom script: endif

Custom script: if GetLocalPlayer() == Player(0) then
Custom script: call MultiboardDisplay(udg_Multiboard1,true)
Custom script: endif

Last edited by Dreadnought : 11-26-2007 at 06:11 AM.
Dreadnought is offline   Reply With Quote
Old 02-29-2008, 05:05 AM   #15
Jay_Dubbs
User
 
Join Date: Feb 2008
Posts: 1

Jay_Dubbs has little to show at this moment (0)

Default

I have done what I think is needed to add the GUI to WE, but I keep getting this error when I try to show multiboard to specific player

Code:
invalid argument type(player)
set bj_forLoopAIndex = bj_forLoopAIndex + 1

Any ideas?
Jay_Dubbs is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 10:21 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services