zwobot 22 Posted March 18, 2007 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
Donnervogel 0 Posted March 18, 2007 try using appropriate semicolons (;) inside the curled braces. The Biki is notorious for never adding those in examples 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
zwobot 22 Posted March 18, 2007 Thanks for the answer Donnervogel but unfortunately it makes no difference Share this post Link to post Share on other sites
zwobot 22 Posted March 19, 2007 Nobody else with dialog knowledge has a solution for this? Share this post Link to post Share on other sites
dr_eyeball 16 Posted March 19, 2007 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
t_d 47 Posted March 19, 2007 <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
zwobot 22 Posted March 20, 2007 <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 Share this post Link to post Share on other sites