Re: A Basic Question: A list player
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2009-03-21 11:09:42
|
chikitin wrote: > I couldn't do pass by reference in pipmak:) Lua always passes by reference. If you can explain what you're trying to achieve we may be able to show you how to do it in Lua. > Is there any > other way to ask pipmak to do some action as soon as a sound is stopped > playing? No. As far as I am aware there is no such callback in OpenAL, so all Pipmak could do is polling whether the sound is still playing, and you can just as well do that yourself (as you're doing now). > Hey Christian! now it works. You can try it yourself at: > > http://faculty.uncfsu.edu/csarami/files/storage/Demo.pipmak - Random.zip Well, it works as long as you keep the randomization turned off - if you enable it, you get errors because you're mixing nil values into the table. You're using a proper permutation function now and 30 is the wrong argument for that, it needs the table length (and since it can determine that on its own, there is no reason to pass it as an argument). Some more tips: - Defining a global function in one node (99) and using it in another (15) is a bit fragile. What if the player enters node 15 without ever having visited node 99, e.g. when starting from a saved game? (In your case, the older version of the function from main.lua would be used, but that looks like a leftover - and there is no guarantee that main.lua will have been run either.) If you want to define this function in a central place and use it from several nodes, you should put it into a separate file and include that in the node.luas using pipmak.dofile(). (In the future, "require" will work too.) - If you want a function to be called when a node is entered (like in node 15), you shouldn't put it directly into node.lua. That currently works, but in the future node.lua may also be run at other times. You should put this code into an onenternode handler (there's one just a few lines above in node 15). -Christian |