Jump to content
Sign in to follow this  
GodForsakenSoul

illegal move? [CAN'T SLEEP!!]

Recommended Posts

GodForsakenSoul

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

Share this post


Link to post
Share on other sites
Melba23

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


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
GodForsakenSoul

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.

Share this post


Link to post
Share on other sites
AdmiralAlkex

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.

Share this post


Link to post
Share on other sites
Melba23

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

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
GodForsakenSoul

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

kinda like ExitLoop only for functions?

Share this post


Link to post
Share on other sites
AlmarM

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.

Share this post


Link to post
Share on other sites
GodForsakenSoul

Return makes ur function return a value. :D

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

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

Does it work like a function equivalent of ExitLoop?

Share this post


Link to post
Share on other sites
AlmarM

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.

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Melba23

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


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

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  

×