Call Function Syntax question

0 favourites
  • 3 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • What is the correct syntax for calling a function from within an expression when that function is being passed parameters?

    I tried:

    Functions.Call("Srand(20,90)")

    where Srand is my function name, I am passing the minimum and maximum value of the seeded random number to be returned, and I do have the "Set return value to" event set correctly. I only ever get zero though, and no other variation in syntax gets passed C2's error detector.

    I know my return value statement is good because the function works perfectly when I get my return value with a separate Functions.ReturnValue event just after the call function event.

    Thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Functions.Call("Srand",20,90)

    Your function name is just the first parameter of the Call() function of the Function object (:

    If you use this though the return value can be directly assigned to a variable

    -> System: set myVariable to Functions.Call("Srand",20,90)

    The other way to do it is

    -> Function: Call "Srand" (20,90)
    -> System: set myVariable to Function.ReturnValue
  • Thankyou! That's perfect. I had done it the second way, but I knew it should be able to do it inline.

    Thanks a bunch.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)