Seite 227 von 342 ErsteErste ... 127 177 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 277 327 ... LetzteLetzte
Zeige Ergebnis 6.781 bis 6.810 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; Thanks...

  
  1. #6781
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Thanks



  2. #6782
    QJ Gamer Blue
    Points: 4.239, Level: 41
    Level completed: 45%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    somewhere
    Beiträge
    119
    Points
    4.239
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Ok I added animation to my game on start up and it works fine on the pc but when run it on my psp I get this error "Libpng warning: Incomplete compressed datastream in iCCP chunk Libpng warning: profile size field missing from iCCP chunk

  3. #6783
    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

    is it possible to make color with half opacity???

    i thought lowering RGBA element would make it half transparent, but that doesnt seem to work :/

  4. #6784
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    transparentred = Color.new(255,0,0,127)

  5. #6785
    QJ Gamer Blue
    Points: 4.239, Level: 41
    Level completed: 45%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    somewhere
    Beiträge
    119
    Points
    4.239
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak101
    Ok I added animation to my game on start up and it works fine on the pc but when run it on my psp I get this error "Libpng warning: Incomplete compressed datastream in iCCP chunk Libpng warning: profile size field missing from iCCP chunk
    any body know whats wrong

  6. #6786
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak101
    any body know whats wrong
    Yeah, youre using the windows port of lua player
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  7. #6787
    QJ Gamer Blue
    Points: 4.239, Level: 41
    Level completed: 45%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    somewhere
    Beiträge
    119
    Points
    4.239
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    But it works fine on the pc

  8. #6788
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    But windows luaplayer ftl

  9. #6789
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Hey guys i was wondereing if there is a tutorial for making an digital clock anywhere. Or if someone could just help me out.

    Thanks Bob Hoil

  10. #6790
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    couldn't you just use the screen.waitVblankStart() to your advantage, all you'll need is the set of numbers

  11. #6791
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    I have a question can you get the time that is set on the psp and use that and have it print to the screen some how so that would be the clock?
    -= Double Post =-
    That way you don't have to code an entire clock.
    Geändert von Bob Hoil (04-15-2007 um 06:38 PM Uhr) Grund: Automerged Doublepost

  12. #6792
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Go to the lua snippets thread and theres a clock snippet i have in there just look for it

  13. #6793
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    I just found it before you posted it thanks.:)

  14. #6794
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Bob Hoil
    Hey guys i was wondereing if there is a tutorial for making an digital clock anywhere. Or if someone could just help me out.

    Thanks Bob Hoil
    Its...in...the... luaplayer....build....
    -= Double Post =-
    Zitat Zitat von pspfreak101
    But it works fine on the pc
    It does? I thought you had a problem with it?
    Geändert von youresam (04-15-2007 um 07:04 PM Uhr) Grund: Automerged Doublepost
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  15. #6795
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    that's what i thought too

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

    pspfreak - Try opening and re-saving your image giving you the problem as PNG using MSPaint. Other than that, i dont know what to suggest you try.

    ...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


  17. #6797
    Monster Masher
    Points: 5.084, Level: 45
    Level completed: 67%, Points required for next Level: 66
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Behind you...
    Beiträge
    265
    Points
    5.084
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Hello, Ive just started to learn Lua

    Ive made a small script which im trying to run in luaplayerwindows, and i get an error that in line ten "then" expected near " ="

    heres the code:

    Code:
    red = Color.new(255, 0, 0)
    blue = Color.new(0, 0, 255)
    green = Color.new(0, 255, 0)
    color = red
    while true do
    screen:print(0, 0, "This text is red. Press 'X' to change the color.", color)
    screen.flip()
    end
    if pad:cross() then
    if color = red then
    color = blue
    end
    if color = blue then
    color = green
    end
    if color = green then
    color = red
    end
    end
    while true do
    screen.waitVblankStart()
    end
    Now I know it's something in the syntax of if statements, and dont flame me for being a Luan00b. Please just say the problem and leave me alone.

  18. #6798
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    when using if statements, you need to use "==" instead of"="

  19. #6799
    Monster Masher
    Points: 5.084, Level: 45
    Level completed: 67%, Points required for next Level: 66
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Behind you...
    Beiträge
    265
    Points
    5.084
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Ok, thanks. Another problemo in another script:

    Code:
    --variables
    easy=1
    med=1
    hard=1
    enemy1={}
    enemy2={}
    enemy3={}
    bullet={}
    
    --Load images
    
    bulletimg=Image.load("bullet.png")
    planeimg=Image.load("blob.png")
    
    --TIMERS
    easytimer=0
    medtimer=0
    hardtimer=0
    
    --Collision script
    function Death(obj)
    if (obj.x+obj.width>bullet.x) and (obj.x<bullet.x+16) and (obj.y+obj.height>bullet.y) and (obj.y<bullet.y+16) then
    score=score+20
    obj.x=1000000000
    end
    end
    
    --Increase the timers
    easytimer=easytimer+1
    medtimer=medtimer+1
    hardtimer=hardtimer+1
    
    --reset them
    if easytimer>300 then
    easytimer=0
    enemy1[easy]={x=math.random(480-32), y=0, width=32, height=32}
    easy=easy+1
    end
    
    if medtimer>450 then
    medtimer=0
    enemy2[med]={x=math.random(480-32), y=0, width=32, height=32}
    med=med+1
    end
    
    if hardtimer>600 then
    hardtimer=0
    enemy3[hard]={x=math.random(480-32), y=0, width=32, height=32}
    hard=hard+1
    end
    
    --Draw the planes
    while true do
    for a=1,easy do
    screen:blit(enemy1[a].x, enemy1[a].y, planeimg, false)
    end
    for b=1,med do
    screen:blit(enemy1[b].x, enemy1[b].y, planeimg, false)
    end
    for c=1,hard do
    screen:blit(enemy1[c].x, enemy1[c].y, planeimg, false)
    end
    end
    At line 55 (the first for) attempting to index "?"

    Is this because the for statement is wrong, or that I cant use easy?

  20. #6800
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    did you try it without using easy

  21. #6801
    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 TacticalPinguin
    transparentred = Color.new(255,0,0,127)
    thx, thats what i was doing... but i didnt know it doesnt work in windows lua player

  22. #6802
    QJ Gamer Blue
    Points: 3.525, Level: 37
    Level completed: 17%, Points required for next Level: 125
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    81
    Points
    3.525
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    whats wrong with this line?
    pad = Controls.read()

    I get an error "Attempt to index global 'controls' (a nil value)"

  23. #6803
    Monster Masher
    Points: 5.084, Level: 45
    Level completed: 67%, Points required for next Level: 66
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Behind you...
    Beiträge
    265
    Points
    5.084
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    weird that seems odd...check capitals.

    on another note:

    Code:
    alarm={}
    red=Color.new(255, 0, 0)
    b=1
    for a=1, 6400 do
    alarm[a]=0
    end
    alarm[0]=60
    block={}
    block[1]={x=math.random(440), y=math.random(240), width=32, height=32}
    blockimg=Image.load("circle.png")
    while true do
    for a=1, 6400 do
    if alarm[a]>0 then
    alarm[a]=alarm[a]-1
    end
    end
    if alarm[0]<=1 then
    block[b+1]={x=math.random(440), y=math.random(240), width=32, height=32}
    alarm[0]=60
    end
    for f=1, b do
    screen:clear()
    screen:print(0, 0, alarm[0], red)
    screen:blit(block[f].x, block[f].y, blockimg, false)
    screen.flip()
    screen.waitVblankStart()
    block[f].y=block[f].y+1
    end
    end
    should act as an alarm - only the alarm never goes down. it is always 60. shouldnt
    Code:
    for a=1, 6400 do
    if alarm[a]>0 then
    alarm[a]=alarm[a]-1
    end
    end
    make it go down?

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

    nothing

    question: is it possible to draw circle ??? i looked in SGs transmutation script but i want to draw it without that "animation"

  25. #6805
    QJ Gamer Blue
    Points: 3.525, Level: 37
    Level completed: 17%, Points required for next Level: 125
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    81
    Points
    3.525
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von xmex
    weird that seems odd...check capitals.

    Nope. I tried upper and lowercase. Same problem.

  26. #6806
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yumCOOKIEZZ
    whats wrong with this line?
    pad = Controls.read()

    I get an error "Attempt to index global 'controls' (a nil value)"
    That's not the line the error is referring to.



    Code:
    for a=1, 6400 do
    alarm[a]=0
    end
    alarm[0]=60
    while true do
    for a=1, 6400 do
    if alarm[a]>0 then
    alarm[a]=alarm[a]-1
    end
    end
    you are setting alarm[1-6400]==0, and then you say alarm[0]=60, and then you loop from 1 to 6400 checking if it's greater than zero.

    I really don't know how you're not getting an error, because table indices do not begin at zero in Lua. Even if they did, that if statement would never be true since you don't check the zeroth entry of the table in the while loop, whatever that means. On top of that, it only decrements the current entry, so even if it did what you seem to be trying to make it do, the table would just be {59,0,0,0,0,0,........}.

  27. #6807
    QJ Gamer Blue
    Points: 3.525, Level: 37
    Level completed: 17%, Points required for next Level: 125
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    81
    Points
    3.525
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von LMelior
    That's not the line the error is referring to.



    Code:
    for a=1, 6400 do
    alarm[a]=0
    end
    alarm[0]=60
    while true do
    for a=1, 6400 do
    if alarm[a]>0 then
    alarm[a]=alarm[a]-1
    end
    end
    you are setting alarm[1-6400]==0, and then you say alarm[0]=60, and then you loop from 1 to 6400 checking if it's greater than zero.

    I really don't know how you're not getting an error, because table indices do not begin at zero in Lua. Even if they did, that if statement would never be true since you don't check the zeroth entry of the table in the while loop, whatever that means. On top of that, it only decrements the current entry, so even if it did what you seem to be trying to make it do, the table would just be {59,0,0,0,0,0,........}.
    It said line 54 and...that was line 54 o.o

  28. #6808
    Monster Masher
    Points: 5.084, Level: 45
    Level completed: 67%, Points required for next Level: 66
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Behind you...
    Beiträge
    265
    Points
    5.084
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    okok, i see fixed it. But now a new problem:

    I have a variable called direction, which is 0 - 360. If i hold left it goes up, and right it goes down. How can I calculate the correct x and y increments to use this to move around? as in if it was 0, which i want to be right, it would be x=x+2. And if it was 45 it would be x=x+1 y=y-1. The thing is, I cant have 360 if statements. Is the an algorithm for this?

  29. #6809
    QJ Gamer Green
    Points: 5.382, Level: 47
    Level completed: 16%, Points required for next Level: 168
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    508
    Points
    5.382
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von xmex
    okok, i see fixed it. But now a new problem:

    I have a variable called direction, which is 0 - 360. If i hold left it goes up, and right it goes down. How can I calculate the correct x and y increments to use this to move around? as in if it was 0, which i want to be right, it would be x=x+2. And if it was 45 it would be x=x+1 y=y-1. The thing is, I cant have 360 if statements. Is the an algorithm for this?
    You can use basic trigonometry: SOHCAHTOA

    You have an angle, and a distance, you can calculate the x and y by applying knowledge from the above link.

  30. #6810
    Monster Masher
    Points: 5.084, Level: 45
    Level completed: 67%, Points required for next Level: 66
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Behind you...
    Beiträge
    265
    Points
    5.084
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Well that sort of is the idea but i'm not quite into Sin Cosine i cant really understand it. In Game Maker there was a function which returned the x and y componenets of a length and direction, which would help, except i doubt Lua has that.


 

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:53 AM Uhr.

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