Announcement

Collapse
No announcement yet.

Increment numerical valued variables

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Increment numerical valued variables

    I want to use variables to make slight changes to a command during run time. I.e. I want run the following command

    "LOADLIST;c:\playlists\$number$.m3u;Playlist $number$"

    However, I want the value of $number$ to increment each time the command is executed. I tried plugging in mathematical expression...

    "LOADLIST;c:\playlists\$number$.m3u;Playlist $number$||SETVAR;number;$number$+1"

    But that was a no go. I also tried $number$++ to no avail.

    Any suggestions would be much appreciated.

    Also, if it makes a difference this command will be stored in ExecTBL.ini. Not in a skin file directly.
    Is it that it's fun? Or that it lets you forget yourself?

  • #2
    Nevermind

    EVAL

    I had an old copy of Skin Commands.txt.

    Is it that it's fun? Or that it lets you forget yourself?

    Comment


    • #3
      i have a piece of code thats setup to do this.
      In mine i have 2 commands, one that counts up and one that counts down.

      Just curious if you've found a way to not have negative numbers?
      01101100 01101001 01110001 01110101 01101001 01100100 01011111 01110011
      01101101 01101111 01101011 01100101

      beer replenishment fund
      http://www.mp3car.com/vbulletin/forumdisplay.php?f=93
      mp3car live search

      i have joost invites, just hit me up for one.

      Comment


      • #4
        upper / lower bounds

        I have. I set mine up to have a min/max number of playlists. Right now its set to six because thats the number of playlist buttons I have on the skin I'm working on. But it could be any number you wanted it to be. Here is my code from ExecTBL.ini...

        Code:
        /, Custom Increment/Decrement Commands for Playlists
        "INCPLAYLIST","EVAL;playlistnum;$playlistnum$+1||LOADLIST;c:\playlists\$playlistnum$.m3u||SAVETOSKIN;playlistnum;$playlistnum$"
        "DECPLAYLIST","EVAL;playlistnum;$playlistnum$-1||LOADLIST;c:\playlists\$playlistnum$.m3u||SAVETOSKIN;playlistnum;$playlistnum$"
        
        /, Car2PC Commands
        "ND ","EVAL;maxbound;strcomp("$playlistnum$";"6")||BYVAR;maxbound;INCPLAYLIST<<"
        "PD ","EVAL;minbound;strcomp("$playlistnum$";"1")||BYVAR;minbound;DECPLAYLIST<<"
        Since VB doesn't really distinguish between chars/strings/integers you can do a string compare against your upper/lower bounds. The EVAL strcomp returns a 1 if your at your min/max. Using BYVAR I then increment/decrement if EVAL statement returns a 0 (you're not at either bound). If it returned a 1 then I do nothing. The current playlist number is saved to skin.ini so that it doesn't reset everytime you reload RR.

        I've tested this and it works great. You can change the number of possible playlists by modifying the "6", and "1" in the two Car2PC command lines. This is probably clear as mud, but it really does work well. Knowing you though, you've probably got a cleaner solution already.
        Is it that it's fun? Or that it lets you forget yourself?

        Comment


        • #5
          cool thanks, thats what i was missing, min/max values. I just need another eval and or byvar that looks at the current number and if it matches the min do nothing.
          You code looks fine to me, pretty much the same way i did it, minus the min/max.
          01101100 01101001 01110001 01110101 01101001 01100100 01011111 01110011
          01101101 01101111 01101011 01100101

          beer replenishment fund
          http://www.mp3car.com/vbulletin/forumdisplay.php?f=93
          mp3car live search

          i have joost invites, just hit me up for one.

          Comment

          Working...
          X