Sign in to follow this  
Followers 0
tijn

My first script, need help!

6 posts in this topic

hello;)

First ofall ,im new to this forums, lemme introduce myself:)

Im Lutijn from holland, 16 years old and football fan, also a silkroadonline botter.

Well, my script needs to do this:

Click on P to see if there are 3 people in party, if not:

Click E and click on form party

Click on OK

Waits till someone ones to join and clicks on ACCEPT if there popsup a window from someone wanting to join PT

Well, this is it:

While 1
$msg = GUIGetMsg()
WEnd

func check()
if WinExists("SRO_Client") then
Send "P" [, 1]
if pixelgetcolor(630,483) = 0x000000 then
Send "E" [, 1]
MouseClick "left", 612, 591, 1
sleep(1000)
MouseClick "left", 461, 541, 1
sleep(1000)
if pixelgetcolor(875,752) = 0xD4D0C8 then
sleep(200)
MouseClick "left", 875, 752, 1
EndIf
EndIf
EndIf
endfunc

Does anyone know if there are any bugs in this? Im new, dont be harse at me please .

CYas!

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

I don't see bugs, but I do see sytax mistakes. You are not using brackets for the functions and the [ ] on a function description tell you that that parameter is optional. You don't have to put it.

While 1
$msg = GUIGetMsg()
WEnd

func check()
if WinExists("SRO_Client") then
Send ("P" , 1)
if pixelgetcolor(630,483) = 0x000000 then
Send ("E" , 1)
MouseClick ("left", 612, 591, 1)
sleep(1000)
MouseClick ("left", 461, 541, 1)
sleep(1000)
if pixelgetcolor(875,752) = 0xD4D0C8 then
sleep(200)
MouseClick ("left", 875, 752, 1)
EndIf
EndIf
EndIf
endfunc

If you use SciTE, press Ctrl+F5 for SintaxCheck Prod.

Edited by Nahuel

Share this post


Link to post
Share on other sites

Sorry, im 100% new to scripting, I use autoit to get the logical thinking to go on on harder scriptlanguages in a year or 2.

What do you mean with brackets?

The syntax cheker lets me know theres something wrong with sending P ....

updated something, added WinActivate so it runs SRO before pushing P >.<

While 1
$msg = GUIGetMsg()
WEnd


func check()
if WinExists("SRO_Client") then
WinActivate("SRO_Client", "")
sleep(1000)
Send "P" [, 1]
if pixelgetcolor(630,483) = 0x000000 then
Send "E" [, 1]
MouseClick "left", 612, 591, 1
sleep(1000)
MouseClick "left", 461, 541, 1
sleep(1000)
if pixelgetcolor(875,752) = 0xD4D0C8 then
sleep(200)
MouseClick "left", 875, 752, 1
EndIf
EndIf
EndIf
endfunc

Share this post


Link to post
Share on other sites

All the functions have a similar structure:

function($parameter)

your script won't work because you typed: Send "P" [, 1] when it should be Send("P",1)

When you read a function description on the help file, it will show you parameters in [ ]. That means that those are optional. You do not have to type the [ ] like you did with the send functions. Use the examples and the help file, they are VERY useful! :)

Share this post


Link to post
Share on other sites

sorry guys, and thanks alot!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0