Some Scipt Help - Loops and variables

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
byrne86
Newbie
Posts: 7
Joined: Fri Oct 15, 2010 7:56 pm

Some Scipt Help - Loops and variables

Post by byrne86 » Fri Oct 15, 2010 8:02 pm

Hi, I have made a script to automatically use pots on a game, the only thing is, I need some help with making it a bit more functional.

Here is the code:

Code: Select all


Dialog>Dialog2
   Caption=Auto Pot
   Width=445
   Height=315
   Top=97
   Left=16
   Button=Quick Log,8,176,233,33,3
   Button=Exit,8,216,233,33,4
   Button=Launch Soma,8,8,233,73,5
   Button=Start Auto HP,152,88,89,33,1
   Button=Start Auto MP,152,136,89,33,6
   Label=Number of HP Pots : ,0,96
   Edit=txtHP,104,96,42,
   Edit=txtMP,104,144,42,
   Label=Number of MP Pots : ,0,144
   Button=Test,308,39,75,25,8
EndDialog>Dialog2

Label>MainLoop
Show>Dialog2,result
if>result=1,StartAutoHP
if>result=2,Main
if>result=3,QuickLog
if>result=4,End
if>result=5,LaunchSoma
if>result=6,StartAutoMP
if>result=7,Main
if>result=8,TestFeature
Goto>MainLoop

SRT>TestFeature
  MessageModal>Dialog2.txtHP
END>TestFeature

SRT>LaunchSoma
RunProgram>C:\Soma\SomaDev Launcher.exe
WaitWindowOpen>SomaDev Launcher 1.1
SetFocus>SomaDev Launcher 1.1
Press Tab
Press Enter
WaitWindowOpen>Soma Mythological Biography
MoveWindow>Soma Mythological Biography,474,1
SetFocus>Soma Mythological Biography
END>LaunchSoma

SRT>QuickLog
CloseWindow>Soma Mythological Biography
END>QuickLog

SRT>StartAutoHP
Let>HPPots=Dialog2.txtHP
Show>Dialog2
SetFocus>Soma Mythological Biography
Repeat>HPPots
Wait>1
WaitPixelColor>10856101,506,530,0
Press F4
HPPots=HPPots-1
Until>HPPots=0
Message>No HP Pots Left
END>StartAutoHP

SRT>StartAutoMP
Let>MP=0
Show?>Dialog
SetFocus>Soma Mythological Biography
Repeat>MP
Wait>1
WaitPixelColor>9211532,528,528,1
Press F3
Until>MP=10
END>StartAutoMP

Label>End
What I can not do is the following:

- In the AutostartHP function, I am trying to make it so that I can type in the number of pots I have in a textbox in the dialog, then each time the loop goes through one cycle, subtract 1 from the value, then when the value reaches 0 I want it to go to SRT>quicklog.

- I also would like to make a button that stops the script and go back to the mainloop, but all attempts have been unsuccesful, im sure this isnt that hard to do...

- One last thing,when I compile and try to run the exe I always get the following error message:

Image

If anyone can help me out with this it would be great.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Fri Oct 15, 2010 9:36 pm

RunProgram>C:\Soma\SomaDev Launcher.exe
This line might be a suspect in causing the Windows error you reported:
i.e. "Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item."


Also this line:
Show?>Dialog

Is the ? an artifact of the cut/paste process? If not that is a syntax error.

byrne86
Newbie
Posts: 7
Joined: Fri Oct 15, 2010 7:56 pm

Post by byrne86 » Fri Oct 15, 2010 9:40 pm

I just compiled the script with that removed and I still got the same error when I try and run the exe...

edit - thanks for that spot with the "?", i removed it.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts