Sign in to follow this  
Followers 0
WilliamWhite

Help on function

5 posts in this topic

#1 ·  Posted (edited)

Hello,

I could use some help.

I make small programs that I then use as functions in a master script. (I guess thats common practice)

The function is:

Func PutShipInSpace()

$coord = PixelSearch( 20-1280, 784, 30-1280, 794, 0xFFDB42, 10 )

If Not @error Then

MsgBox(0, "Status Report", "Ship is docked in station")

$docked=1

else

MsgBox(0, "Status Report", "Ship is not docked in station")

$docked=0

EndIf

EndFunc

PutShipInSpace()

And this works beautifull. Based on the colour of pixels it sees if i am docked in a game an respond with a mesage about the condition the ship is in

If i put this function in a master script, and call it from a button it will always give ship is undocked so a error on the pixel search.

I cut this patr again from the masterfile and put in in a blanc new script and again it works flawless.

What can be the trouble? I declared the variables as globals in the master script

My best guess would be that if i use it separet it sees the window on top and if i put it in a masterscript with a gui.that somehow it doesnt see the window colour since the gui window is active

Thanks for yer inputs!

Edited by WilliamWhite

Share this post


Link to post
Share on other sites



As long this code is correct I think you can help here by posting the relevant parts of the master script that call this function. Can you explain why are using negative off-screen coordinates?

Share this post


Link to post
Share on other sites

As long this code is correct I think you can help here by posting the relevant parts of the master script that call this function. Can you explain why are using negative off-screen coordinates?

Here is the part of the masterscript:

The reason for having negative numbers is that it all happens on my left, not main, display. So my main stays free for working.

; Undock if needed

$btn_PutShipInSpace=GUICtrlCreateButton( "", 5, 599, 20, 15 )

GUICtrlCreateLabel( "Undock if needed", 30, 600, 90, 15 )

While 1

$guimsg = GUIGetMsg()

Select

Case $guimsg = $GUI_EVENT_CLOSE

Exit ; Closes gui

Case $guimsg = $btn_starteve

$Character = "Tristanor"

StartCharacter($Character)

Case $guimsg = $btn_PrepMiner

PrepMiner()

Case $guimsg = $btn_PutShipInSpace

PutShipInSpace()

Case $guimsg = $btn_IceMining

IceMining()

EndSelect

WEnd

Share this post


Link to post
Share on other sites

Are you sure that you master script hasn't set PixeCoordMode somewhere?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Are you sure that you master script hasn't set PixeCoordMode somewhere?

As true Noob i didnt even know of this function ;)

And its a good one. In my script i wanted to use variables to calculate the true position of the location, this option gives me a way to dont have to do that: GREAT!

But no, i didnt use it yet. So i cant still not understannd why..only thing i see is that the gui i created with the buttons somehow interferes with the pixelsearch....

regards,

William

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