Page 11 of 13 FirstFirst ... 9 10 11 12 13 LastLast
Results 101 to 110 of 122

Thread: Lua Help Thread

  
  1. #101
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    He asked how to change a numerical portion of a variables name, so instead of giving him the answer I told him what should be done -- use and array. There all caught up now ?

    july 19

  2. #102
    romero126 is offline -Hacks Neophyte
    Join Date
    Jan 2006
    Posts
    81
    Rep Power
    15

    Default

    You should check out my dev stuff, you might like the way its setup so far.

  3. #103
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    15

    Default

    Ok my audio function for MQ is giving me so many problems (btw yes I no you guys could probably do it in 5 min :sigh: ) Its not the music one, That one I finished with no problem, and I think its a fairly good function (includes a playlist) but the SFX sound function has been like a bitch! It plays the sounds fine but Heroux asked me to put in the abilty so it only plays 5 sounds at a time and that part works well to, but you see how it works is it loads the sound into lets say sound[1] then it play's sound[1] and assigns that to voice[1] well all that works fine and dandy BUT whats getting to me is after the sound is done playing I want to unload it from its varible so now I have an open spot for another sound to load into. so it looks something like

    Code:
    sound[open_pos] = Sound.load(file,false)
    voice[open_pos] = sound[open_pos]:play()
    for a = 1,5 do
    if not voice[a]:playing() then
    voice[a] = nil
    sound[a] = nil
    end
    now thats just off the top of my head on how it looks like, but thats pretty much how it works. BUT for some reason it won't work as I please

    (I'll probably post back in like 30min with the complete function)
    if you have any idea as to what is wrong or give me like pseudo code on how the program would look like it would be greatly apreiated
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  4. #104
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    ... It will play a new song every time it is called. To limit processing it will only load a select amount of song files at a time (we will say 5). This function is called like so playSFX(buttonover1). N.B. more then one file can be played when using this function.
    It seems it is meant to load a audio file and cache them (a maximum of 5 files at a time) to be played. When the function is called it checks to see if the file is already loaded. If it is not then it will erase the the last file in the array [the one that hasn't been used in the longest amount of time] and then place new audio file that has been loaded file in slot one. Then the rest of the function is just playing the music from the cache directory, which is simple enough. Your problem is with the cache array.

    pseudo code did you say

    sfx_cache = {
    song files
    }

    if sfx_cache == a currently loaded file (that is a file in the sfx_cache) then do not load file, go play file from the cache directory

    if sfx_cache !== a currently loaded file then move all the other files back one, then load it into slot one of the sound_cache array, and delete the last file in sfx_cache file array so there is only 5 sfx loaded.

    then play your file, there is no limit to the amount of files that can be played at once; just the amount that can be loaded. That should simplify things.

    If you are still stuck how about posting all your code, then I could see what is going on.

    But that should help some.
    july 19

  5. #105
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    15

    Default

    Ok I tried your logic and it worked perfically. few tweaks here and their and I had it runing in no time :D
    well now I'm an official MQ programmer (look at sig, yes I had to let the whole world no :D ) as to help anybody out here that is having trouble with an audio engine or just dosn't want to code one here is mine
    http://www.savefile.com/files.php?fid=1848528
    I no its not all tht great and nothing to get exicited over but remember this was stictly suppost to be a learning experince for me, so here I pass my work down to any others in need :D

    (btw the read me and source code needs to be opened in WORDPAD NOT NOTEPAD)
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  6. #106
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    Quote Originally Posted by soulkiller
    Ok I tried your logic and it worked perfically. few tweaks here and their and I had it runing in no time :D
    I'm gifted what more can I say :cool:

    Quote Originally Posted by soulkiller
    well now I'm an official MQ programmer (look at sig, yes I had to let the whole world no :D )
    I like it :cool: and with the demo release and all it is a good time to be one :mrgreen:
    july 19

  7. #107
    Ace High is offline -Hacks Newbie
    Join Date
    Apr 2006
    Posts
    8
    Rep Power
    0

    Default

    Ok I've been using the system.sleep(500) and it freees everything for half a second(like it should) but still doesn't show the punch image.

    Can someone show me an example of a script that has sprite animation in it and explain it?

    Thanks for the help

  8. #108
    romero126 is offline -Hacks Neophyte
    Join Date
    Jan 2006
    Posts
    81
    Rep Power
    15

    Default

    need source code for answer to that.

  9. #109
    Ace High is offline -Hacks Newbie
    Join Date
    Apr 2006
    Posts
    8
    Rep Power
    0

    Default

    for which part? the punching?
    I'm just going to skip that part and hope that when I do the whole animation of the punch it will be fixed.

    Do you have an example of animation that I could look at?

  10. #110
    romero126 is offline -Hacks Neophyte
    Join Date
    Jan 2006
    Posts
    81
    Rep Power
    15

    Default

    Quote Originally Posted by romero126
    need source code for answer to that.

Page 11 of 13 FirstFirst ... 9 10 11 12 13 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •