Sign in to follow this  
Followers 0
bf2forlife

Random functions?

3 posts in this topic

look at this code:

Dim $aFuncs[62] = [func a, func b, func c....

But when i try to run it, then comes error. "Error: Missing Separator character after keyword." So how i can fix that?

Share this post


Link to post
Share on other sites



look at this code:

Dim $aFuncs[62] = [func a, func b, func c....

But when i try to run it, then comes error. "Error: Missing Separator character after keyword." So how i can fix that?

This works

Local $aFuncs[62] = ["funca", "funcb", "funcc"]

call($aFuncs[1])

Func funcb()
    MsgBox(0,"","Funcb Called")
EndFunc

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

look at this code:

Dim $aFuncs[62] = [func a, func b, func c....

But when i try to run it, then comes error. "Error: Missing Separator character after keyword." So how i can fix that?

You cannot save functions in an array, what you can do is save the name of the function then use call:

Dim $array[3]=["_1","_2","_3"]

Call($array[Random(0,UBound($array)-1,1)])

Func _1()
    MsgBox(0,"","Hello from 1")
EndFunc

Func _2()
    MsgBox(0,"","Hello from 2")
EndFunc

Func _3()
    MsgBox(0,"","Hello from 3")
EndFunc

:)

Edit: Beaten to it by Malkey :(

Edited by monoceres

Broken link? PM me and I'll send you the file!

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  
Followers 0