Seite 125 von 342 ErsteErste ... 25 75 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 175 225 ... LetzteLetzte
Zeige Ergebnis 3.721 bis 3.750 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; dofile("index.lua") should do fine but if you want the whole LUAplayer load up again then use break. Something like this: ...

  
  1. #3721
    Points: 3.873, Level: 39
    Level completed: 49%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Beiträge
    47
    Points
    3.873
    Level
    39
    Downloads
    0
    Uploads
    0

    Standard

    dofile("index.lua") should do fine but if you want the whole LUAplayer load up again then use break. Something like this:
    if blahblahblah then
    break
    end



  2. #3722
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Hey guys, I need help making a file browser that opens up .PNGs onto the canvas for my yPaint? Can anyone help? Thanks :)

    http://www.yongobongo.com
    PSN - yongobongo

  3. #3723
    QJ Gamer Blue
    Points: 4.812, Level: 44
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    London, United Kingdom
    Beiträge
    131
    Points
    4.812
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    n2 = (lshift(string.byte(str,1 +k),4) & 0x30) + 1
    LUA 5.1 really doesnt like that line, more specificly "&" ...Lexical error?
    What changes would I need to do to make it run properly?

  4. #3724
    Asleep...
    Points: 11.516, Level: 70
    Level completed: 67%, Points required for next Level: 134
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    1.383
    Points
    11.516
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    --balls by Hedzx--

    -- define colors
    white = Color.new(255,255,255)
    red = Color.new(225,0,0)
    green = Color.new(0,225,0)
    blue = Color.new(0,0,225)
    blocks = 0

    --paddle
    player = {}
    player.x = 0
    player.y = 260
    player.width = 32

    player1 = Image.createEmpty(33,2)
    player1:clear(red)
    --end paddle

    -- ball
    ball = {}
    ball.x = 10
    ball.y = 100
    ball.state = "falling"
    ball1 = Image.createEmpty(2,2)
    ball1:clear(green)
    --end paddle

    -- block(s)
    block = {}

    for i = 1,1 do
    block[i] = { x = i + 0, y = i + 32, pos = true}
    end

    blocky = Image.createEmpty(32,32)
    blocky:clear(blue)

    while true do
    screen:clear()
    pad = Controls.read()

    -- control paddle left or right
    if pad:right() then
    player.x = player.x + 2
    end

    if pad:left() then
    player.x = player.x - 2
    end


    -- define the direction ball will fly
    if ball.state == "falling" then
    ball.y = ball.y + 1
    end

    if ball.state == "rising up" then
    ball.y = ball.y - 1
    end

    if ball.state == "rising left" then
    ball.y = ball.y - 1
    ball.x = ball.x - 1
    end

    if ball.state == "rising right" then
    ball.y = ball.y - 1
    ball.x = ball.x + 1
    end

    if ball.state == "falling right" then
    ball.y = ball.y + 1
    ball.x = ball.x + 1
    end

    if ball.state == "falling left" then
    ball.y = ball.y + 1
    ball.x = ball.x - 1
    end


    -- define "collision" (lol) for paddle..
    -- if on right it bounces right etc., etc.,

    if ball.y >= player.y and ball.x > player.x and ball.x < player.x + 11 then
    ball.state = "rising left"
    end

    if ball.y >= player.y and ball.x > player.x + 11 and ball.x < player.x + 22 then
    ball.state = "rising up"
    end

    if ball.y >= player.y and ball.x > player.x + 22 and ball.x < player.x + 33 then
    ball.state = "rising right"
    end

    -- wall code
    if ball.x < 0 and ball.state == "rising left" then
    ball.state = "rising right"
    end

    if ball.x > 480 and ball.state == "rising right" then
    ball.state = "rising left"
    end

    if ball.y < 0 and ball.state == "rising up" then
    ball.state = "falling"
    end

    if ball.y < 0 and ball.state == "rising left" then
    ball.state = "falling left"
    end

    if ball.y < 0 and ball.state == "rising right" then
    ball.state = "falling right"
    end

    if ball.x < 0 and ball.state == "falling left" then
    ball.state = "falling right"
    end

    if ball.x > 480 and ball.state == "falling right" then
    ball.state = "falling left"
    end



    -- block
    if ball.y < block[1].y +32 and ball.x < block[1].x + 32 and ball.pos == "rising up" and block[1].pos ~= false then
    blocks = 1
    block[1].pos = false
    ball.state = "falling"
    elseif ball.y < block[1].y and ball.x < block[1].x + 32 and ball.pos == "rising right" and block[1].pos ~= false then
    blocks = 1
    block[1].pos = false
    ball.state = "falling right"
    elseif ball.y < block[1].y and ball.x < block[1].x + 32 and ball.pos == "rising left" and block[1].pos ~= false then
    blocks = 1
    block[1].pos = false
    ball.state = "falling left"
    end


    -- end block


    -- blit paddle and player
    screenrint(190,100,"Balls By Hedzx", white)
    screen:blit(player.x, player.y, player1)
    screen:blit(ball.x, ball.y, ball1)
    screenrint(0, 0,"balls broken"..blocks, green)
    for a = 1,1 do
    if block[a].pos ~= false then
    screen:blit(block[1].x,block[1].y,blocky)
    end
    end

    -- flip screen and wait forever.

    screen.flip()
    screen.waitVblankStart()
    end
    k im making a breakout clone but the problem is that the box doesnt seem to do anything once its hit.
    also, how would i be able to make the boxes be side by side in the
    block[i] = { x = i + 0, y = i + 32, pos = true}
    because it just blits boxes on top of each other. any suggestionss on what to add the x by so that its next to the last block?? thanks.

  5. #3725
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Whenever i added OGG music format to my game is wouldnt load unlss it was loaded though IRShell, But when i removed it and converted it to .wav it worked, Does anyone know why?

  6. #3726
    Points: 3.873, Level: 39
    Level completed: 49%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Beiträge
    47
    Points
    3.873
    Level
    39
    Downloads
    0
    Uploads
    0

    Standard

    Are you using lua player 0.2? You need 0.2 to load .lrx libraries. This is interesting, i'm helping AN IDIOT WHO PIRATED MY GAME. If you have copied it fully, you would have a great example of playing OGGs don't you think?

  7. #3727
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    OMG, I am using .20, Look dude i dont like this, If you want i guess i can say i give you some credit, will that make you happy?
    Also, I am asking this question because i didnt priated your game i made it by myslef with the help of three others
    Geändert von Anti-QJ (10-21-2006 um 12:14 AM Uhr) Grund: Automerged Doublepost

  8. #3728
    Points: 3.873, Level: 39
    Level completed: 49%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Beiträge
    47
    Points
    3.873
    Level
    39
    Downloads
    0
    Uploads
    0

    Standard

    SOME CREDIT?!?!?? Don't you dare insult me like that. You owe me an APOLOGY.

  9. #3729
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    dude, chill out. you gonna get yourself banned. do you have PROOF (REAL PROOF) that he "pirated" your code? (the real term is "stolen", but meh.)
    --------------------------------------------------------------------------------------

  10. #3730
    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

    http://forums.qj.net/f-psp-developme...ml#post1121032

    I did a diff between the two dance.lua files.

  11. #3731
    Points: 3.873, Level: 39
    Level completed: 49%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Beiträge
    47
    Points
    3.873
    Level
    39
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    dude, chill out. you gonna get yourself banned. do you have PROOF (REAL PROOF) that he "pirated" your code? (the real term is "stolen", but meh.)
    Here's my proof: http://boardsus.playstation.com/play...=27479#M348145
    Notice the date. Sorry for not 'chilling' but I am willing to take a ban for what i think is right. The real term is plagiarize actually but who cares.

  12. #3732
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Hi can som one tell me what are the degree's in the analog like up is 0 and just a bit from the left is like 360 ? can som one help i ant get the correct number for the analog to work.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  13. #3733
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ZereoX
    Hi can som one tell me what are the degree's in the analog like up is 0 and just a bit from the left is like 360 ? can som one help i ant get the correct number for the analog to work.
    Code:
    if AX() >= 100 then
    --move right
    end
    if AX() <= -99 then
    --move left
    end
    if AY() >= 100 then
    --move up
    end
    if AY() <= -99 then
    --move down
    end
    --------------------------------------------------------------------------------------

  14. #3734
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Tkz grimfate i really apreciate.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  15. #3735
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ZereoX
    Tkz grimfate i really apreciate.

    no prob. BTW, you have to define AX and AY as:

    Code:
    AX = pad:analogX
    AY = pad:analogY
    or, you can just reaplce the AX, and the AY in the script i gave you with:

    Code:
    pad:analogX
    pad:analogY
    --------------------------------------------------------------------------------------

  16. #3736
    QJ Gamer Blue
    Points: 4.812, Level: 44
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    London, United Kingdom
    Beiträge
    131
    Points
    4.812
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von trex6662k5
    n2 = (lshift(string.byte(str,1 +k),4) & 0x30) + 1
    LUA 5.1 really doesnt like that line, more specificly "&" ...Lexical error?
    What changes would I need to do to make it run properly?
    Anyone? Im still fairly new to lua n any help will be apprieciated

  17. #3737
    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

    What are you trying to do with it?

  18. #3738
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von trex6662k5
    Anyone? Im still fairly new to lua n any help will be apprieciated

    what are you programming?? youre even using byte operations! but i dont think '&' is leagal in lua. try luaplayer .20
    --------------------------------------------------------------------------------------

  19. #3739
    QJ Gamer Blue
    Points: 4.812, Level: 44
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    London, United Kingdom
    Beiträge
    131
    Points
    4.812
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Thats the thing it doesnt work in luaplayer 0.20 works in others though
    The line originates from here
    As you can most likely tell from the function name, it converts a string to base64
    The code is johnny2002's and is from Xbox media center: Remote music interface which I have been adding features to. I want to be able to use the latest luaplayer 0.20 mod but due to a "Lexical error" (Writing conventions?) I cant use it.

    function encodeB64(str)
    local B64 = "ABCDEFGHIJKLMNOPQRSTUVWX YZabcdefghijklmnopqrstuvw xyz0123456789+/=";
    local out = ""
    local sl = string.len(str)
    for i = 0, math.ceil(sl/3)-1 do
    k = i*3
    n1 = rshift(string.byte(str,1+ k),2)+1
    n2 = (lshift(string.byte(str,1 +k),4) & 0x30) + 1
    n3 = 65
    n4 = 65
    if sl >= 2+k then
    n2 = n2 + (rshift(string.byte(str,2 +k),4) & 0x0F)
    n3 = (lshift(string.byte(str,2 +k),2) & 0x3C) + 1
    if sl >= 3+k then
    n3 = n3 + (rshift(string.byte(str,3 +k),6) & 0x03)
    n4 = string.byte(str,3+k) & 0x3F + 1
    end
    end
    out = out .. string.sub(B64,n1,n1) .. string.sub(B64,n2,n2) .. string.sub(B64,n3,n3) .. string.sub(B64,n4,n4)
    end
    return out
    end

  20. #3740
    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

    Assuming that & means bitwise and, try lookinbg around for band() function.

    http://www.wowwiki.com/Lua_functions

  21. #3741
    QJ Gamer Blue
    Points: 4.812, Level: 44
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    London, United Kingdom
    Beiträge
    131
    Points
    4.812
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Thanks I'll see wether it helps

  22. #3742
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    6ft. Down Underground........Oh and guess what my avatar is
    Beiträge
    387
    Points
    4.918
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Ok Ive got this code and whenever I try to run it I get
    Code:
    lua:19 <eof> expected near 'end'
    here is my code can you tell me whats wrong wit it
    Code:
    screen:clear()
    white = Color.new(255, 255, 255)
    
    background = Image.load("psp/IMAGE/psp.png")
    
    screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
    
    file = io.open("psp/score.txt", "r")
    
    score = file:read()
    
    file:close()
    
    screen:print(10,10,score,white)
    
    
    screen.waitVblankStart()
    screen.flip()
    end
    P.S. Thats the whole code

  23. #3743
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von the undead
    Ok Ive got this code and whenever I try to run it I get
    Code:
    lua:19 <eof> expected near 'end'
    here is my code can you tell me whats wrong wit it
    Code:
    screen:clear()
    white = Color.new(255, 255, 255)
    
    background = Image.load("psp/IMAGE/psp.png")
    
    screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
    
    file = io.open("psp/score.txt", "r")
    
    score = file:read()
    
    file:close()
    
    screen:print(10,10,score,white)
    
    
    screen.waitVblankStart()
    screen.flip()
    end
    P.S. Thats the whole code
    You either have to add a 'while true do' or take out the 'end'
    -= Double Post =-
    Wait, are you trying to load an image from the PSP folder in the root? If so, you have to do:

    ms0:/PSP/IMAGE/psp.png
    Geändert von Propel (10-21-2006 um 12:56 PM Uhr) Grund: Automerged Doublepost

  24. #3744
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    6ft. Down Underground........Oh and guess what my avatar is
    Beiträge
    387
    Points
    4.918
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Propel
    You either have to add a 'while true do' or take out the 'end'
    -= Double Post =-
    Wait, are you trying to load an image from the PSP folder in the root? If so, you have to do:

    ms0:/PSP/IMAGE/psp.png
    Ill try that, but no i have subfolder named psp
    -= Double Post =-
    ok thanks the 'while true do' worked....I cant beleive i didnt catch that
    Geändert von the undead (10-21-2006 um 09:20 PM Uhr) Grund: Automerged Doublepost

  25. #3745
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    hey , can you let a player use the analaog stick in lua and if you can please tell me how

  26. #3746
    i r leet lol
    Points: 17.776, Level: 84
    Level completed: 86%, Points required for next Level: 74
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    England
    Beiträge
    2.615
    Points
    17.776
    Level
    84
    Downloads
    0
    Uploads
    0

    Standard

    Yeh you can, i think it's like:
    Code:
    pad = Controls.read()
    if analog.x() and analog.y() then
    blah
    end
    At least i think...
    whyHELLOder.

  27. #3747
    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 mark.sparky
    hey , can you let a player use the analaog stick in lua and if you can please tell me how
    Grimfate126:

    Code:
    if AX() >= 100 then
    --move right
    end
    if AX() <= -99 then
    --move left
    end
    if AY() >= 100 then
    --move up
    end
    if AY() <= -99 then
    --move down
    end

  28. #3748
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    hey sorry to bother you guys again but can take a look at this code because i have been trying for hours but i just cant get the collision detection to work. Im trying to stop the player from walking into the fences.

    -EDIT- Just change the file extension to .lua
    Angehängte Dateien Angehängte Dateien

  29. #3749
    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

    playerx should be player.x in the collision code. playery should be player.y. Also oldx and oldy need to be globals (declared at the top) for the script.

  30. #3750
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    well at the top ive put in oldx = player.x and oldy = player.y
    and at the collision code ive put player.x and player.y but it is stilll not working


 

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

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