Jump to content
Sign in to follow this  
zwobot

buttonSetAction does not work

Recommended Posts

I want to change a button's action in a dialog via buttonSetAction command.

The biki says:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">buttonSetAction [idc, code]

example:

buttonSetAction [100, {player exec "reply.sqs"}]

This does not work because of the curled braces '{}'.

The other variant in the Biki:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">buttonSetAction control

example:

buttonSetAction [100, "player exec ""reply.sqs"""]

This does work, but only for a single command with no "" in it though.

This is very inconsistent as the Biki also says that code must be surrounded by { }, but in this case this does not work.

How can I set an action for a button that consists of 2 commands like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[arg1, arg2] call (compile preprocessFile "function.sqf"); closeDialog 0

Share this post


Link to post
Share on other sites

try using appropriate semicolons (;) inside the curled braces. The Biki is notorious for never adding those in examples wink_o.gif

try

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

buttonSetAction [100, {player exec "reply.sqs";}]

I didn't test it though, just an idea.

Share this post


Link to post
Share on other sites

Thanks for the answer Donnervogel but unfortunately it makes no difference crazy_o.gif

Share this post


Link to post
Share on other sites

Nobody else with dialog knowledge has a solution for this? confused_o.gif

Share this post


Link to post
Share on other sites

Make sure you have a valid IDC and there are no duplicate IDC values used. It's hard keeping them unique.

The string syntax works fine. I use it in my Team Status Dialog. Check it for examples. I couldn't get the curley braces syntax to work, but didn't try too hard.

Examples:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">buttonSetAction [Valid_IDC, "hint 'Next Page button is not implemented yet';" ];

buttonSetAction [Valid_IDC, "[_group] call TSD9_CreateCloseGroupButtonAction" ];

buttonSetAction [Valid_IDC, "[""Group"", [player]] call TSD9_FillGroups;" ];

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">buttonSetAction[IDC," [arg1, arg2] call (compile preprocessFile ""function.sqf""); closeDialog 0"]

Doesnt that work?

And I wouldnt recommend a IDC like 100. It could be reserved by ArmA. To be sure use four digits.

Share this post


Link to post
Share on other sites
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">buttonSetAction[IDC," [arg1, arg2] call (compile preprocessFile ""function.sqf""); closeDialog 0"]

Doesnt that work?

That seems to work, thank you all. I did not know that you have to escape " with " ...

Anyway I'm quite annoyed about the curled braces vs "" thing. Why do I have to use "" instead of { } ? I dont get it crazy_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×