Jump to content
Sign in to follow this  
SjaakTV

Function after Function

Recommended Posts

SjaakTV

Hi,

So i made like 8 function. Lets call them 1 till 8. When i press start function 1 will begin. When it ends i want that function 2 starts and so on. How do i do that?

Thnx for your time.

Share this post


Link to post
Share on other sites
Hawkwing

If you want it to work like that, what's the point of having functions?


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites
Pain

Like this? Even though it makes no sense.

test1()

Func test1()
    MsgBox(0, "", "hello from test1")
    test2()
EndFunc

Func test2()
    MsgBox(0, "", "hello from test2")
    test3()
EndFunc

Func test3()
    MsgBox(0, "", "hello from test3")
    test4()
EndFunc

Func test4()
    MsgBox(0, "", "hello from test4")
EndFunc
Edited by Pain

Share this post


Link to post
Share on other sites
SjaakTV

thnx pain.

Hawkwing functions have 2/3 anwsers. So every anwser has a other function to start.

Share this post


Link to post
Share on other sites
Mobius

You could also do something like this.

CONST $NUMFUNCS = 4
;
FOR $i = 0 TO $NUMFUNCS
 ConsoleWrite("RETURNS: "& Call("_F"& $i,"Function: "& $i) & @LF)
NEXT
EXIT
;
FUNC _F0($N)
 ConsoleWrite($N & @LF)
 RETURN 0
ENDFUNC
;
FUNC _F1($N)
 ConsoleWrite($N & @LF)
 RETURN 1
ENDFUNC
;
FUNC _F2($N)
 ConsoleWrite($N & @LF)
 RETURN 2
ENDFUNC
;
FUNC _F3($N)
 ConsoleWrite($N & @LF)
 RETURN 3
ENDFUNC
;
FUNC _F4($N)
 ConsoleWrite($N & @LF)
 RETURN 4
ENDFUNC
;

Share this post


Link to post
Share on other sites
Hawkwing

thnx pain.

Hawkwing functions have 2/3 anwsers. So every anwser has a other function to start.

Is English your native language? Your reply didn't make much sense. If you want to do something like Pain's example, why would you not just have the four msgboxes without putting them in funcs? I don't see any reason whatsoever to have 8 funcs set up so that the first would call the second, then the second would call the third, etc.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites
PartyPooper

Is English your native language? Your reply didn't make much sense. If you want to do something like Pain's example, why would you not just have the four msgboxes without putting them in funcs? I don't see any reason whatsoever to have 8 funcs set up so that the first would call the second, then the second would call the third, etc.

I guess that would depend on whether he always wanted to chain to the next function inline or whether he wanted to chain to another function based on the answer given in that function ie. if input = yes goto function x or if input = no, goto function y.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.