Sign in to follow this  
Followers 0
Botter

Can I make a function with optional parameters with a global from another file?

5 posts in this topic

I am splitting my files up for simplicity sake. I have a function that uses global variables as optional parameters, it looks like this:

Func Wait4P( $pic, $waittime, $whattodo = 0, $errorjump = $program_fail_count, $startx = $windowstartx, $starty = $windowstarty, $width = $window_width, $height = $window_height )

I want that function in my graphics file, not my main file.

But when I do this in my main file:

$array = Wait4P( $IMG_files & "d3desktop.png", 2000, 10 )

I get this error:

C:\AutoIt\Diablo3Startup\LoadChris_6713.au3 (72) : ==> Variable used without being declared.:

$array = Wait4P( $IMG_files & "d3desktop.png", 2000, 10 )

$array = Wait4P( $IMG_files & "d3desktop.png", 2000, 10 )^ ERROR

>Exit code: 1 Time: 0.312

Am I going to have to forgo using globals to define optional function parameters or is there a way to do this?

Share this post


Link to post
Share on other sites



My question was about autoit basic functionality. Not game scripts.

Share this post


Link to post
Share on other sites

Botter,

Your question might well have been about "autoit basic functionality" but you made it quite clear that the script was intended for "game automation". As such it falls foul of the Forum rules to which you were linked and so this thread is now locked. :naughty:

There is a message hidden in that statement if you care to look for it - it always amazes me that so many new members are apparently unable to see it. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0