Sign in to follow this  
xhui

Storm Inferno - Script Guide

Recommended Posts

xhui    0

hello, can someone point me to a guide/faq on how to use the scripts on the inferno mouse? the part I don't understand are those commands, like IF (Variable), call, etc.

also if someone can write me a simple script for this would be nice~

i want to press f1 every 30sec and between that 30sec press 1,2,3,4 etc. once the timer on 30 sec is up stop pressing 1,2,3,4 and press f1 again, all that with only holding a mouse key

Share this post


Link to post
Share on other sites
tacoman    0

Hi there :D Sorry this is such a long post, but I am hoping this will very clearly explain how things work, so even someone with no scripting or programming experience can understand.

There are probably a few ways to approach this, but I will do my best to explain one way of how to do a script that will do exactly what you want and how it works. Like most things when it comes to scripting/programming, there are often different ways to solve the same issue, with some being more complex than others. This is the simplest way I could think of to do what you want. EDIT: An example that does the same thing without using variables, by just using the loop command can be found in a later post located here.

The whole thing only takes 14 lines including the ones for all the key press/releases. While I don't have the CM Storm Inferno like you, I do have the CM Storm Sentinel Advance, so my screenshots will probably look slightly different than the way yours do. Based on a quick look through your manual though the overall process and script should work the same for you on your mouse as it does on mine, but since I don't have your mouse I can't guarantee it will (but it should).

I will try and explain what the commands in my example script do. Then I will get to the actual script.

First of all you have the keypress down event, which is the icon with the red down arrow and a keyboard below it, then there is the key release events which is the one with the blue up arrow and a keyboard below it. These are just like when you push down a key or let go of a key on your keyboard. The other things besides the keypresses used in the script will be: Variable Assignment, GOTO, and IF (Variable).

What Variable Assignment does is it lets you assign or change a value to a variable. So for example this will let you set the variable A to 0, or some other number of your choosing. In the instruction window this will look like: SET A = 0. Also note that you can use other variables (or even the same one) as part of your assignment. So a couple examples are you could also do something like Set A to B + 5: SET A = B +5, or Set A to whatever A is + 1: A = A+1 (basically just increment A by 1, so if A was 10 then it would set A to 11).

GOTO lets you make the script Go to whatever line you would like. Normally the way a script runs is it starts at the first line of the script executes whatever command is on that line, and then goes to the next line (line 1, then line 2, line 3 etc). What the GOTO command lets you do is make it skip forwards or backwards to whatever line you want instead of just going to the next line. So you can use this to skip over part of a script, or repeat it, etc. Keep in mind that whenever just a regular GOTO line is executed it will always go to whatever line you pick. So if you had

1: Press "L"
2: Release "L"
3: GOTO 1
4: Press "G"
5: Release "G"

This would never push the "G" key because it executes line 1, then line 2, and then when it gets to line 3: GOTO 1, this will make it GO TO line 1 again (instead of going to the next line in the script), and you have a never-ending loop. Depending on which execution mode you picked (see the manual for the 8 different types), this would be an issue if you picked an execution mode that doesn't have a way to stop the script as the script would just keep on running forever. Note: You should be able to find the manual in the "Downloads & FAQS" section of the cmstorm.com product page for your CM Storm Inferno Mouse.

What IF (Variable) does is let you check to see if to see if a variable meets a certain condition, and if it does then it will go to a specific line in your script. Basically This is a conditional GOTO, if the condition is true it goes to that line, if it isn't true it will just keep on going and execute what ever is on the next line. So, for example you could check and see if the variable A == 3 and if it does then it will go to whatever line you like. The different conditions you can check for are: Less Than "<", Greater Than ">", Greater Than OR Equal to ">=", Less Than OR Equal to "<=", Equal To "==", Not Equal To "!=". Between all these conditions, that pretty much covers any comparison you would want to do.

Also another important thing you should know is what Instruction Cycle means. This is the number of milliseconds it takes the mouse to execute each line of the script.

Hopefully that helps clarify what those different commands do. Here is an example script you asked for that will Push F1, then push 1, 2, 3, 4 over and over again for 30 seconds, and then repeating this over and over till you let go of the button. There are two important things to note. Execution mode is set to: Loop (Hold), and instruction cycle is set to 12ms.

1: Set A = 0
2: Press "F1"
3: Release "F1"
4: Press "1"
5: Release "1"
6: Press "2"
7: Release "2"
8: Press "3"
9: Release "3"
10: Press "4" 
11: Release "4"
12: SET A = A + 1
13: IF A < 250 GOTO 4
14: GOTO 1

So when the script starts, Line 1 sets A to 0 (we will be using it in a little bit, and want to make sure it starts out at 0).

Lines 2 through 11 push and release their respective keys. When recording the keypresses for the script I disabled the WITH TIME setting before recording so that it just records each key press and release event without recording the amount of time (delay) it takes me to push them. This will make the delay for each key press and release event equal to the Instruction Cycle, but if you like, you can double click the line for each key press/release event if you want to change the delay, you just cant make it shorter than whatever instruction time you have chosen. If you wanted to record the delay between keypresses you would have to have the the WITH TIME setting enabled, but honestly i find it easier (and more accurate) to just set the delays manually if you want a delay, rather than trying to time each keypress just right when recording.

Line 12 Sets A to A + 1, so each time the script gets to line 12, A will be increased by one. This provides us with a handy way to keep track of how many times we have executed line 12 in the script.

Line 13 checks to see if A is less than 250, if it is it goes to line 4, which is the line that pushes the 1 key down. This is important as it lets us keep repeating the pushing of the 1, 2, 3, and 4 keys (lines 4-11 in the example) without repeating the whole script. If you just repeated the whole thing over and over you would be having it push F1 every time and you only wanted it to push it once every 30 seconds. Hopefully that makes sense. So it will loop through pushing 1, 2, 3, 4 each time UNTIL A is no longer less than 250. Remember line 12 adds 1 to A each time, so it will push the 1,2,3,4 keys 250 times at which point when A is 250 (the 250th time in the loop) at line 13, instead of going to line 4, since A is 250 the IF statement "IF A < 250 GOTO 4" is no longer true so it will just go to the next line, line 14 in this case.

Line 14 just makes it go to line 1. This means A is set back to 0 and the whole process is started over again and F1 is pushed once again and then it repeats pushing the 1,2,3,4 keys until its done that 250 times :D Since the execution mode is set to Execution mode is set to: Loop (Hold) this means it will just keep executing the script until you let go of that button at which point it will immediately stop pushing keys/running the script (even if it is in the middle of the script). If you push the button again it will start over back at the beginning so A will be back at 0, it will hit F1 first once, and then push the 1,2,3,4 keys 250 times. Now you are probably wondering where i got the number 250, and how i knew that was the right number of times to push the 1,2,3,4 keys so that it would be for 30 seconds. Since in this example the Instruction Cycle is set to 12ms and the delay for each keypress is also set to 12ms it makes it really easy to figure out how many times you want to repeat the loop. 1 second = 1,000 ms, so 30 seconds is just 30 * 1,000ms = 30,000ms. So we want it to repeat for 30,000 milliseconds. Each line just takes 12ms to do and the part of the loop we are repeating is 10 lines (lines 4 through 13). This mean each "loop" takes 10 lines*12ms = 120ms. Since we want to run it for 30,000 ms we just do 30,000 ms/ 120 ms = 250 times. If you had different delays for the keys instead of 12ms you would just add up the delay from lines 4 through 13 and that would tell you how long each "loop" takes. In this example all the lines take the same time but you could easily add a delay for the keys if you don't want them to be pushed so fast, then you would just want to recalculate the total time for the loop by adding up the delay from lines 4 through 13. You will see in the screenshots below that the delay for each of my lines is 12ms.

Here are 2 screenshots of what the completed example script looks like in in the CM Storm Mouse Program thing you use for the scripts. I had to take 2 because you cant see the all 14 lines at once (you have to scroll down/up). As i mentioned before this will probably look slightly different than your program, since we don't have the exact same mouse, but it should be quite similar. Also in this example you will see that It is actually pushing the "F" key rather than "F1". This makes it easier to test since pushing "F" will actually show up in a text box (pushing "F1" normally doesn't show up as letter so i temporarily changed that key to "F"). Then I could just test it by opening notepad and hold down the mouse button that was set to Script #1 and see which buttons it was pushing. Once you are done testing it then you can just change the key back to "F1" by double clicking it, clicking in the keyboard box and pushing the key you want to change it back to.

Whew, that was a long one, but you made it to the end :shock: I hope this helps you, and probably others with similar questions :D Let me know if I can clarify anything and I will do my best!

examplescriptpart1.png

examplescriptpart2.png

Share this post


Link to post
Share on other sites
xhui    0

thank you! there few more commands like NOP, CALL, Time Loop, and RET. Please explain those too If you don't mind. also If I run another script by holding another mouse key, do you think it going to mess up the timer the first script?

Share this post


Link to post
Share on other sites
tacoman    0

Funny story, last night when i was testing the example script, I was originally going to use the " x times" command, but I thought it wasn't doing what I wanted it to. I was probably just tired and didn't notice it really was working right...LOL. So that example script could be simplified with the loop command :oops:

Anyway, " x times" (where x is the number of times you want it to loop, between 1 and 250). What you do is add the " x times" into the instruction window, and then you can use the move up/move down buttons to move the start and end parts of the loop around so that they contain whatever you are trying to loop and it will loop the section between the start and end portions of the loop however many times you told it to.

The following example would push "1", and then push "2" 5 times.

1: Press "1"
2: Release "1"
3:  5 Times
4: Press "2"
5: Release "2"
6:  End

And as I mentioned earlier, you could simplify the previous example you asked about where it pushes F1 once and then pushes 1234 over and over for 30 seconds to:

1: Press "F1"
2: Release "F1"
3:  250 Times
4: Press "1"
5: Release "1"
6: Press "2"
7: Release "2"
8: Press "3"
9: Release "3"
10: Press "4"
11: Release "4"
12:  End

Interesting thing to note about this way is it really only takes just slightly over 28 seconds to complete where the original example takes just slightly over 30 seconds (on my mouse). So this is faster; doing a rough estimation based on this means each loop took roughly 108ms (i.e. 9*12ms). Also The maximum number of times you can loop with 1 loop command is 250, which honestly should be enough for almost anything, just keep in mind that 250 is the limit.

Next up is NOP this one is really simple. NOP stands for "No Operation". In other words this means do nothing at all for that line. This has limited use though one unusual instance i can think of where this could be helpful is when you have this as your very last line in a script and the somewhere else you use GOTO and have it GOTO the last line that has a NOP. This would let you go to the end of the script from somewhere else in your script, without using the "Script Stop" command. "Script Stop" will stop running the script regardless of what execution mode you have selected, whereas using having it GOTO the last line in the script that has a NOP will just have it go the end of the script, which if the execution mode was set to something that loops like "Loop (Hold)" it would keep looping, and if it was changed to something like "One Shot (Press)" it would just stop. This situation probably won't come up so if I didn't explain it well or that doesn't make sense don't worry about it. The important thing to know is the NOP is literally a line where it does nothing.

CALL and RETURN are basically there to let you create a subroutine. CALL will let you go to a line and it will keep executing until it gets to a RETURN statement, and then it will go back to the next line after the CALL it came from. Among other things this lets you reuse sections of your script without having to put the same thing in 2 different places in the script. I'll post an example of this tomorrow, I think I am going to go bed now haha

Share this post


Link to post
Share on other sites
tacoman    0

Hopefully this example isn't too confusing :oops:

1:  Press "1"
2:  Release "1"
3:  CALL 9
4:  Press "2"
5:  Release "2"
6:  CALL 9
7:  Press "3"
8:  Release "3"
9:  Press "X"
10: Release "X"
11: Return
12: Press "4"
13: Release "4"

This example will press "1", Then line 3 will make it jump to line 9 and push "X", it will get to the return on line 11 which sends it back to the next line after the call it came from which is line 4 which will press "2" then it gets to line 6 which again means this will make it jump to line 9 and push "X" , it will get to the return on line 11 which sends it back to the next line after the call it came from which this time is line 7, which will continue with the rest of the script which will push "3", and then it will push "X" and then "4". So ultimately it pushes "1X2X3X4"

I made a crazy colored diagram showing the order it executes in. Its just a bunch of colored arrows. The straight arrows on the left show which lines are being executed and the curved arrows on the right show where it jumps to and returns to. The arrows I added are different colors; all the green ones are first, then the blue ones and then the red one.

crazyarrowsexamplelol.png

Share this post


Link to post
Share on other sites

great post! and follow up.Very well written and explained!!!!!!!!!!!!!! CM might want to have you write the manuals ! :cheers::cheers::cheers::cheers::cheers::cheers: Your in detail walk threw actually had me more interested in buying it after understanding it much better then anything ive read about it elsewhere .Thank you very much

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this