maxqubit 1 Posted February 2, 2007 Edit: Sorry for the title. A ? is missing. This is a question (not a solution) -- I would like to pass parms to the script i define in addAction. Can that be done (ArmA) and if yes, how? This works: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_idct = sabheli addAction ["BCN" + (r5names select 1), "test.sqs"] But i want to pass parms to test.sqs like in: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[player, sabheli, "sabhelitxt", 1000, 1] exec "test.sqs" This doesn't work (as expected): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_idct = sabheli addAction ["BCN" + (r5names select 1), [player, sabheli, "sabhelitxt", 1000, 1] exec "test.sqs"] But in the wiki some 'arguments' is possible after script ... What are those and how to use them? Like so? (doesn't work): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_idct = sabheli addAction ["BCN" + (r5names select 1), "test.sqs", [player, sabheli, "sabhelitxt", 1000, 1]] Tia Share this post Link to post Share on other sites
Lolsav 0 Posted February 3, 2007 According with biki with addaction you can get those values. I managed to be sucessfull with that in the editor. The thing is, maybe because of my lack of knowledge, i found it to be buggy when it comes to multiplayer. Parameters of the called script: An array of parameters is passed to the called script: [unit, caller, ID] Ill try to explain with an example: actionid = something addAction ["Switch on", "activate.sqs"] in the script i would have: _unit = _this select 0; _caller = _this select 1; _id = _this select 2; By then, having these variables, you can decide what you want to do with them. I hope i was clear enough and it helped on your needs. Share this post Link to post Share on other sites
maxqubit 1 Posted February 5, 2007 Thx but not exactly what i want (to know) In stead of: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">actionid = something addAction ["Switch on", "activate.sqs"] I want something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">actionid = something addAction ["Switch on", ["parm"] exec "activate.sqs"] So, i want to pass "parm" to the script (activate.sqs). I know select 0,1,2 are already reserved for unit,caller,id. If above is not the right way to go i have another question. The wike says: unit addaction [action, script,(arguments,priority, showWindow, hideOnUse, shortcut)] - for ArmA So what are ,(arguments,priority, showWindow, hideOnUse, shortcut) doing? And how/why would you use them? Share this post Link to post Share on other sites
UNN 0 Posted February 5, 2007 You can pass a parameter like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Player AddAction ["Buy an Ice cream","Script.sqf",99] To access the passed parameter (in this case 99) from within Script.sqf, you just use: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Param=_This Select 3; Hint Format ["I would like a %1 please.",_Param]; Share this post Link to post Share on other sites
maxqubit 1 Posted February 5, 2007 You can pass a parameter like this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Player AddAction ["Buy an Ice cream","Script.sqf",99] To access the passed parameter (in this case 99) from within Script.sqf, you just use: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Param=_This Select 3; Hint Format ["I would like a %1 please.",_Param]; Absolutely 100% what i was looking for. Thx mate! I've used it like this: addaction script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> r5 = [r5heli, r5unit1, r5unit2, r5unit3, r5unit4] r5txt = ["r5heli", "r5unit1", "r5unit2", "r5unit3", "r5unit4"] r5names = ["HLI174", "Lt. Kowalski", "Corp. VandenBerghe", "Sgt. Jackson", "Pvt. Mhin"] r5beaconrange = [1000, 100, 100, 100, 100] r5beaconfreq = [1, 5, 10, 10, 10] for [{_i=0}, {_i<5}, {_i=_i+1}] do {_id = r5heli addAction ["Beacon " + (r5names select _i), "pbt.sqs", [player, (r5 select _i), (r5names select _i), (r5beaconrange select _i), (r5beaconfreq select _i)]];}; action scrpt (pbt.sqs): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _parms = _this select 3 _pbt = _parms select 0 _beacon = _parms select 1 _beacontxt = _parms select 2 _beaconrange = _parms select 3 _beaconfreq = _parms select 4 ... etc ... resulting in: - dynamic building of action descriptions - just 1 script called - parms to this 1 script passed thru an array of values Thx again! Share this post Link to post Share on other sites