Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Sounds don't play
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#14
RE: Sounds don't play

In this case, you can think of timer functionality as of a way to indirectly make a function call via a string that matches it's name, with the extra benefit of being able to set when the call should occur. However, there are some limitations - the signature (parameter list) has to match to the one defined for the timer callback, and there's probably some performance overhead.

A better, more flexible way to do it is to use function handles (funcdefs). If you're not that familiar with them, funcdefs make it possible for you to define a data type that allows you to create variables that point to functions, and then use those variables to make calls to the pointed-to functions as if you were calling them in the normal way.
What you should be able to do (I'm not in position to test it at the moment as well) is to create an array of function handles ("pointers"), initialize those handles to your functions, and then use the RandInt() function to pick one randomly from the array (by simply using the random number to access it by index).

I'll probably be able to test this later on today, so I'll write some more guidelines about the syntax and the overall approach - till then, here's a tutorial on funcdefs .
12-19-2012, 10:02 AM
Find


Messages In This Thread
Sounds don't play - by The chaser - 12-12-2012, 09:38 PM
RE: Sounds don't play - by Juby - 12-12-2012, 09:57 PM
RE: Sounds don't play - by The chaser - 12-12-2012, 10:15 PM
RE: Sounds don't play - by FlawlessHappiness - 12-12-2012, 10:45 PM
RE: Sounds don't play - by The chaser - 12-12-2012, 10:58 PM
RE: Sounds don't play - by FlawlessHappiness - 12-13-2012, 07:02 AM
RE: Sounds don't play - by The chaser - 12-13-2012, 07:48 AM
RE: Sounds don't play - by JMFStorm - 12-13-2012, 07:56 AM
RE: Sounds don't play - by The chaser - 12-13-2012, 10:17 AM
RE: Sounds don't play - by FlawlessHappiness - 12-13-2012, 10:50 AM
RE: Sounds don't play - by The chaser - 12-13-2012, 02:50 PM
RE: Sounds don't play - by TheGreatCthulhu - 12-17-2012, 01:40 PM
RE: Sounds don't play - by The chaser - 12-17-2012, 08:34 PM
RE: Sounds don't play - by TheGreatCthulhu - 12-19-2012, 10:02 AM
RE: Sounds don't play - by TheGreatCthulhu - 12-19-2012, 08:07 PM
RE: Sounds don't play - by The chaser - 12-19-2012, 09:33 PM
RE: Sounds don't play - by TheGreatCthulhu - 12-19-2012, 10:45 PM



Users browsing this thread: 1 Guest(s)