help with new script?

Smokies Stash

New Member
Looking for some help with this script, Menus are showing but scripts arnt executed when the options are selected. here it is



Dock.Sqf

if (isServer) exitwith {};
waitUntil {sleep 2; count vehicles > 1};
sleep 10;
{
If (typeOf _x in ["RHIB2Turret","RHIB","Zodiac","PBX"]) then {
_Smokie = _x addAction [("<t color=""#2bc0a7"">Boat Options</t>"),"LHD\Options\Options.sqf","boat",1,false,true,"","driver _target == player"];
};
}forEach (vehicles);



Above gives the scroll option "Boat Options", works fine, once clicked on it displays Options.Sqf which is -

private["_420","_THC"];
_420 = "LHD\option\";
_THC = 'player execVM "'+_420+'%1"';
Smokie =
[
["",true],
["Dock", [2], "", -5, [["expression", format[_THC,"launch1.sqf"]]], "1", "1"],
["Launch", [3], "", -5, [["expression", format[_THC,"launch.sqf"]]], "1", "1"],
["", [-1], "", -5, ["expression", ""], "1", "0"],
["Exit", [13], "", -3, ["expression", ""], "1", "1"]
];
showCommandingMenu "#USER:Smokie";



"Dock" and "Launch" are showing in the Scroll Menu but they are not executing the scripts once they are selected.


(Oh "Exit" isnt showing in the scroll menu aswell)




If anyone could lend a hand with this it would be muchly appriciated
 
I believe what the error is is that you are trying to use a string in the format instead of a variable. I'm not sure if that's possible.

Here's what I think the code views it as:
Code:
["Dock", [2], "", -5, [["expression", format[player execVM "LHD\option\%1","launch1.sqf"]]], "1", "1"],

Maybe try defining launch.sqf and launch1.sqf earlier and call it as a variable?

The other theory I have is that its making player execVM part of the string, instead of what is called meaning you would need to try this instead:
Code:
["Dock", [2], "", -5, [["expression", player execVM format["LHD\option\%1","launch1.sqf"]]], "1", "1"],
 
Thanks for the Quick reply!, Ill give that a try now, Basically what im trying to do is add an action to ALL boats, if i place a ship through the editor and put this in the Init line
this addAction [""Dock Boat"",""LHD\launch1.sqf"",[],1,false,true,"""",""_this == driver _target""];
this addAction [""Launch Boat"",""LHD\launch.sqf"",[],1,false,true,"""",""_this == driver _target""];this setVariable[""original"",1,true];"; then both options show and the scripts are excuted fine.



i also got Dock Working correctly with this
"[]execVM Dock.sqf" - in the init.sqf

"Dock.sqf"

if (isServer) exitwith {};
waitUntil {sleep 2; count vehicles > 1};
sleep 10;
{
If (typeOf _x in ["RHIB2Turret","RHIB","Zodiac","PBX"]) then {
_isSmoke = _x addAction [("<t color=""#007ab7"">Dock Boat</t>"),"scripts\launch1.sqf","original",1,false,true,"","driver _target == player"];
};
}forEach (vehicles);




but i got picky and wanted both Dock, and Launch in one submenu.

Any input is appreciated :D
 
Code:
private["_SWP","_SWE"];
_SWP = "scripts\lhd\";
_SWE = 'player execVM "'+_SWP+'%1"';
Boat =
[
    ["",true],           
        ["Dock", [2], "", -5, [["expression", format[_SWE,"launch1.sqf"]]], "1", "1"],
        ["Launch", [3], "", -5, [["expression", format[_SWE,"launch.sqf"]]], "1", "1"],
        ["", [-1], "", -5, ["expression", ""], "1", "0"],
        ["Exit", [4], "", -5, ["expression", ""], "1", "1"]       
];
showCommandingMenu "#USER:Boat";


Didnt change much but its working now. changed a few variables and that did the trick

thanks for the quick reply vamp
 
Back
Top