OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Resources Beta Testing & Submission => Topic started by: mikey on 19 Jul 2009, 15:09:50
-
The taskHint command by BIS is too difficult to use for novice scripters since it requires the scripter to provide the formatting, rgba and the icon name to use. So a few weeks ago I wrote a function to simplify all this. I thought I'd share it.
How to load the function
In your init.sqf, put this:
// Create a taskHint
// Usage: [tskExample] call mk_fTaskHint;
// Gets the taskState of the passed task, and shows the status on screen
mk_fTaskHint = compile (preprocessFileLineNumbers "fTaskHint.sqf");
** NB: Change the filepath to where you keep the file. This is just a copy and paste from my own template **
How to use the function
This function will only work with tasks you've created (see my briefing tutorial (http://www.ofpec.com/forum/index.php?topic=33468.0) on how to do that), and it will output the task's current state:
[tskExample] call mk_fTaskHint;
Screenshots
(http://img198.imageshack.us/img198/7425/statuscreated.png)
(http://img229.imageshack.us/img229/3751/statuscurrent.png)
(http://img229.imageshack.us/img229/206/statuscanceled.png)
(http://img141.imageshack.us/img141/1043/taskstatus.png)
(http://img198.imageshack.us/img198/8429/statusfailed.png)
NB:
- Task hints are different from regular hints, so they can be used at the same time.
- Task hints last only very shortly.
- This function does not manipulate the task at all, it only echo's out the current state.
OFPEC Download (http://www.ofpec.com/ed_depot/index.php?action=details&id=527)
-
Good job. :good:
Just two things:
- You should consider using an OFPEC Tag (http://www.ofpec.com/tags/index.php).
- The function mk_fEcho is missing.
-
Calls to mk_fEcho have been commented out (that was silly of me).
And I would register my tag, but i've kinda grown accustommed to my mk tag, and ofpec rules state a 3 to 5 letter tag :(
-
Ok so where do we put the echo thing cause I got an error when just trying to call the script
-
I just downloaded the version hosted here, and tried it in a mission which doesnt use my mission template, and it works fine for me?
Can you elaborate on your problem?
-
Hello mate :)
I need some help, could you make a dummy tutorial how to do this, please?
Where to put the script lines, which files etc etc.
-
You should also consider packaging the script into a simple example mission.Nice work!
-
example mission added
-
Thanks for the script and templates. I am having trouble as it will show my current task and then say completed before i reach the marker. What triggers the the completed message? sorry if this is a dumb question, I am new to this.
Any help would be appreciated!
-
This script solely echoes out the current state of the task, so if you set the task to completed with the "setTaskState" command, and then call the function, it will show that you've completed the task.
So what I think is wrong in your case is that you execute tskWhatever setTaskState "SUCCEEDED" too early.