[Android Apps and Games] deejaylobo:
Hey, guys. I've been looking to use Tasker for awhile now but, it's just been laying dormant in my app drawer because I was too overwhelmed by all the options. Anyway, I finally got around to using it when I discovered a Domo-kun wallpaper that I just had to use and customise. And what I've got is in this post.

http://xdaforums.com/showpost.php?p=14898952&postcount=33983

In this tutorial we will be trying to understand how to use Tasker's Minimal Text Widget Plugin and Variables. So, let's get down to it.

Objectives

Get Domo-kun to "say" stuff based on various events on the phone.

Get Domo's messages to cycle based on a preset time period.

Variables

These are basically empty labels that you must direct Tasker to fill. You can fill them with a string of characters, or with numbers and you can also perform basic math functions on them.

Minimal Text Widget Plugin

This enables Tasker to display stuff via Minimal Text Widget.

What we need

We will need a way of keeping time, so that messages will change after a specified time.

We will need a way of setting a preset message that corresponds to the battery state.

We will need a way of setting a preset message that corresponds to the wifi state.

We will need a way to tell Minimal widget when to display a message.

We will need a way to tell Minimal Widget what message it should display.

Setting a timer that will change the message after preset time.

The context for this is obviously every 'x' minutes. So we start a new profile with a Time context, and set that to repeat every 'x' minutes.

Now, we need a variable(y) that will change after every 'x' minutes(y+1), this will eventually tell our widget when it's time to change the message. So, this will be the action for this particular context. Add a new task to the context, select Variable>>Variable Set. Let's name our variable, I will call mine %SET. The necessary action after every 'x' minutes is '%SET + 1' so this is what we will put in the "To" field. Remember to check the box "Do Math", this will treat the variable as a number, and enable us to perform the required math on it.

Let's take a look at what will happen, when this profile is active.

Every 'x' minutes, the Variable %SET will be set to %SET + 1. So, if %SET starts at 0, after 'x' minutes it will be 0 + 1; it will be 1; after another 'x' minutes it will be set to %SET + 1, 1+1; it will be 2, and so on.

You now have a variable that changes every 'x' minutes.

Setting a preset message according to the battery state.

I want to make Domo tell me how my battery is doing when it's at four different states (100%-75%, 75%-50%, 50%-25%, 25%-0%).

So, now we have four different contexts(battery ranges) in which Tasker needs to perform certain actions(Domo will say something). Let's start creating them.

For the first context(battery level 75-100) we want to display "Your battery is good". So, we will first define the context. In this case the context is a "State" in which the phone is in. Therefore our required context is in the "State" category>>Battery level, choose the range, I will choose 75 - 100. Since the message changes based on the level, we will need to set a variable here. I will call mine %BATTSTAT, and set it to "Your battery is good".

We have to repeat the steps for the other 3 battery levels. So, we create new State>>battery level profiles but, we use the SAME Variable(%BATTSTAT) for the message.

(50-74) - set %BATTSTAT to "Your battery is OK"

(25-49) - set %BATTSTAT to "Your battery is low"

(0-24) - set %BATTSTAT to "Your battery is going to die"

What is going to happen when this profile is active?

When the battery level is between 75-100 the %BATTSTAT will be "Your battery is good", when battery level hits 74, %BATTSTAT will immediately change to "Your battery is OK", and so on.

We now have a variable(%BATTSTAT) that holds a message depending on the battery level.

Setting a preset message according to wifi state.

This is pretty much the same as setting the message for battery level. The only difference is we will use a an exit task for when wifi is not connected. An Enter Task are the actions that take place when a state is entered, an Exit Task are the actions that take place when a state is exited.

So, new profile, State>>Wifi Connected, set %WIFISTAT to "Your wifi is connected", now if we don't set the %WIFISTAT Variable to change when the wifi is disconnected, it will always hold the message "Your wifi is connected". So we set an exit task for the variable %WIFISTAT to say "Your wifi is disconnected".

Okay! We now have,

%SET - A Variable that increments every 'x' minutes

%BATTSTAT - A Variable that holds a message corresponding to the battery level

%WIFISTAT - A Variable that holds a message corresponding to the wifi status

Getting tasker to communicate with Minimalistic Text Widget

This is fairly simple, all we need to do is define a variable for MTW, and set to what we want to say, in this case the message within the tasker variables (%BATTSTAT or %WIFISTAT). So, the action would be within "Plugin">>Minimalistic Text Widget. You have a field for Minimalistic Text Widget's Variable and you have a to field.

Now, we need a way to send our messages to Minimal Text Widget at the right time.

We use our Time variable to tell us what's the time. If, %SET = 0 we will send %BATTSTAT to the widget, if(after 'x' minutes) %SET = 1, we will send %WIFISTAT to the widget. Now, our next context depends on the Variable %SET, so this will be the context we coose. Event>>Variable>>Variable Set, enter the Variable(%SET) in Name field and what it will be when we perform our action (sending data to MTW) in this case, '0'. The action to perform will be, Plugin>>MTW set a Variable %DISP to %BATTSTAT.

Now we repeat this for 'x' minutes later when %SET = 1, so a new Event context has to be made, where the variable %SET = 1, and here we will send the wifi status to MTW. So, Plugin>>MTW set Variable %DISP to %WIFISTAT.

What happens here is, when %SET = 0 (at the beginning of our cycle) Tasker will send the message within %BATTSTAT to %DISP. 'x' minutes later, when %SET = 1, Tasker will send the message within %WIFISTAT to %DISP. But, wait! What happens when 'x' minutes later our time variable increments(%SET + 1 ie. 1+1 = 2)? This is a problem because we have not made a profile for %SET = 2, in relaity we don't need one because there are only two kinds of messages we want to send to MTW.

We need to reset our counter. So, we make a new Event profile for when the variable %SET is greater than 1. All we need to do is set %SET to 0.

Displaying our messages on MTW

Create your Minimalistic Text Widget, within it's "Misc" tab find Local Variable and put in the name of your MTW Variable, in this case, it is %DISP. And you're done!

___________________________________________________

This is my first attempt at writing a tutorial and also I've only been using Tasker for a couple of days, so the above procedure might not be completely optimized. Maybe our Dev/Programmer friends can enlighted us. I tried to write this tutorial not so much as a hold your hand and give you a play by play but, more as a I hope you learn something about the way Tasker works and find better uses for it. I hope it was helpful. I don't think pictures are actually necessary if people get their feet wet with Tasker but, if people think it's absolutely necessary, I will post some.