Jump to content

illegal move? [CAN'T SLEEP!!]


Recommended Posts

moving between functions in autoit is like moving your pieces in chess. there are set rules.

i made a map of how my function goes.

Posted Image

the green line goes top-down and left-right. like the in stop lights, green means OK.

what i need is to make the RED move.

as in, under certain circumstances in FUNCLoopTill(), i go back to GUIPKan().

as you may have guessed, i'm stumped here.

help?

Edited by GodForsakenSoul
Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

Either let the FUNCComKana() function finish naturally or use Return at the point(s) where you want to get back along your red line. :D

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

GodForsakenSoul,

Either let the FUNCComKana() function finish naturally or use Return at the point(s) where you want to get back along your red line. :D

M23

uh... the return business i don't understand.... the help file produces a large chunk of code.

FUNCLoopTill(), as the name suggest, is basically a switch which reads a key from an ini file, compares it to another key, and if the keys match, exits. i forgot to make a line to Exit there...

FUNCLoopTill() doesn't have any valueable output to justify a Return().

hell, it doesn't have ANY output.

Link to comment
Share on other sites

What?

You need to let your functions end naturally or with Return as Melba said, nothing less, nothing more. Just do it.

And you can't blaim the helpfile, just download it again if it's broken or check the online ones.

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

Does this make Return any clearer? :D

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton = GUICtrlCreateButton("Test", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            ConsoleWrite("Going into the function" & @CRLF)
            Function()
            ConsoleWrite("Returned from the function" & @CRLF)
    EndSwitch

WEnd

Func Function()

    For $i = 1 To 5

        ; This shows that the function is progresing
        ConsoleWrite($i & @CRLF)

        ; Let us return early - if $i = 3, we leave now!!!!
        If $i = 3 Then Return

    Next

    ; If you comment out the If line above, you will get here and return automatically

EndFunc

M23

Edit: Speeling

Edited by Melba23

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

so.... Return() ends the function early, basically?

kinda like ExitLoop only for functions?

Return makes ur function return a value. :D

Or @Melba's example, make it stop earlier.

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Look at Melba's example to see how to exit a function earlier, what I ment was this:

$GUI = GUICreate("Test", 100, 100)
$Button = GUICtrlCreateButton("Test", 10, 10)

GUISetState()
While 1
    Switch GUIGetMsg()
    Case -3
        Exit
    Case $Button
        $Func = MyFunc()
        MsgBox(0, "", "$Func returned: " & $Func)
    EndSwitch
WEnd

Func MyFunc()
    
    Return "Wieeeeee"
    
EndFunc

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

  • Developers

yes, precisely. i ment in Melba's example.

Does it work like a function equivalent of ExitLoop?

Did you get some sleep yet?

After you have done that, try taking the time to do a little reading when people make suggestions in an effort to understand what is proposed.

You are here long enough to understand this much ... right ?

Now get everything of your setup fixed and open the helpfile before asking or else we will help you take the time for reading.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

Does it work like a function equivalent of ExitLoop?

It is not how I would describe Return, but it is not too far from the truth. However, Return is, as AlmarM hinted, more powerful as it can return values to help your decision making once the function ends.

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

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
 Share

  • Recently Browsing   0 members

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