Seite 332 von 342 ErsteErste ... 232 282 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 ... LetzteLetzte
Zeige Ergebnis 9.931 bis 9.960 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; noob question: i want to make part of an image transparent. and i am using gimp image editor (works alright) ...

  
  1. #9931
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    noob question: i want to make part of an image transparent. and i am using gimp image editor (works alright) and i want to make a middle part of the image transparent (or just gone completly) any tips?



  2. #9932
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Well in paint.net you just have to select the area you want transparent, & cut it. If you want it partiallh transparent then you simply change the alpha value in the paint window (the window were you click to chose your colours & theres the colour circle.)
    Don't know about gimp though, to save time install paint.net, once you've finished unistall it

  3. #9933
    QJ Gamer Blue
    Points: 2.716, Level: 31
    Level completed: 78%, Points required for next Level: 34
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    106
    Points
    2.716
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    the default password is ur psp s system nickname but i wanted 2 make an option 2 change the password from within the program so people w/out knowledge of lua wont have 2 manually open the lua file 2 change the password . ive tried both though w/file:read("*a") and file:read(*n) but it just seems 2 be having problems comparing the osk input with reading the file

  4. #9934
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    k. thanks for the help dan369

  5. #9935
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Well I'm completely stumped by this. How do I make music loop in the latest Luaplayer HM. I tired all sorts of techniques but nothing is working.Let me give you situation.

    I load an Ogg then I play it in my main loop. Then I try to stop the music near the end and re-play the music. This is pretty much the gist of how I'm trying to do it:

    Code:
    BG1 = Ogg.load("Music.ogg")
    
    music = true
    
    while true do
    pad = Controls.read()
    
    if music == true then
    Ogg.play(BG1)
    end
    if music == false then
    Ogg.stop(BG1)
    end
    
    if pad:circle() then
    music = true
    end
    
    if pad:cross() then
    music = false
    end
    end

  6. #9936
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    it'll only play if your holding circle add this:
    Code:
    oldpad = Controls.read()
    
    --in main loop
    if pad:circle() and not oldpad:circle() then
             --do stuff
    end
    
    --near the end of your script
    oldpad = pad

  7. #9937
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    it'll only play if your holding circle add this:
    Code:
    oldpad = Controls.read()
    
    --in main loop
    if pad:circle() and not oldpad:circle() then
             --do stuff
    end
    
    --near the end of your script
    oldpad = pad
    No the way I mentioned above would not, as it is state based. Also this really has nothing to do with the problem.

  8. #9938
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Yes it does, when you press circle the state would be true, when you let go it'll go to false. I've been doing this for about 2 and a half years now, i think i can tell you the problem (sarcasm).
    Use tostring to print 'music' to the screen, that'll show you that i'm correct.

  9. #9939
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    i have a question about zoom. i have tried adding to size by just pressing the button (wich i didnt get to work :P)but i was wondering if their was a code i could implement to make it steadily zoom.
    heres the code if it helps (i was just messing around with code to make this box move around screen)

    Code:
    blue=Color.new(0,0,255)
    i = 32
    box=Image.createEmpty(i,i)
    box:clear(blue)
    Box={x = 30, y = 100}
    screenwidth = 480 - box:width()
    screenheight = 272 - box:width()
    function move()
      if Box then
      Box.x = Box.x - 1
      end
    end
    function moveUp()
      if Box then
      Box.y = Box.y - 1
      end
    end 
    function collide()
       if Box.x < 0 then
       Box.x = Box.x + 480
       end
    end   
    function collideUp()
      if Box.y < 0 then
      Box.y = Box.y + 272
      end
    end 
    while true do
       pad = Controls.read()
       screen:clear()
       screen:blit(Box.x,Box.y,box)
       if pad:start() then
          break
       end
       if pad:r() then
       i = i + 50
       end
       collide()
       collideUp()
       move()
       moveUp()
    screen.waitVblankStart()
    screen.flip()
    end

  10. #9940
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    Yes it does, when you press circle the state would be true, when you let go it'll go to false. I've been doing this for about 2 and a half years now, i think i can tell you the problem (sarcasm).
    Use tostring to print 'music' to the screen, that'll show you that i'm correct.
    That's completely false. I think you should review my code.

    It doesn't just magically become false for no reason. The only way that would happen is if I put the music variable in my loop which I obviously didn't do.


    Now onto the problem I am having. Whenever I use Ogg.stop() I can't use Ogg.play(). So I see no way of making a loop. I've tried making another while loop. I've tried loading dummy music file in addition to my other music file. I've tried checking to see when the music stops then using a Ogg.play(). and a whole lot more.



    Zitat Zitat von scionsamurai Beitrag anzeigen
    i have a question about zoom. i have tried adding to size by just pressing the button (wich i didnt get to work :P)but i was wondering if their was a code i could implement to make it steadily zoom.
    heres the code if it helps (i was just messing around with code to make this box move around screen)

    Code:
    blue=Color.new(0,0,255)
    counter = 0
    i = 32
    box=Image.createEmpty(i,i)
    box:clear(blue)
    Box={x = 30, y = 100}
    screenwidth = 480 - box:width()
    screenheight = 272 - box:width()
    function move()
      if Box then
      Box.x = Box.x - 1
      end
    end
    function moveUp()
      if Box then
      Box.y = Box.y - 1
      end
    end 
    function collide()
       if Box.x < 0 then
       Box.x = Box.x + 480
       end
    end   
    function collideUp()
      if Box.y < 0 then
      Box.y = Box.y + 272
      end
    end 
    while true do
       pad = Controls.read()
       screen:clear()
       screen:blit(Box.x,Box.y,box)
       if pad:start() then
          break
       end
       if pad:r() then
       i = i + 50
       end
       collide()
       collideUp()
       move()
       moveUp()
    screen.waitVblankStart()
    screen.flip()
    end

    This looks fine if you want it to "steadily" zoom. (I assume you want to control the rate) Just edit your i = i + 50. 50 seems a bit much though I'd try 4 or something like that.

    But if you want maximum control over the rate at which it zooms try:

    Code:
    counter = 0
    
    function BoxZoom()
    counter = counter + 1
    
     if counter == 5 then
     i = 2
     end
     if counter == 10 then
     i = 3
     counter = 0
     end
    end
    The way above would give absolute control over the rate at which your box zooms. You could have it zoom fast then slow.

  11. #9941
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    Yes it does, when you press circle the state would be true, when you let go it'll go to false. I've been doing this for about 2 and a half years now, i think i can tell you the problem (sarcasm).
    Use tostring to print 'music' to the screen, that'll show you that i'm correct.
    Sorry dan, but you are wrong in this case. The flag music ONLY gets assigned false when cross is pressed.

    However Xteaph-N, you do realise that play or stop is getting called EVERY frame depending on the state of the flag which isn't recommended and to be honest, I am surprised it even works as it is now.

    Add another flag that represents if the music is playing or not so you can correctly decide when to call play and stop.

  12. #9942
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Yeah my bad, just realised what he has done. He shouldn't use stop, he should be using pause that is un-less you want it to start from the beginning.
    I got it muddled up, i thought he set music to false but he set it to true at the beginning, but like yaustar said the 'state' only changes whilst your pressing cross.

  13. #9943
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar Beitrag anzeigen
    Sorry dan, but you are wrong in this case. The flag music ONLY gets assigned false when cross is pressed.

    However Xteaph-N, you do realise that play or stop is getting called EVERY frame depending on the state of the flag which isn't recommended and to be honest, I am surprised it even works as it is now.

    Add another flag that represents if the music is playing or not so you can correctly decide when to call play and stop.

    I could call it out differently like so:

    Code:
    BG1 = Ogg.load("Music.ogg")
    
    music = true
    
    if music == true then
    Ogg.play(BG1)
    end
    if music == false then
    Ogg.stop(BG1)
    end
    
    while true do
    pad = Controls.read()
    
    if pad:circle() then
    music = true
    end
    
    if pad:cross() then
    music = false
    end
    end
    However this doesn't help. Whenever I use Ogg.stop() function I can no longer use Ogg.play(). I am completely stumped as how I could make a loop; being this as the case.

    I've already tried multiple things in and out of my loop and none seem to work.



    Zitat Zitat von dan369 Beitrag anzeigen
    Yeah my bad, just realised what he has done. He shouldn't use stop, he should be using pause that is un-less you want it to start from the beginning.
    I got it muddled up, i thought he set music to false but he set it to true at the beginning, but like yaustar said the 'state' only changes whilst your pressing cross.
    Ok, this is really upsetting me now. Go back and read the last 3 posts I've made in this thread. If you've done that you will see I've been repeating myself exclusively to you. In all 3 posts they've been about a "music loop". I don't see how you could not have gotten this. It was quite plan. There is no point in trying to help someone if you don't pay attention to what they are saying.

  14. #9944
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    thanks for the response Xteaph-N. but for some reason it still doesnt zoom at all. it stays at one size. here is the code now
    Code:
    blue=Color.new(0,0,255)
    i = 32
    box=Image.createEmpty(i,i)
    box:clear(blue)
    Box={x = 30, y = 100}
    screenwidth = 480 - box:width()
    screenheight = 272 - box:width()
    counter=0
    function BoxZoom()
    counter=counter+1
       if counter == 5 then
       i = 2
       end
       if counter == 10 then
       i = 3
       counter = 0
       end
    end
    function move()
      if Box then
      Box.x = Box.x - 1
      end
    end
    function moveUp()
      if Box then
      Box.y = Box.y - 1
      end
    end 
    function collide()
       if Box.x < 0 then
       Box.x = Box.x + 480
       end
    end   
    function collideUp()
      if Box.y < 0 then
      Box.y = Box.y + 272
      end
    end 
    while true do
       pad = Controls.read()
       screen:clear()
       screen:blit(Box.x,Box.y,box)
       if pad:start() then
          break
       end
       if pad:r() then
       i = i + 5
       end
       BoxZoom()
       collide()
       collideUp()
       move()
       moveUp()
    screen.waitVblankStart()
    screen.flip()
    end

  15. #9945
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    I help loads of people, i made one mistake & you come down on me. I'm not going to even bother now.
    Geändert von dan369 (06-21-2009 um 05:31 PM Uhr)

  16. #9946
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von scionsamurai Beitrag anzeigen
    thanks for the response Xteaph-N. but for some reason it still doesnt zoom at all. it stays at one size. here is the code now
    Code:
    blue=Color.new(0,0,255)
    i = 32
    box=Image.createEmpty(i,i)
    box:clear(blue)
    Box={x = 30, y = 100}
    screenwidth = 480 - box:width()
    screenheight = 272 - box:width()
    counter=0
    function BoxZoom()
    counter=counter+1
       if counter == 5 then
       i = 2
       end
       if counter == 10 then
       i = 3
       counter = 0
       end
    end
    function move()
      if Box then
      Box.x = Box.x - 1
      end
    end
    function moveUp()
      if Box then
      Box.y = Box.y - 1
      end
    end 
    function collide()
       if Box.x < 0 then
       Box.x = Box.x + 480
       end
    end   
    function collideUp()
      if Box.y < 0 then
      Box.y = Box.y + 272
      end
    end 
    while true do
       pad = Controls.read()
       screen:clear()
       screen:blit(Box.x,Box.y,box)
       if pad:start() then
          break
       end
       if pad:r() then
       i = i + 5
       end
       BoxZoom()
       collide()
       collideUp()
       move()
       moveUp()
    screen.waitVblankStart()
    screen.flip()
    end
    Oh, your not calling my function right. This is a way you can call it:

    Code:
    blue=Color.new(0,0,255)
    i = 32
    box=Image.createEmpty(i,i)
    box:clear(blue)
    Box={x = 30, y = 100}
    screenwidth = 480 - box:width()
    screenheight = 272 - box:width()
    counter=0
    function BoxZoom()
    counter=counter+1
       if counter == 5 then
    
    --This is why it wasn't zooming -- Also causes slow increase
       i = i + 2 -- Rate of zoom variable
       end
       if counter == 10 then
    
    --This will be a faster zoom
       i = i + 5 -- Rate of zoom variable
       counter = 0
       end
    end
    function move()
      if Box then
      Box.x = Box.x - 1
      end
    end
    function moveUp()
      if Box then
      Box.y = Box.y - 1
      end
    end 
    function collide()
       if Box.x < 0 then
       Box.x = Box.x + 480
       end
    end   
    function collideUp()
      if Box.y < 0 then
      Box.y = Box.y + 272
      end
    end 
    while true do
       pad = Controls.read()
       screen:clear()
       screen:blit(Box.x,Box.y,box)
       if pad:start() then
          break
       end
    
    --Pressing R activates the function 
       if pad:r() then
       BoxZoom()
       end
       
    collide()
       collideUp()
       move()
       moveUp()
    screen.waitVblankStart()
    screen.flip()
    end
    Also I realized I made a simple mistake with the BoxZoom() function which is also fixed here. I've also added comment where I changed things.

    I also want you to know the way in which it grows will be slow then fast, slow then fast et cetera. But you can easilly change that to what ever you want.

    Zitat Zitat von dan369 Beitrag anzeigen
    I help loads of people, i made one mistake & you come down on me. I'm not going to even bother now.
    *faceplam* Uhg, read my last post. You made 5 mistakes.(not including this one)

    1. Ignoring my question
    2. Your answer was wrong
    3. Ignoring my question again
    4. Your rebuttal was wrong
    5. Ignoring my question again

    Also I'm only upset because you had no idea(it seemed) what the problem was. I'm sure you help a lot of people, I've also helped lots of people too in hardware. However I was only pointing out something as a matter of fact. I wasn't "coming down" on you.

    Here is what I said:

    Zitat Zitat von Xteaph-N Beitrag anzeigen
    Ok, this is really upsetting me now. Go back and read the last 3 posts I've made in this thread. If you've done that you will see I've been repeating myself exclusively to you. In all 3 posts they've been about a "music loop". I don't see how you could not have gotten this. It was quite plan. There is no point in trying to help someone if you don't pay attention to what they are saying.
    All of this is fact, there was no mean intention in it.

    Too further prove my point; I could have said all kinds of mean factual statements like "You are just being plain incompetent". But I chose instead to not use that version. Your just acting childish right now. I could continue to explain but I think this is enough.

  17. #9947
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Look now i'm going to ignore that post, seeing as if i wanted to i could point out loads of mistakes with the things you have coded but i'll leave it at that.
    Now if you actually used the simplest of debugging, just simply printing 'music' to the screen then you'd see that there is a problem with Hmv2. I tried my own program, similar to yours. When i press circle, using your script, music got set to 'true' so it should play. But it didn't, this isn't a code problem but i think it's a HM problem. Also i tried to just pause the music for a moment but neither did that work, it plays tiny parts of the song instead of just pausing & re-playing when i feel like it.

    Note: music was set to false when i tried to set music back to true. Just to say

    Now let me point out the mistakes seeing as you do it with me:
    if statements are always:
    Code:
       if somethingIsTrue then
             do stuff
       end
    There's no need for the == true part. For false you'd do this
    Code:
    if not something then
         do something
    end
    'Music' is a bad variable name, it doesn't tell me anything about what it is used for only that it is used in connection with 'music'. Something like 'musicIsPlaying'. Also indent and use spaces because your code is all together and looks rather ugly.

    Edit: Though there is a possibility that the code is wrong, i don't use Hmv2 mostly so my code my not be 100% correct but, with what i have it seemed that it was a Hm problem.

  18. #9948
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    k. i tried making the changes and it didnt work. then i tried copying ur code and it still didnt work. so im thinking it is the way im "blit"ing the box to the screen or my version of lua player. i have luaplayer 0.20. any more suggestions would be appreciated. btw thanks for the responses Xteaph-N, :)

  19. #9949
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    Look now i'm going to ignore that post, seeing as if i wanted to i could point out loads of mistakes with the things you have coded but i'll leave it at that.
    Now if you actually used the simplest of debugging, just simply printing 'music' to the screen then you'd see that there is a problem with Hmv2. I tried my own program, similar to yours. When i press circle, using your script, music got set to 'true' so it should play. But it didn't, this isn't a code problem but i think it's a HM problem. Also i tried to just pause the music for a moment but neither did that work, it plays tiny parts of the song instead of just pausing & re-playing when i feel like it.

    Note: music was set to false when i tried to set music back to true. Just to say

    Now let me point out the mistakes seeing as you do it with me:
    if statements are always:
    Code:
       if somethingIsTrue then
             do stuff
       end
    There's no need for the == true part. For false you'd do this
    Code:
    if not something then
         do something
    end
    'Music' is a bad variable name, it doesn't tell me anything about what it is used for only that it is used in connection with 'music'. Something like 'musicIsPlaying'. Also indent and use spaces because your code is all together and looks rather ugly.

    Edit: Though there is a possibility that the code is wrong, i don't use Hmv2 mostly so my code my not be 100% correct but, with what i have it seemed that it was a Hm problem.
    I already know I don't organize my code very well. But this is only superficial both ways work the same. The reason you see me doing it like:

    "Music == true"

    is because I'm not always using a boolean statement sometimes I have things like:

    "Music == BGM1"
    "Music == BGM2"

    I have these statements which aren't boolean, and so it wouldn't make sense to put Music_Is_Playing. Besides I like to read spaghetti code. Though your correct if we where only doing boolean, which as I stated will not be the case. As for indentation, I simply hate them. I like them in C/C++, but in lua I it's hard for my eyes to look at it.


    I always thought this was a problem with the player itself. I tried asking the dev of the player and got no reply as of this post.


    Zitat Zitat von scionsamurai Beitrag anzeigen
    k. i tried making the changes and it didnt work. then i tried copying ur code and it still didnt work. so im thinking it is the way im "blit"ing the box to the screen or my version of lua player. i have luaplayer 0.20. any more suggestions would be appreciated. btw thanks for the responses Xteaph-N, :)
    I see I just tried to make it in luaplayer 0.20, and you are right. The problem is in the way it blits. The variable i is increasing but the box is not for some reason. I guess that part is not looping, just how it was made I guess.

    Luaplayer HM has a resize function. Image.resize() example:

    Image.resize(100,100,box)

    Also this works on PNG image files too!

  20. #9950
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    @dan No need to get defensive. You're not exactly the best coder yourself.

    You too, Xteaph-N.

    Anyways,
    Zitat Zitat von Xteaph-N Beitrag anzeigen
    As for indentation, I simply hate them. I like them in C/C++, but in lua I it's hard for my eyes to look at it.
    Indent. Seriously.

  21. #9951
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    darn i was hoping my guess was wrong. is coding for hm much different than coding for just regular? and if i was gonna go off what i know, should i learn hm or pge? suggestions?

  22. #9952
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von scionsamurai Beitrag anzeigen
    darn i was hoping my guess was wrong. is coding for hm much different than coding for just regular? and if i was gonna go off what i know, should i learn hm or pge? suggestions?
    HM is going to be most similar to what your using now. PGE is much different then HM. But PGE is going to be your best bet. It's a bit more complex but the trade of is certainly worth it. But for what your doing PGE might not have the resize function.

    But I think this is a good solution to your problem in luaplayer 0.20.

    Also I was thinking this might also be a solution:

    Code:
    blue=Color.new(0,0,255)
    
    box1=Image.createEmpty(32,32)
    box1:clear(blue)
    
    box2=Image.createEmpty(47,47)
    box2:clear(blue)
    
    box3=Image.createEmpty(62,62)
    box3:clear(blue)
    
    box4=Image.createEmpty(77,77)
    box4:clear(blue)
    
    
    box5=Image.createEmpty(92,92)
    box5:clear(blue)
    
    Box={x = 30, y = 100}
    
    Image_Change = box1
    screenwidth = 480
    screenheight = 272
    counter=0
    
    function BoxZoom()
    counter=counter+1
    if counter == 5 then
    Image_Change = box2
    end
    if counter == 10 then
    Image_Change = box3
    end
    if counter == 15 then
    Image_Change = box4
    end
    if counter == 20 then
    Image_Change = box5
    counter = 0
    end
    end
    
    while true do
    pad = Controls.read()
    screen:clear()
    
    if pad:r() then
    BoxZoom()
    end
    
    screen:blit(Box.x,Box.y,Image_Change)
    
    if pad:start() then
    break
    end
    screen.waitVblankStart()
    screen.flip()
    end
    Tell me what you think?

    Zitat Zitat von Nielkie Beitrag anzeigen
    Anyways,

    Indent. Seriously.
    I'm not going to do it. It really disorients me. Besides I bet none will try to learn from my lua script anyway.

  23. #9953
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    YES. This will work. all i need to do is switch image back and forth. while holding r. thanks for the help. :)

  24. #9954
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von scionsamurai Beitrag anzeigen
    YES. This will work. all i need to do is switch image back and forth. while holding r. thanks for the help. :)
    Great! If you need any extra help feel free to PM me.

  25. #9955
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie Beitrag anzeigen
    @dan No need to get defensive. You're not exactly the best coder yourself.

    You too, Xteaph-N.

    Anyways,

    Indent. Seriously.
    No but i'm not the worst either. Anyway lets leave it at that.

    @Xteaph-N - Did you even get it working in the end? Though like with most HM things, it's hard to give a good explaination as the docs themselves aren't that good.

  26. #9956
    QJ Gamer Blue
    Points: 2.018, Level: 27
    Level completed: 12%, Points required for next Level: 132
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Beiträge
    69
    Points
    2.018
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    sorry double post. please delete this one

  27. #9957
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    No but i'm not the worst either. Anyway lets leave it at that.

    @Xteaph-N - Did you even get it working in the end? Though like with most HM things, it's hard to give a good explaination as the docs themselves aren't that good.
    Well, no there is a glitch in HM. You can't call out Ogg.stop() unless you plan on stopping forever. But I found a pretty good way around this. I'll just compose the music myself in lua.

    Let me demonstrate an example:


    Code:
    Piano_A = Sound.load("A.wav")
    Piano_B = Sound.load("B.wav")
    Piano_C = Sound.load("C.wav")
    Piano_D = Sound.load("D.wav")
    Piano_E = Sound.load("E.wav")
    Piano_F = Sound.load("F.wav")
    Piano_G = Sound.load("G.wav")
    
    Piano_AS = Sound.load("A#.wav")
    Piano_BS = Sound.load("B#.wav")
    Piano_CS = Sound.load("C#.wav")
    Piano_DS = Sound.load("D#.wav")
    Piano_ES = Sound.load("E#.wav")
    Piano_FS = Sound.load("F#.wav")
    Piano_GS = Sound.load("G#.wav")
    
    Tempo = 1
    Counter = 0
    
    function BGM1()
    Counter = Counter + Tempo
    
    if Counter >= 100 and Counter <= 199 then
    Piano_A:play()
    end
    if Counter == 200 and Counter <= 299 then
    Piano_A:play()
    end
    if Counter == 300 and Counter <= 399 then
    Piano_A:play()
    end
    if Counter == 400 and Counter <= 499 then
    Piano_A:play()
    end
    --Et Cetera.....
    end
    
    while true do
    pad = Controls.read
    BGM1()
    
    -- This increases the tempo of the song, I.E. Speed
    if pad:right() then
    Tempo = Tempo + .1
    end
    
    if pad:left() then
    Tempo = Tempo - .1
    end
    
    screen.waitVblankStart()
    end
    This is just my concept I haven't actually done it yet, nor do I know the code above will work. Though this should work in theory. Even if this doesn't work it is obviously possible so I will do it.
    Geändert von Xteaph-N (06-22-2009 um 01:15 PM Uhr)

  28. #9958
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    That's a crappy way to do it.
    Code:
    noteNames = {'A', 'A#' 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'}
    pianoSounds = {}
    
    
    for i, noteName in ipairs(noteNames) do
    	pianoSounds[noteName] = Sound.load(noteName .. '.wav')
    end
    
    
    song = {
    	{length = 1, name = 'E'},
    	{length = 1, name = 'D'},
    	{length = 1, name = 'C'},
    	{length = 1, name = 'D'},
    	{length = 1, name = 'E'},
    	{length = 1, name = 'E'},
    	{length = 2, name = 'E'}
    }
    
    for i, note in iparis(song) do
    	pianoSounds[note.name]:play()
    	wait(note.length)
    end

  29. #9959
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie Beitrag anzeigen
    That's a crappy way to do it.
    Code:
    noteNames = {'A', 'A#' 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'}
    pianoSounds = {}
    
    
    for i, noteName in ipairs(noteNames) do
    	pianoSounds[noteName] = Sound.load(noteName .. '.wav')
    end
    
    
    song = {
    	{length = 1, name = 'E'},
    	{length = 1, name = 'D'},
    	{length = 1, name = 'C'},
    	{length = 1, name = 'D'},
    	{length = 1, name = 'E'},
    	{length = 1, name = 'E'},
    	{length = 2, name = 'E'}
    }
    
    for i, note in iparis(song) do
    	pianoSounds[note.name]:play()
    	wait(note.length)
    end
    Not long enough! Also I just simply hate the method in which you are doing this.

    BTW this doesn't look legal in lua.

  30. #9960
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Huh?


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 07:52 AM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .