HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

dialog problems

06-06-2003, 09:56 PM#1
Earth-Fury
[triggerign player] dosent refrence the player that clicksa dialog button in the event dialog button is clicked for [dialog]

what will refrence the clicking player? if nothign will, how do i detect who clicked the button?
06-06-2003, 10:12 PM#2
Earth-Fury
hmmm...... i have been able to get it to work with getlocal player (umswe gui get localplayer command) but will getlocal player cause desync when used in that fashion?
06-07-2003, 05:02 AM#3
Dead-Inside
OH, so that's what's wrong... Geeezzzzzz! Thx EF. I knew it wasn't my fault but I didn't feel like fixing ANOTHER major bug...

Regards

(I was talking about my map)
06-07-2003, 05:45 AM#4
zotax
Anyone else know how to detect when different players click diaoug buttons? Ill like to have my map tlly up the votes when everyone is finished voting, as opposed to at a set time.
06-07-2003, 01:45 PM#5
Earth-Fury
im gonan see if getlocal player causes split.
06-07-2003, 02:22 PM#6
ChrydGod
Did you try to use a dialog array, displaying a different one for each player ?

Then you wouldn't have any problem finding out who clicked a dialog button ^^


Regards
06-07-2003, 02:29 PM#7
Earth-Fury
i coulkd easily do that. but i am tring to mker headway in the world of triggerin =P not just makin my map work.
06-07-2003, 06:31 PM#8
MicrosoftXP
the ONLY way to detect who clicked a button shown to multiple players is.... none. You have to show one dialog to one player ONLY. This means u need copies of your dialog, and put all the buttons in a large dialog array. Run through the entire array to find the index of the clicked button, do some math to determine who's dialog is belonged to.

this is the ONLY way to do it. Also if you don't have multiple dialogs, as soon as one player clicks a button, the menu disapears for all other players.
06-07-2003, 06:36 PM#9
Earth-Fury
problem: dialog arrays dont work........ damnet.
06-07-2003, 06:54 PM#10
Dead-Inside
Dialog arrays do work... Look up another post, I had the same problem. Called Buyers and Sellers gamble edition
06-07-2003, 07:16 PM#11
Guest
i had this problem before when i wanted to make a dialog for selecting teams. took me a long while to make it work.

dialog arrays dont work if you dont create it or set it as something else. non-array variables are already created by the map.

so to create it, you will need to use jass.

set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 12
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Dialog[GetForLoopIndexA()] = DialogCreate()
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop

i think that show u r suppose to do it. if that work, then everything is ok.

but when i tried to do it this way the dialog does show but i the events for "button clicked" doesnt work for the array variable. so i decided, instead of using create dialog, ill just have a variable for each dialog and set the array to each of them. then you can use the integerA action to add the dialog buttons and show the dialog in one trigger instead of having to use multiple triggers.

for each integerA from 1 to 12 create a dialog button for dialog[integerA]
set button[integerA] = last created dialog button

then you have the trigger for the actions for the buttons. so instead of using the array dialogs for the events, use the individual dialogs that you set the array to. you will have the same number of events either way. now the action is

for each integerA from 1 to 12, if clicked dialog button equal to button[integerA], then do run trigger2, else do nothing

trigger 2 will contain all the actions. remember to use integerA when refering to the player.

if it still doesnt work, then try setting the individual dialog variables to the array ones a second time after you add the buttons. so array = var before adding buttons and var = array after.



it may seem like alot to do but this is the shortest way to do it that i know. even though you need lots of variables, you wont end up with tons of triggers except for the set dialog actions per dialog. if im wrong and someone else has a shorter way then correct me.
06-07-2003, 07:57 PM#12
Dead-Inside
EF, disregard the above post, you need 3 lines of code to do this.

loop

xxx
xxx Cencored.
xxx

endloop

This is probably not correct, but almost. If you have less then 12 players using the dialog array then just change the number. I do suggest you look up the other post... Wait, never mind I'll do it for you.

Code:
function Trig_InitDialog_Actions takes nothing returns nothing
    local integer i = 1

    loop
        exitwhen i > 8
        set udg_Dialog[i] = DialogCreate()
        set i = i + 1
    endloop
endfunction

//============
function InitTrig_InitDialog takes nothing returns nothing
    set gg_trg_InitDialog = CreateTrigger(  )
    call TriggerAddAction( gg_trg_InitDialog, function Trig_InitDialog_Actions )
endfunction

There you go, remember to check the "Run on map intialization" button!! If you don't, it wont work.

Regards
Dead-Inside
06-07-2003, 08:27 PM#13
Earth-Fury
my maps doe nw n e way. i just need to balance/spify up.
06-07-2003, 10:46 PM#14
Draco
The only way to detect which player clicks a dialog that is up for everyone is with JASS. Ask Weaaddar how to do it. And, if you don't like JASS, don't use the same dialog for everyone, so don't go "wah wah, i don't like JASS"
06-08-2003, 01:01 AM#15
zotax
This may be a stupid question, but here goes:
For my map ive got a dialoug system, everyone gets a 3 choices, you pick an option, and then it goes away. Then at 15 secs of game time a trigger compares the integers to see which is bigger.
Could i set it so that when a player clicks a dialoug button, it adds +1 to a integer variable, and then when the variable is equal to the number of players playing, it compares the integers, to determine which dialoug box was the most clicked?
JASS and stuff is beyound me, so a yes/no answer would be great.