Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 5 - Modders Workshop > Thread: How to pass parameters to QuestionBox() callback?
Thread: How to pass parameters to QuestionBox() callback?
WindBell
WindBell


Hired Hero
posted November 19, 2009 10:13 AM
Edited by VokialBG at 18:35, 28 Jul 2011.

How to pass parameters to QuestionBox() callback?

I am creating a special building on a multiplayer map.
When touched,
( Trigger(OBJECT_TOUCH_TRIGGER,objectName,triggerFunction )
this building will show a Dialog(Prompt to do something or not, by

QuestionBoxForPlayers(GetObjectPlayer(triggerHero),"prompttext.txt",Callback,nil)

)
if the player press "OK", then execute some function in Callback.

The question is I cannot get the parameters in the QuestionBoxForPlayers() callback. The callback can only contains function name but not any other parameter so I cannot determine which player and hero this function should operate on in the callback function.

I found some solutions:

1 Create Callback1,Callback2, Callback3 ... function series ,etc, and write callback function like
"Callback"..GetObjectPlayer(triggerHero)
to execute function for each player .
I need to write 8 nearly the same functions for it , this method is really bulky and messy.

2 use a global var, set it before call QuestionBoxForPlayers and get it in the callback function . But I must create 8 global var to avoid conflict between players.
This method is shoter than 1# , but still messy and it CANNOT work in Sync Mode  for this function can be called twice at the same time which make it is impossible to identify itself.

Is there any good method to pass parameter to the callback function?


Moderator's note: for minor questions, please use [url=http://heroescommunity.com/viewthread.php3?TID=24429]the questions topic[/url]. This one is now locked!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0224 seconds