Advertisement

Author Topic: mk_taskHint (showing task hints the easy way) (ACCEPTED)  (Read 9120 times)

0 Members and 1 Guest are viewing this topic.

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
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 on how to do that), and it will output the task's current state:
Code: [Select]
[tskExample] call mk_fTaskHint;  




Screenshots













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
« Last Edit: 10 Aug 2009, 17:01:31 by hoz »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: mk_taskHint (showing task hints the easy way)
« Reply #1 on: 19 Jul 2009, 15:50:30 »
Good job.  :good:

Just two things:
  • You should consider using an OFPEC Tag.
  • The function mk_fEcho is missing.
try { return true; } finally { return false; }

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: mk_taskHint (showing task hints the easy way)
« Reply #2 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  :(

Offline Breeze

  • Members
  • *
Re: mk_taskHint (showing task hints the easy way)
« Reply #3 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

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: mk_taskHint (showing task hints the easy way)
« Reply #4 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?

Offline Porkyjack

  • Members
  • *
Re: mk_taskHint (showing task hints the easy way)
« Reply #5 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.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: mk_taskHint (showing task hints the easy way)
« Reply #6 on: 29 Jul 2009, 00:31:31 »
You should also consider packaging the script into a simple example mission.Nice work!
Xbox Rocks

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: mk_taskHint (showing task hints the easy way)
« Reply #7 on: 29 Jul 2009, 11:52:59 »
example mission added

Offline sofmisfortune

  • Members
  • *
Re: mk_taskHint (showing task hints the easy way) (ACCEPTED)
« Reply #8 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!
« Last Edit: 16 Aug 2009, 15:11:00 by sofmisfortune »

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: mk_taskHint (showing task hints the easy way) (ACCEPTED)
« Reply #9 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.