Seite 257 von 342 ErsteErste ... 157 207 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 307 ... LetzteLetzte
Zeige Ergebnis 7.681 bis 7.710 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; Zitat von Mistabeen Could someone take a look at this code, for some reason I get in my Debug (working ...

  
  1. #7681
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Mistabeen
    Could someone take a look at this code, for some reason I get in my Debug (working with LuaDevKit)
    Exit Value: 1
    usage: luaplayer script.lua

    If I open another script it opens just fine, so I guess I must be not seeing something that is probably so obvious

    Spoiler for Lua code:
    -- colors --
    red= Color.new(255,0,0)
    green= Color.new(0,255,0)
    white= Color.new(255,255,255)
    yellow= Color.new(255,226,40)

    -- Timer --
    counter = Timer.new()
    counter:start()

    -- images --
    bighit= Image.load("bighit.png")

    -- music table --
    notes={}
    notes[1]={time=5000,note=1}
    notes[2]={time=7000,note=1}
    notes[3]={time=10000,note=1}
    notes[4]={time=12000,note=1}

    -- vars --
    oldpad = Controls.read()

    -- Main loop --
    while true do
    pad = Controls.read()
    screen:clear()
    currentTime = counter:time()

    screen:blit(50,50,bighit)


    screen.waitVblankStart()
    oldpad=pad
    screen.flip()
    end

    -= Double Post =-
    I eventualy found what was wrong, for some reason my filename was to big kinda silly

    I've got another problem tho
    is there any decent soundsupport for LUA? or is there a way to preload my musicfiles, or is there a way to reset my timer as soon as the music starts playing.
    Right now I had to use wav for my music (.xm file was the worst thing ever) and that plays, only problem is there is a delay and I need my music to be in perfect sync with my timer.
    timer:reset(0)



  2. #7682
    QJ Gamer Green
    Points: 7.599, Level: 58
    Level completed: 25%, Points required for next Level: 151
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Belgium
    Beiträge
    594
    Points
    7.599
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    timer:reset(0)
    that is not what I meanth, I startplaying my music, but there is a small delay on the music, LUA player has to load the file first
    so I would like mt counter to reset the exact moment you hear thre sound

  3. #7683
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    You can't as once you call music.playFile() it loads and plays, you can't inject your own timer:start() code after the load sequence.

    The best you can do is guess via trial and error when the music starts playing (500 miliseconds after calling music.playfile, etc.)

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  4. #7684
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Question I am a new lua n00b, plz help I am making new game with mraellis

    First I was looking on how to get started, but I am done with that part and have done the Hello world script.lua already, and all of the lessons on evilmana.com, and am now trying to do a overall goal of creating a game called RODM or Run or Die, Mouse based on a flash game called Bat and Mouse, but I am running into problems. Go to page 7 or later for my latest problems
    Geändert von Gam3freQ (07-22-2007 um 09:34 PM Uhr) Grund: is pretty n00by so it won't be posted

  5. #7685
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Most basic tutorials for C and LUA here:
    http://www.psp-programming.com/tutorials/
    Some more advanced here:
    http://www.psp-programming.com/forum...uncements;id=1

  6. #7686
    QJ Gamer Blue
    Points: 3.795, Level: 38
    Level completed: 97%, Points required for next Level: 5
    Overall activity: 27,0%

    Registriert seit
    Jul 2007
    Beiträge
    296
    Points
    3.795
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    No good C++ guides on the internet? Nice joke. Link.

  7. #7687
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Art
    Most basic tutorials for C and LUA here:
    http://www.psp-programming.com/tutorials/
    Some more advanced here:
    http://www.psp-programming.com/forum...uncements;id=1
    thanks i'll start from there
    Zitat Zitat von _dysfunctional
    No good C++ guides on the internet? Nice joke. Link.
    and the first link will help me code for psp and use a compiler for psp right? no. I seriously doubt it. Anyways the link above from Art shows BOTH C and lua even though C++ and C arn't the same thing, but I'm pretty sure they're similar. I'll start in lua so I don't need to compile :P

    Ok I am just starting and all, my Hello World worked, but is there like a flash application of some sort that lets me click on a color and it will show me the RGB? (0, 0, 255 for blue, for example) because I know there is one in photoshop but that makes my computer lag like hell

    EDIT: NVRM what i'm using is microsoft paint - go to colors at the top, click on edit colors, click on define custom colors, and a full RGB table will come up and if you click anywhere it shows you what the RGB values are for that color WHOOHOO yay




    Now we are going to flip the screen again, set the volume, and wait on the screen until the sound is finished. Put this in your code:
    screen.waitVblankStart(24 0)
    Music.volume(128)
    As we touched on before, there are sixty Vblanks in a second, so we are pausing the program for four seconds (240/60 = 4). "screen.flip()" just updates the screen. And, Music.volume(128) sets the volume to 128; this is the highest that the volume goes (0 is the lowest). Now our loading screen (and our intro) are done! Hooray! Give your self a big hug. (Aside: whitehawk is a little weird for adding that in, but hey who am I, the editor, to judge?)
    Ok the bold, italisized, underlined part above is where I am confused. Here is a copy/paste of what I have done so far
    Code:
    System.usbDiskModeActivate()
    pink = Color.new(255, 0 , 153)
    blue = Color.new(0 , 153, 255)
    orange = Color.new(255, 102, 0)
    gray = Color.new(150, 150, 150)
    black = Color.new(0 , 0 , 0)
    screen:print(194, 136, "Loading: 0%", pink)
    screen.flip()
    background = Image.load("images/background.jpg")
    screen:clear()
    screen:print(194, 136, "Loading: 20%", pink)
    screen.flip()
    circle = Image.load("images/buttons/circle_button.png")
    down = Image.load("images/buttons/down_arrow.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 40%", pink)
    screen.flip()
    
    l = Image.load("images/buttons/left_trigger.png")
    left = Image.load("images/buttons/left_arrow.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 60%", pink)
    screen.flip()
    
    r = Image.load("images/buttons/right_trigger.png")
    right = Image.load("images/buttons/right_arrow.png")
    boltsnd = Sound.load("music/comp.wav")
    
    screen:clear()
    screen:print(194, 136, "Loading: 80%", pink)
    screen.flip()
    
    square = Image.load("images/buttons/square_button.png")
    triangle = Image.load("images/buttons/triangle_button.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 90%", pink)
    screen.flip()
    
    up = Image.load("images/buttons/up_arrow.png")
    x = Image.load("images/buttons/cross_button.png")
    splash = Image.load("images/lua.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 99%", pink)
    screen.flip()
    
    screen.waitVblankStart(240)
    Music.volume(128)
    Now those last two lines were copied from the quote, but he says that we are going to do screen.flip again, so I was thinking if I should make it look like this

    screen.flip()
    screen.waitVblankStart(24 0)
    Music.volume(128)

    but then again, that would do a double screen clear which would be pointless to put the same line twice, so should I put it after the screen.waitVblankStart(24 0) and before the music volume? or should I ignore that completely?

    EDIT: it is now 3:00 am WHERE I LIVE so I'll go to bed and see if I can get an answer tomorrow. hopefully someone will help me so i can become a good coder in the future. I am not going to post any half-witted lua releases when I learn to code, instead, i am going to see if there are any good ideas, and if there arn't any, then I will switch to C, which I will have a basic understanding of programming applications altogether so learning C will make more sense, or i can try to completely master lua and come up with something three-quarters-witted instead of half-witted (i havn't seen any good lua applicaitons or games at all so i can't expect me to break the barrier of lua vs. C)
    Geändert von Gam3freQ (07-17-2007 um 10:56 PM Uhr)

  8. #7688
    QJ Gamer Silver
    Points: 12.453, Level: 73
    Level completed: 1%, Points required for next Level: 397
    Overall activity: 80,0%

    Registriert seit
    Mar 2007
    Beiträge
    1.129
    Points
    12.453
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von psDevWiki
    width, height Font:getTextSize(string)

    Returns the width and height, which will be used, if the specified text is drawn with this font and the current font size.
    would this be valid?
    Code:
    wpt,hpt = proportional:getTextSize(title)
    i need the width of the text in title when printed with the proportional font.
    -= Double Post =-
    oh and a bit more detail if anyone cant follow what i'm doing:
    Code:
    --center and print text
    proportional = Font.createProportional()
    proportional:setPixelSizes(0, 10)
    wpt,hpt = proportional:getTextSize(title)
    icon92:fontPrint(proportional, 45-(wpt/2), 64, title)
    Geändert von Da_MerV (07-18-2007 um 11:03 AM Uhr) Grund: Automerged Doublepost

  9. #7689
    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 Gam3freQ
    and the first link will help me code for psp
    Yes.

  10. #7690
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    Yes.
    K then, fine, I'll start with lua first though just to get the hang of it, please read my above post and help me

  11. #7691
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    when he says again i think he means because you have done it several times already
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  12. #7692
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slicer4ever
    when he says again i think he means because you have done it several times already
    That's correct but if you look in my code there is a flip right above the last two lines, and he says again so he wants it to be there two lines in a row? i guess not I will just leave it as it is so that I can see if it can be read properly now.

    The first thing we're going to do is start our game loop and display the background.
    while true do
    screen:blit(0, 0, background, false)
    Remember from the first tutorial when we used the infinite loop at the end? Well, this uses the same concept, except we are going to do the main bulk of our program until the user exits the script rather than just pausing. The other line (obviously, since this is about the gagillionth time we've done this) writes the image into the offscreen buffer.
    I thought you do screen.flip() to write to the onscreen buffer? why are there all of those spaces before the screen:blit(0, 0, background, false) ?

    Since it says 0, 0, background, false does that mean that the background goes from onscreen to offscreen and becomes false while it is true? :sigh: not getting anywhere

    Please someone tell me about the spaces. in the tutorial it says nothing about them. see look they are here too ( to the left of screenrint and screen.flip - does that mean to assosicate with the control.pad?)
    Code:
              screen:print(135, 251, "Press 'Start' to restart", blue)
              screen:print(110, 261, "Press 'Select' for a screenshot", blue)
              screen:print(383, 35, "Support:", black)
              screen:print(365, 45, "PS3Lounge.net", orange)
              screen:print(365, 55, "scriptscribbler.com/psp", gray)
              screen.flip()

  13. #7693
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    everything is drawn behind the screen in order to show the stuff drawn u have to call screen.flip()
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  14. #7694
    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

    Google around the subject of double buffering.

    Here is my 'go' at trying to explain it.

    Most games are double buffered nowadays, this means they have a section of memory that holds the pixel data to display to the screen.

    It is called double buffering because you have an 'on-screen' buffer which is the pixel data being displayed on the screen in a frame. There is also another buffer, the 'off-screen' buffer that also holds pixel data, it is 'off-screen' so you can edit that data (through blitting for example) without affecting the image currently on the screen.

    When you flip the buffers, the on-screen buffer now becomes the off-screen buffer and the off-screen buffer becomes the on-screen one which is then displayed on screen.

    The reason why we wait for the Vblank ( read this ) to start before flipping buffers is because this is when the horizontal scanline of your display finishes rendering what you can see on the screen. This is the point when you can flip the buffers without affecting what the screen is currently trying to display.

    If you don't what for the Vblank, you will tearing or shearing in the display because you have changed the data that the screen is reading from which holds a slightly different image.

  15. #7695
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    Google around the subject of double buffering.

    Here is my 'go' at trying to explain it.

    Most games are double buffered nowadays, this means they have a section of memory that holds the pixel data to display to the screen.

    It is called double buffering because you have an 'on-screen' buffer which is the pixel data being displayed on the screen in a frame. There is also another buffer, the 'off-screen' buffer that also holds pixel data, it is 'off-screen' so you can edit that data (through blitting for example) without affecting the image currently on the screen.

    When you flip the buffers, the on-screen buffer now becomes the off-screen buffer and the off-screen buffer becomes the on-screen one which is then displayed on screen.

    The reason why we wait for the Vblank ( read this ) to start before flipping buffers is because this is when the horizontal scanline of your display finishes rendering what you can see on the screen. This is the point when you can flip the buffers without affecting what the screen is currently trying to display.

    If you don't what for the Vblank, you will tearing or shearing in the display because you have changed the data that the screen is reading from which holds a slightly different image.
    thanks, well, i finally finished my code, i went to try it on my PSP, and it says error at line 53 expect end or something like that I am gonna paste my entire code here now
    Code:
    1. System.usbDiskModeActivate()
    2. pink = Color.new(255, 0 , 153)
    3. blue = Color.new(0 , 153, 255)
    4. orange = Color.new(255, 102, 0)
    5. gray = Color.new(150, 150, 150)
    6. black = Color.new(0 , 0 , 0)
    7. screen:print(194, 136, "Loading: 0%", pink)
    8. screen.flip()
    9. background = Image.load("images/background.jpg")
    10. screen:clear()
    11. screen:print(194, 136, "Loading: 20%", pink)
    12. screen.flip()
    13. circle = Image.load("images/buttons/circle_button.png")
    14. down = Image.load("images/buttons/down_arrow.png")
    15. screen:clear()
    16. screen:print(194, 136, "Loading: 40%", pink)
    17. screen.flip()
    18. l = Image.load("images/buttons/left_trigger.png")
    19. left = Image.load("images/buttons/left_arrow.png")
    20. screen:clear()
    21. screen:print(194, 136, "Loading: 60%", pink)
    22. screen.flip()
    23. r = Image.load("images/buttons/right_trigger.png")
    24. right = Image.load("images/buttons/right_arrow.png")
    25. boltsnd = Sound.load("music/comp.wav")
    26. screen:clear()
    27. screen:print(194, 136, "Loading: 80%", pink)
    28. screen.flip()
    29. square = Image.load("images/buttons/square_button.png")
    30. triangle = Image.load("images/buttons/triangle_button.png")
    31. screen:clear()
    32. screen:print(194, 136, "Loading: 90%", pink)
    33. screen.flip()
    34. up = Image.load("images/buttons/up_arrow.png")
    35. x = Image.load("images/buttons/cross_button.png")
    36. splash = Image.load("images/lua.png")
    37. screen:clear()
    38. screen:print(194, 136, "Loading: 99%", pink)
    39. screen.flip()
    40. screen.waitVblankStart(240)
    41. Music.volume(128)
    42. while true do
    43. screen:blit(0, 0, background, false)
    44. pad = Controls.read()
    45. screen:print(135, 251, "Press 'Start' to restart", blue)
    46. screen:print(110, 261, "Press 'Select' for a screenshot", blue)
    47. screen:print(383, 35, "Support:", black)
    48. screen:print(365, 45, "PS3Lounge.net", orange)
    49. screen:print(365, 55, "scriptscribbler.com/psp", gray)
    50. screen.flip()
    51. if pad:cross() then
    52. screen:blit(50, 228, x)
    53. screen.flip()
    54. end
    55. if pad:circle() then
    56. screen:blit(90, 195, circle)
    57. screen.flip()
    58. end
    59. if pad:triangle() then
    60. screen:blit(45, 165, triangle)
    61. screen.flip()
    62. end
    63. if pad:square() then
    64. screen:blit(15, 195, square)
    65. screen.flip()
    66. end
    67. if pad:up() then
    68. screen:blit(60, 40, up)
    69. screen.flip()
    70. end
    71. if pad:right() then
    72. screen:blit(90, 65, right)
    73. screen.flip()
    74. end
    75. if pad:down() then
    76. screen:blit(60, 80, down)
    77. screen.flip()
    78. end
    79. if pad:left() then
    80. screen:blit(30, 65, left)
    81. screen.flip()
    82. end
    83. if pad:l() then
    84. screen:blit(4, 6, l)
    85. screen.flip()
    86. end
    87. if pad:r() then
    88. screen:blit(403, 4, r)
    89. screen.flip()
    90. end
    91. if pad:select() then screen:save("screenshot.tga") end
    92. if pad:start() then
    93. break
    94. end
    I numbered them just for the forum
    as you can see, there is an end at line 54 so I don't see a problem
    here is the code without listing: (bold line 54)
    Spoiler for full code:
    Code:
    System.usbDiskModeActivate()
    pink = Color.new(255, 0 , 153)
    blue = Color.new(0 , 153, 255)
    orange = Color.new(255, 102, 0)
    gray = Color.new(150, 150, 150)
    black = Color.new(0 , 0 , 0)
    screen:print(194, 136, "Loading: 0%", pink)
    screen.flip()
    background = Image.load("images/background.jpg")
    screen:clear()
    screen:print(194, 136, "Loading: 20%", pink)
    screen.flip()
    circle = Image.load("images/buttons/circle_button.png")
    down = Image.load("images/buttons/down_arrow.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 40%", pink)
    screen.flip()
    
    l = Image.load("images/buttons/left_trigger.png")
    left = Image.load("images/buttons/left_arrow.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 60%", pink)
    screen.flip()
    
    r = Image.load("images/buttons/right_trigger.png")
    right = Image.load("images/buttons/right_arrow.png")
    boltsnd = Sound.load("music/comp.wav")
    
    screen:clear()
    screen:print(194, 136, "Loading: 80%", pink)
    screen.flip()
    
    square = Image.load("images/buttons/square_button.png")
    triangle = Image.load("images/buttons/triangle_button.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 90%", pink)
    screen.flip()
    
    up = Image.load("images/buttons/up_arrow.png")
    x = Image.load("images/buttons/cross_button.png")
    splash = Image.load("images/lua.png")
    
    screen:clear()
    screen:print(194, 136, "Loading: 99%", pink)
    screen.flip()
    
    screen.waitVblankStart(240)
    Music.volume(128)
    
    while true do
              screen:blit(0, 0, background, false)
    
    pad = Controls.read()
    
              screen:print(135, 251, "Press 'Start' to restart", blue)
              screen:print(110, 261, "Press 'Select' for a screenshot", blue)
              screen:print(383, 35, "Support:", black)
              screen:print(365, 45, "PS3Lounge.net", orange)
              screen:print(365, 55, "scriptscribbler.com/psp", gray)
              screen.flip()
    
               if pad:cross() then
                        screen:blit(50, 228, x)
                        screen.flip()
              end 
    
               if pad:circle() then
                        screen:blit(90, 195, circle)
                        screen.flip()
              end
    
              if pad:triangle() then
                        screen:blit(45, 165, triangle)
                        screen.flip()
              end
    
              if pad:square() then
                        screen:blit(15, 195, square)
                        screen.flip()
              end
    
              if pad:up() then
                        screen:blit(60, 40, up)
                        screen.flip()
              end
    
              if pad:right() then
                        screen:blit(90, 65, right)
                        screen.flip()
              end
    
              if pad:down() then
                        screen:blit(60, 80, down)
                        screen.flip()
              end
    
              if pad:left() then
                        screen:blit(30, 65, left)
                        screen.flip()
              end
    
              if pad:l() then
                        screen:blit(4, 6, l)
                        screen.flip()
              end
    
              if pad:r() then
                        screen:blit(403, 4, r)
                        screen.flip()
              end 
    
              if pad:select() then screen:save("screenshot.tga") end
              if pad:start() then
                        break
              end

  16. #7696
    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

    As for the spaces issue:
    http://c2.com/cgi/wiki?CodeFormatting
    And more specifically: http://c2.com/cgi/wiki?WhitespaceIsGood
    -= Double Post =-
    This is WHY you properly format code, with it properly formatted the error is obvious:
    Code:
    System.usbDiskModeActivate()
    
    pink = Color.new(255, 0 , 153)
    blue = Color.new(0 , 153, 255)
    orange = Color.new(255, 102, 0)
    gray = Color.new(150, 150, 150)
    black = Color.new(0 , 0 , 0)
    
    screen:print(194, 136, "Loading: 0%", pink)
    screen.flip()
    background = Image.load("images/background.jpg")
    screen:clear()
    
    screen:print(194, 136, "Loading: 20%", pink)
    screen.flip()
    circle = Image.load("images/buttons/circle_button.png")
    down = Image.load("images/buttons/down_arrow.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 40%", pink)
    screen.flip()
    l = Image.load("images/buttons/left_trigger.png")
    left = Image.load("images/buttons/left_arrow.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 60%", pink)
    screen.flip()
    r = Image.load("images/buttons/right_trigger.png")
    right = Image.load("images/buttons/right_arrow.png")
    boltsnd = Sound.load("music/comp.wav")
    screen:clear()
    
    screen:print(194, 136, "Loading: 80%", pink)
    screen.flip()
    square = Image.load("images/buttons/square_button.png")
    triangle = Image.load("images/buttons/triangle_button.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 90%", pink)
    screen.flip()
    up = Image.load("images/buttons/up_arrow.png")
    x = Image.load("images/buttons/cross_button.png")
    splash = Image.load("images/lua.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 99%", pink)
    screen.flip()
    screen.waitVblankStart(240)
    Music.volume(128)
    
    while true do
    	screen:blit(0, 0, background, false)
    	pad = Controls.read()
    	screen:print(135, 251, "Press 'Start' to restart", blue)
    	screen:print(110, 261, "Press 'Select' for a screenshot", blue)
    	screen:print(383, 35, "Support:", black)
    	screen:print(365, 45, "PS3Lounge.net", orange)
    	screen:print(365, 55, "scriptscribbler.com/psp", gray)
    	screen.flip()
    	
    	if pad:cross() then
    		screen:blit(50, 228, x)
    		screen.flip()
    	end
    	
    	if pad:circle() then
    		screen:blit(90, 195, circle)
    		screen.flip()
    	end
    	if pad:triangle() then
    		screen:blit(45, 165, triangle)
    		screen.flip()
    	end
    	
    	if pad:square() then
    		screen:blit(15, 195, square)
    		screen.flip()
    	end
    	
    	if pad:up() then
    		screen:blit(60, 40, up)
    		screen.flip()
    	end
    	
    	if pad:right() then
    		screen:blit(90, 65, right)
    		screen.flip()
    	end
    	
    	if pad:down() then
    		screen:blit(60, 80, down)
    		screen.flip()
    	end
    	
    	if pad:left() then
    		screen:blit(30, 65, left)
    		screen.flip()
    	end
    	
    	if pad:l() then
    		screen:blit(4, 6, l)
    		screen.flip()
    	end
    	
    	if pad:r() then
    		screen:blit(403, 4, r)
    		screen.flip()
    	end
    	
    	if pad:select() then 
    		screen:save("screenshot.tga") 
    	end
    	
    	if pad:start() then
    		break
    	end
    There are also a several common mistakes in there, why are you flipping buffers every time you press a button? Why are you not waiting for the Vbank to start before flipping buffers?
    Geändert von yaustar (07-18-2007 um 08:22 AM Uhr) Grund: Automerged Doublepost

  17. #7697
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    you forgot to end the while true do place an end at the very end of the script
    -= Double Post =-
    also i surgest takeing out all those sceen.flips and place just 1 right before you end the while true do
    Geändert von slicer4ever (07-18-2007 um 08:25 AM Uhr) Grund: Automerged Doublepost
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  18. #7698
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    As for the spaces issue:
    http://c2.com/cgi/wiki?CodeFormatting
    And more specifically: http://c2.com/cgi/wiki?WhitespaceIsGood
    -= Double Post =-
    This is WHY you properly format code, with it properly formatted the error is obvious:
    Code:
    System.usbDiskModeActivate()
    
    pink = Color.new(255, 0 , 153)
    blue = Color.new(0 , 153, 255)
    orange = Color.new(255, 102, 0)
    gray = Color.new(150, 150, 150)
    black = Color.new(0 , 0 , 0)
    
    screen:print(194, 136, "Loading: 0%", pink)
    screen.flip()
    background = Image.load("images/background.jpg")
    screen:clear()
    
    screen:print(194, 136, "Loading: 20%", pink)
    screen.flip()
    circle = Image.load("images/buttons/circle_button.png")
    down = Image.load("images/buttons/down_arrow.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 40%", pink)
    screen.flip()
    l = Image.load("images/buttons/left_trigger.png")
    left = Image.load("images/buttons/left_arrow.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 60%", pink)
    screen.flip()
    r = Image.load("images/buttons/right_trigger.png")
    right = Image.load("images/buttons/right_arrow.png")
    boltsnd = Sound.load("music/comp.wav")
    screen:clear()
    
    screen:print(194, 136, "Loading: 80%", pink)
    screen.flip()
    square = Image.load("images/buttons/square_button.png")
    triangle = Image.load("images/buttons/triangle_button.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 90%", pink)
    screen.flip()
    up = Image.load("images/buttons/up_arrow.png")
    x = Image.load("images/buttons/cross_button.png")
    splash = Image.load("images/lua.png")
    screen:clear()
    
    screen:print(194, 136, "Loading: 99%", pink)
    screen.flip()
    screen.waitVblankStart(240)
    Music.volume(128)
    
    while true do
    	screen:blit(0, 0, background, false)
    	pad = Controls.read()
    	screen:print(135, 251, "Press 'Start' to restart", blue)
    	screen:print(110, 261, "Press 'Select' for a screenshot", blue)
    	screen:print(383, 35, "Support:", black)
    	screen:print(365, 45, "PS3Lounge.net", orange)
    	screen:print(365, 55, "scriptscribbler.com/psp", gray)
    	screen.flip()
    	
    	if pad:cross() then
    		screen:blit(50, 228, x)
    		screen.flip()
    	end
    	
    	if pad:circle() then
    		screen:blit(90, 195, circle)
    		screen.flip()
    	end
    	if pad:triangle() then
    		screen:blit(45, 165, triangle)
    		screen.flip()
    	end
    	
    	if pad:square() then
    		screen:blit(15, 195, square)
    		screen.flip()
    	end
    	
    	if pad:up() then
    		screen:blit(60, 40, up)
    		screen.flip()
    	end
    	
    	if pad:right() then
    		screen:blit(90, 65, right)
    		screen.flip()
    	end
    	
    	if pad:down() then
    		screen:blit(60, 80, down)
    		screen.flip()
    	end
    	
    	if pad:left() then
    		screen:blit(30, 65, left)
    		screen.flip()
    	end
    	
    	if pad:l() then
    		screen:blit(4, 6, l)
    		screen.flip()
    	end
    	
    	if pad:r() then
    		screen:blit(403, 4, r)
    		screen.flip()
    	end
    	
    	if pad:select() then 
    		screen:save("screenshot.tga") 
    	end
    	
    	if pad:start() then
    		break
    	end
    There are also a several common mistakes in there, why are you flipping buffers every time you press a button? Why are you not waiting for the Vbank to start before flipping buffers?
    Because It told me to do so here which is the guide I followed to make this, look on page 4 it says to do that. It didn't say to do a Vblank because then that would need a screen.wait()
    -= Double Post =-
    Zitat Zitat von slicer4ever
    you forgot to end the while true do place an end at the very end of the script
    -= Double Post =-
    also i surgest takeing out all those sceen.flips and place just 1 right before you end the while true do
    OH I SEE I FORGOT THE WHILE TRUE DO END THING! thanks will try give me one second to test - the screenflips were told to be done by the guide I was just following the guide and also just wondering but if I do screen.flip(1) will that put the screen upidedown?

    EDIT: it works now yay - the screen flips are because when you let go of the button the screen has to clear so that it don't show all the buttons again
    Geändert von Gam3freQ (07-18-2007 um 08:32 AM Uhr) Grund: Automerged Doublepost

  19. #7699
    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

    Because It told me to do so here which is the guide I followed to make this, look on page 4 it says to do that. It didn't say to do a Vblank because then that would need a screen.wait()
    Didn't I just explain why and how we use them in my last post? Did you just ignore it?

  20. #7700
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    screen.flip does not actually flip the screen upside down it only flips the unseen buffer to be seen
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  21. #7701
    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

    PSP-programming 's Lua tutorials are terrible. Use these instead:
    http://wiki.ps2dev.org/psp:lua_player:tutorial
    http://www.evilmana.com/tutorials/lua_tutorial_list.php

    They are at least slightly better.

  22. #7702
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    Didn't I just explain why and how we use them in my last post? Did you just ignore it?
    no i didn't ignore it
    Zitat Zitat von yaustar
    There are also a several common mistakes in there, why are you flipping buffers every time you press a button? Why are you not waiting for the Vbank to start before flipping buffers?
    Because As long as you hold the button the image will display, and when you let go the image dissapears. if the vbank starts then that means that when i let go it will still be displayed right?
    Zitat Zitat von yaustar
    PSP-programming 's Lua tutorials are terrible. Use these instead:
    http://wiki.ps2dev.org/psp:lua_player:tutorial
    http://www.evilmana.com/tutorials/lua_tutorial_list.php

    They are at least slightly better.
    WIll try now that I got my first button tester working!
    Zitat Zitat von slicer4ever
    screen.flip does not actually flip the screen upside down it only flips the unseen buffer to be seen
    oh lol I was just wondering if I put a 1 in there if it would do that

    EDIT: i do remember somewhere in that code I put it to play a sound, but i don't remember where and i don't hear the sound

  23. #7703
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    NO as i said the screen.flip() well only flip the unseen to seen so calling them at diffrent points does u no good, just call one right before you end the while true do loop
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  24. #7704
    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

    This is how the while loop should look like:
    Code:
    while true do
    	screen:blit(0, 0, background, false)
    	
    	pad = Controls.read()
    	
    	screen:print(135, 251, "Press 'Start' to restart", blue)
    	screen:print(110, 261, "Press 'Select' for a screenshot", blue)
    	screen:print(383, 35, "Support:", black)
    	screen:print(365, 45, "PS3Lounge.net", orange)
    	screen:print(365, 55, "scriptscribbler.com/psp", gray)
    	
    	if pad:cross() then
    		screen:blit(50, 228, x)
    	end
    	
    	if pad:circle() then
    		screen:blit(90, 195, circle)
    	end
    	if pad:triangle() then
    		screen:blit(45, 165, triangle)
    	end
    	
    	if pad:square() then
    		screen:blit(15, 195, square)
    	end
    	
    	if pad:up() then
    		screen:blit(60, 40, up)
    	end
    	
    	if pad:right() then
    		screen:blit(90, 65, right)
    	end
    	
    	if pad:down() then
    		screen:blit(60, 80, down)
    	end
    	
    	if pad:left() then
    		screen:blit(30, 65, left)
    	end
    	
    	if pad:l() then
    		screen:blit(4, 6, l)
    	end
    	
    	if pad:r() then
    		screen:blit(403, 4, r)
    	end
    	
    	if pad:select() then 
    		screen:save("screenshot.tga") 
    	end
    	
    	if pad:start() then
    		break
    	end
    	
    	screen.waitVblankStart()
    	screen.flip()
    end

  25. #7705
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Smile

    Zitat Zitat von yaustar
    This is how the while loop should look like:
    Code:
    while true do
    	screen:blit(0, 0, background, false)
    	
    	pad = Controls.read()
    	
    	screen:print(135, 251, "Press 'Start' to restart", blue)
    	screen:print(110, 261, "Press 'Select' for a screenshot", blue)
    	screen:print(383, 35, "Support:", black)
    	screen:print(365, 45, "PS3Lounge.net", orange)
    	screen:print(365, 55, "scriptscribbler.com/psp", gray)
    	
    	if pad:cross() then
    		screen:blit(50, 228, x)
    	end
    	
    	if pad:circle() then
    		screen:blit(90, 195, circle)
    	end
    	if pad:triangle() then
    		screen:blit(45, 165, triangle)
    	end
    	
    	if pad:square() then
    		screen:blit(15, 195, square)
    	end
    	
    	if pad:up() then
    		screen:blit(60, 40, up)
    	end
    	
    	if pad:right() then
    		screen:blit(90, 65, right)
    	end
    	
    	if pad:down() then
    		screen:blit(60, 80, down)
    	end
    	
    	if pad:left() then
    		screen:blit(30, 65, left)
    	end
    	
    	if pad:l() then
    		screen:blit(4, 6, l)
    	end
    	
    	if pad:r() then
    		screen:blit(403, 4, r)
    	end
    	
    	if pad:select() then 
    		screen:save("screenshot.tga") 
    	end
    	
    	if pad:start() then
    		break
    	end
    	
    	screen.waitVblankStart()
    	screen.flip()
    end
    whoa amazing I'll get on those tutorials you linked right away because apparently psp-programming sucks at this. the above seems to make alot more sense even though both work, so i will definately not do this

  26. #7706
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    also u didn't put in the while loop to play sound u only loaded in sound
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  27. #7707
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    In that case what is a Vblank? If you read my post, you should be able to answer this correctly?
    a vbank is 1 60th of a second because 60 vbanks is one second right? and i put it to stay on Loading 99% for 240 vbanks which is 4 seconds so that is what it is
    Zitat Zitat von slicer4ever
    also u didn't put in the while loop to play sound u only loaded in sound
    The tutorial only showed how to play text and images not sounds it only said how to load the .wav files

  28. #7708
    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 Gam3freQ
    whoa amazing I'll get on those tutorials you linked right away because apparently psp-programming sucks at this. the above seems to make alot more sense even though both work, so i will definately not do this
    The AI tutorial is fine, it was written by someone who knows what he/she is talking about.
    -= Double Post =-
    Zitat Zitat von Gam3freQ
    a vbank is 1 60th of a second because 60 vbanks is one second right? and i put it to stay on Loading 99% for 240 vbanks which is 4 seconds so that is what it is
    No. What you are trying to say is that a Vblank occurs 60 times a sec which isn't true. This depends on the screens refresh rate. At the moment my PC monitor is 75hz so it has 75 vblanks. Try again.
    Geändert von yaustar (07-18-2007 um 08:47 AM Uhr) Grund: Automerged Doublepost

  29. #7709
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    if remeber correctly i believe it was:

    play:sound(sound name here);
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  30. #7710
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    The AI tutorial is fine, it was written by someone who knows what he/she is talking about.
    -= Double Post =-

    No. What you are trying to say is that a Vblank occurs 60 times a sec which isn't true. This depends on the screens refresh rate. At the moment my PC monitor is 75hz so it has 75 vblanks. Try again.
    so the below isn't true? wow I really need to start over on this
    Zitat Zitat von psp-programming.com
    fter all of our stuff is loaded, we are just going to quickly pause at the "Loading 100%" so our user gets a chance to see it. To do this, we'll use the "waitVblankStart" function that we talked about at the end of Lesson 01.
    screen.waitVblankStart(60 )
    This time we have passed a parameter to the function. This just tells it to pause for a certain amount of time. There are sixty Vblanks in a second, so this pauses our program at this point for exactly one second.
    so the vblank is the refresh rate?
    Zitat Zitat von slicer4ever
    if remeber correctly i believe it was:

    play:sound(sound name here);
    will try this


 

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 09:00 PM Uhr.

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