Jump to content
Piloto_Spyke

Execute Script form Task description link

Recommended Posts

Hi everyone,

I'm trying to make a script that allows you to cancel a mission by clicking on a text that says CANCEL in the description of the task.

Script:
_descript1 = "<execute expression=' [1] call compilefinal preprocessFileLineNumbers'DMG\functions\fn_CancelM.sqf' '>CANCEL</execute>"; 

And then in the task:

[blufor, ["Tarea_"+_IDTarea], [_descript1,_titulo,_marker], _posicion, true, 1, true] call BIS_fnc_taskCreate;

 

If I put it in this way the result is that nothing comes out.

 

Thanks for your help

Spyke

 

is my first post in this forum, if I do not have to say it here please tell me.
I found it here: 

Share this post


Link to post
Share on other sites

Edit ....Oh wow, necrothreading.... 1 year exactly....sorry but..

 

Although not answering your question specifically....

 

The issue I have found is that the 'string' part can't have any ' " in it.

 

You can set up some code in the missionNameSpace such as

 

missionNameSpace setVariable ["myTag_SomeCode", {hint "Hello"; hint "Goodbye";}];

then  

_text = "<execute expression = 'call myTag_SomeCode' >Long line of text which you can click goes here OK? </execute>";
player createDiaryRecord ["mySubject", ["myTitle", _text]];

and that works from the diary in the map.. haven't tried within a task...

 

I may have missed a trick with the code as a string in the tag... it never seems to want to work if you have any ' or " characters in it but, as I say, I might be missing something simple here.

 

I know I'll call up some superusers! @killzone_kid, @Larrow? Any ideas? (and the rest of you!)

 

Atmo

Edited by atmo
  • Thanks 1

Share this post


Link to post
Share on other sites

TAG_fnc_cancelTask = {
	params[ "_taskID" ];
	
	if ( _taskID call BIS_fnc_taskExists && { !( [ _taskID ] call BIS_fnc_taskState in [ "CANCELED", "FAILED", "SUCCEEDED" ] ) } ) then {
		_taskDescription = [ _taskID ] call BIS_fnc_taskDescription;
		_taskDescription set[ 0, "The task has been canceled" ];
		[ _taskID, _taskDescription ] call BIS_fnc_taskSetDescription;
		[ _taskID, "CANCELED" ] call BIS_fnc_taskSetState;
	};
};

_taskID = format[ "Tarea_%1", _IDTarea ];
_descript1 = format[ "<execute expression='[ %1 ] call TAG_fnc_cancelTask'>CANCEL</execute>", str _taskID ];
[blufor, _taskID, [_descript1,_titulo,_marker], _posicion, true, 1, true] call BIS_fnc_taskCreate; 

 

  • Like 4
  • Thanks 2

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

×