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

Title: mk_taskHint (showing task hints the easy way) (ACCEPTED)
Post 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:
Code: [Select]
// 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:
Code: [Select]
[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)
Title: Re: mk_taskHint (showing task hints the easy way)
Post by: Worldeater on 19 Jul 2009, 15:50:30
Good job.  :good:

Just two things:
Title: Re: mk_taskHint (showing task hints the easy way)
Post by: mikey on 19 Jul 2009, 19:18:50
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  :(
Title: Re: mk_taskHint (showing task hints the easy way)
Post by: Breeze on 25 Jul 2009, 21:06:57
Ok so where do we put the echo thing cause I got an error when just trying to call the script
Title: Re: mk_taskHint (showing task hints the easy way)
Post by: mikey on 26 Jul 2009, 18:15:15
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?
Title: Re: mk_taskHint (showing task hints the easy way)
Post by: Porkyjack on 27 Jul 2009, 15:49:14
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.
Title: Re: mk_taskHint (showing task hints the easy way)
Post by: hoz on 29 Jul 2009, 00:31:31
You should also consider packaging the script into a simple example mission.Nice work!
Title: Re: mk_taskHint (showing task hints the easy way)
Post by: mikey on 29 Jul 2009, 11:52:59
example mission added
Title: Re: mk_taskHint (showing task hints the easy way) (ACCEPTED)
Post by: sofmisfortune on 16 Aug 2009, 01:43:52
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!
Title: Re: mk_taskHint (showing task hints the easy way) (ACCEPTED)
Post by: mikey on 17 Aug 2009, 13:11:46
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.