No announcement yet.

How do I use Variables on my Skin ?

This topic is closed.
This is a sticky topic.
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I use Variables on my Skin ?

    First, This is more for the advanced skinner/user.

    If you need some extra pull out of the commands on your skin you may need to use variables. The idea is so you can switch commands and labels when needed without making an outside application or Flash script.

    There are only a handful of commands for variables so there's not a whole lot to learn.. it's a very basic principle of programming: you assign some data to a named holder (variable) for later use. Commands and labels will parse varialbles automatically so you can use them in many different ways.

    Assigning a variable: "SETVAR;MYVAR;Hello!"
    Using that variable: "SETLABEL;CUSTOMLABEL;$MYVAR$" (you should see Hello!" in the label).

    The examples in skin commands.txt summarize most of the functionality, those are very simple commands, you just have to grasp the concept that a variable is a storage place you don't see (inside RR) that you can use as you see fit.

    Example: "SETVAR;APPPATH;C:\MyApp\Myapp.exe"
    Then you can reference the variable APPPATH like this: "RUN;$APPPATH$"

    Example: "SETVARBYCODE;MYVAR;TEMP1;c2f" (Myvar will have the same info as if you made a label of code "TEMP1", "c2f")

    Example: "SETVAR;GPSCHOICE;1"
    Then you can execute a command based on the variable using:

    Shouldn't be that hard to understand the above, the question you may have though is "how do I put this stuff to work on my behalf in my skin ?" well, here's an example, say you wanted your EXIT button of the GPS screen to execute a command if you came to the GPS screen from the Audio screen and ANOTHER command if you came to the GPS screen from the Radio screen. For example if we wanted RR to say "Returning to the AUDIO screen" or "Returning to the RADIO screen".. this is ONE way you could do it:

    GPS button of Audio screen: "GPS||SETVAR;EXITGPS;0"
    GPS button of Radio screen: "GPS||SETVAR;EXITGPS;1"
    EXIT button of GPS screen: "EXIT||BYVAR;EXITGPS;SAY;Returning to AUDIO screen<<SAY;Returning to the Radio Screen"

    Another way:

    GPS button of Audio screen: "GPS||SETVAR;EXITMSG;Returning to AUDIO screen"
    GPS button of Radio screen: "GPS||SETVAR;EXITMSG;Returning to the Radio Screen"
    EXIT button of GPS screen: "EXIT||SAY;$EXITMSG$"

    Basically, you can use $<VARIABLENAME>$ ANYWHERE in a command or label code, RR will look for that variable and replace the code before executing or interpreting the code. Only the variable commands that expect a variable name as a parameter (SETVAR, BYVAR etc) can be used without the $$ -- because they're expecting a variable name (but even then it could be used in the propper context).. if you wanted you could have done the same exit gps button like this:

    GPS button of Audio screen: "GPS||SETVAR;EXITCMD;SAY;Returning to AUDIO screen"
    GPS button of Radio screen: "GPS||SETVAR;EXITCMD;SAY;Returning to the Radio Screen"
    EXIT button of GPS screen: "EXIT||$EXITCMD$"

    If you still need an explanation:

    -on the first example I set a variable to 0 or 1 (or 2, 3 4 etc -- if desired) so that the byvar command executes a command based on that number provided. This is good if you know for sure the commands you need to execute.
    -on the second example I set a variable with the MESSAGE that you want the button to say when pressed. This is more flexible since you could have as many messages as you want using the same button code on the exit button of the gps screen.
    -on the third example I actually set the entire command I wish to execute when leaving the GPS screen, even more flexible since now I am not limited to just set the message to be spoken, but yet, I can tell it to do something else entirely if I wanted like "SETVAR;EXITCMD;PLAY" (so that it would execute "EXIT||PLAY")

    Note that I changed the names from EXITGPS to EXITMSG and EXITCMD but that was entirely by choice as there's no requirements or criteria when chooseing variable names.

    Regarding RR's settings, you should know that any setting in RR.INI is also available as a variable so if you wanted to display the night skin path you could set a label with "=$nightskin$" and it should work -- you need the = sign because RR will consider as if the contents of the variable literally were replaced at that position to the effect of: "=C:\Program Files\RR\Skins\BAV2"

    If you desire to save a setting to RR.INI you could simply set the variable (with SETVAR, OSKTOVAR etc) and then save it using the SAVETOINI command:


    Lastly, if you save a variable that is NOT a setting to the INI, that variable will auto-restore itself when loading RR. Say if you wanted to know when you hibernated RR last, you could use this at your "HIBERNATE" button for instance:

    Button Code:
    Then your Label Code on the skin could say:
    "=RR Was Previously Hibernated at $LASTHIBDATE$ $LASTHIBTIME"

    It may be a bit hard at first if you've never done any programming but this was the most logical step to providing skinners with more flexible controls without requiring them to make outside software.
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."