Jump to content

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


Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...