Seite 35 von 342 ErsteErste ... 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 85 135 ... LetzteLetzte
Zeige Ergebnis 1.021 bis 1.050 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; my break command works fine on windows, but not in PSP. ??? :icon_sad:...

  
  1. #1021
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    my break command works fine on windows, but not in PSP.

    ??? :icon_sad:


    D:

  2. #1022
    Think, Do, Gloat.
    Points: 12.687, Level: 73
    Level completed: 60%, Points required for next Level: 163
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    England, Norwich
    Beiträge
    1.422
    Points
    12.687
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    no worries altair, luckily, i just worked around the error. copied and pasted the stuff i had done into an older version of the app, so it works just fine! only took like 3 mins in the end.
    i'll have to keep thinking on it i think. i will try out some sounds in lua and see they lose quality if i hold them down.

  3. #1023
    <img src="images/smilies/psp.gif" border="0" alt="" title="" cl***="inlineimg" /> <img src="images/smilies/Punk.gif" border="0" alt="" title="" cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    if you find it out, please tell me, since i have the same problem

  4. #1024
    Points: 4.632, Level: 43
    Level completed: 41%, Points required for next Level: 118
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    3
    Points
    4.632
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Well. I'm preaty new to lua but have teh basics down. I want to make an rpg of some sort and right now I am trying to figure out how I would make the world (background?) from a tile sheet. I've seen some people do it that way so I figure its the best.

    I have looked at a bunch of tuorials and came across: "http://wiki.ps2dev.org/psp:lua_player:tutorial" Which at the bottom tells me about tiles and how to use them.

    now, I don't really get what is going on in the script. I could copy and past it and just use it but I would REALLY apriciate it if someone could tell me what each part means like:

    "screen:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)"

    screen:blit = prints picture to screen

    16 * x = first cordinate of something something -- 16 = number of pixels of "image.png", *=multiply, x = bla bla bla...

    or something like that. I dont know what Im talking about in the example but I hope you get what I mean. Thanks!

    P.S. If this has been answered then Im really sorry. Its just that 103 pages is alot!

  5. #1025
    Points: 11.498, Level: 70
    Level completed: 62%, Points required for next Level: 152
    Overall activity: 50,0%

    Registriert seit
    Dec 2005
    Ort
    LBC
    Beiträge
    516
    Points
    11.498
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    basically it's dynamically setting up the image locations and where they will appear on the screen..

    imagine your PSP screen is like a cartoon animation.. you have different layers.. for example your background, main character, foreground, etc..

    They all stack on top of each other in the order that you draw them.. so first things first you want to draw your background... in your case you will be using tiles to create the background.

    A table is created to store the information for the background and where to draw each tile. A function would then read the information from the table and get the variables which tell lua where to put the image.

    You should copy the tutorial script and images and get it working yourself. Once you have a working version of the tutorial, you can modify it by substituting your own images and adjusting the values to get it to work for your application. This will help you learn the small fine-tuning skills you will need to develop a bug-free application.

    Hope I've helped answer your question and good luck!

  6. #1026
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    I'm trying to blit a random image, i'm using this:

    Code:
    screen:blit(enemy.x,enemy.y,enemysprite[math.random(1,2)])
    and my array looks like this:

    Code:
    enemysprite = {}
    enemysprite.a = Image.load("Images/enemy1.png")
    enemysprite.b = Image.load("Images/enemy2.png")
    But i get this error:

    Code:
    error: Jumper.lua:93: bad argument #2 to `blit' (Image expected, got nil)
    Can you not blit from an array?

    Is there another way to do this?
    D:

  7. #1027
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    hmm i think you can, but you can always just use variables. And say if var==1 then image1 end etc. But using a table would be more convenient ofcourse.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  8. #1028
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    BTW what is the line where the error occurs?
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  9. #1029
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    The error occours on the blit.
    D:

  10. #1030
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Ok i got it: You haven't got it stored in enemysprite[number] but in enemysprite.a en .b which will never be generated by math.random obviously.

    So what you should do is:
    Code:
    enemysprite = {Image.load("Images/enemy1.png"),Image.load("Images/enemy2.png")}
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  11. #1031
    Points: 4.124, Level: 40
    Level completed: 87%, Points required for next Level: 26
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2
    Points
    4.124
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    can i ask some here??? guys if ever i update my psp to 2.6 version, can i still use my iso?

  12. #1032
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    Well that is not the kind of question to ask here. This thread is for LUA help only.

    But no you cannot use ISOs on 2.0+
    D:

  13. #1033
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    --deleted
    Geändert von Altair (03-22-2006 um 03:27 AM Uhr)
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  14. #1034
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    Yeah i saw it, thanks Altair.

    Most of my problems seem to be stupid mistakes, but at least you put me right.
    D:

  15. #1035
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    No prob and this way we get more games so i do it gladly.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  16. #1036
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    Yeah more games!

    As i start to get more experienced i will help here as much as i can.
    D:

  17. #1037
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    Is it possible to make it so that a press only counts once each time?

    For example, on my menu i have to tap left for one milisecond otherwise it zooms across, how can i make it so one press equals one move.
    D:

  18. #1038
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    Is there anyway to blit an image, wait a set amount of time, then blit another?
    D:

  19. #1039
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    err gutya, do something like:

    oldpad = controls.read
    pad = controls.read

    if pad ~= oldpad then
    code goes here...
    oldpad = pad
    end

    At least i think its this
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  20. #1040
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    No, that does not work.
    D:

  21. #1041
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    its like this:
    Code:
    while true do
    pad=controls.read
    if pad~=oldpad then
    
    put your control code here
    
    end -- end of the if pad~=oldpad loop
    oldpad=pad
    
    end --end of while loop
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  22. #1042
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Is there anyway to blit an image, wait a set amount of time, then blit another?
    Yes. OR use a timer (this way you still have functionality, i.e. the loop continues), OR use screen.waitVblanck() (this way the loop will pause for a given amount of time (60=1 second))
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  23. #1043
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    Thanks, but now i get this error, what on earth does is mean?

    Code:
    error: index.lua:131: <eof> expected near `end'
    D:

  24. #1044
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    You have to much ends, maybe it can also mean that you have to few. Anyway, check your ends.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  25. #1045
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    The oldpad thing doesnt work, heres what i have in my main loop:

    Code:
    --Main Loop
    while true do
    pad = Controls.read()
    if pad~=oldpad then
    
    if pad:down() then
    menustatus = 2
    end
    
    if pad:up() then
    menustatus = 1
    end
    
    if pad:cross() and menustatus == 1 then
    score = 0
    dofile("Jumper.lua")
    end
    
    if pad:cross() and menustatus == 2 then
    break
    end
    
    if pad:right() then
    dificulty = dificulty + 1
    end
    
    if pad:left() then
    dificulty = dificulty - 1
    end
    
    if dificulty > 3 then
    dificulty = 3
    end
    
    if dificulty < 1 then
    dificulty = 1
    end
    
    if menustatus == 1 then
    screen:print(200,248,"Play",green)
    screen:print(200,258,"Quit",white)
    end
    
    if menustatus == 2 then
    screen:print(200,248,"Play",white)
    screen:print(200,258,"Quit",green)
    end
    
    if dificulty == 1 then
    screen:print(160,208,"Easy",green)
    screen:print(200,208,"Medium",white)
    screen:print(250,208,"Hard",white)
    end
    
    if dificulty == 2 then
    screen:print(160,208,"Easy",white)
    screen:print(200,208,"Medium",green)
    screen:print(250,208,"Hard",white)
    end
    
    if dificulty == 3 then
    screen:print(160,208,"Easy",white)
    screen:print(200,208,"Medium",white)
    screen:print(250,208,"Hard",green)
    end
    screen.flip()
    screen.waitVblankStart()
    end
    
    if pad:right() then
    dificulty = dificulty + 1
    end
    
    if pad:left() then
    dificulty = dificulty - 1
    end
    
    if dificulty > 3 then
    dificulty = 3
    end
    
    if dificulty < 1 then
    dificulty = 1
    end
    
    if menustatus == 1 then
    screen:print(200,248,"Play",green)
    screen:print(200,258,"Quit",white)
    end
    
    if menustatus == 2 then
    screen:print(200,248,"Play",white)
    screen:print(200,258,"Quit",green)
    end
    
    if dificulty == 1 then
    screen:print(160,208,"Easy",green)
    screen:print(200,208,"Medium",white)
    screen:print(250,208,"Hard",white)
    end
    
    if dificulty == 2 then
    screen:print(160,208,"Easy",white)
    screen:print(200,208,"Medium",green)
    screen:print(250,208,"Hard",white)
    end
    
    if dificulty == 3 then
    screen:print(160,208,"Easy",white)
    screen:print(200,208,"Medium",white)
    screen:print(250,208,"Hard",green)
    end
    
    screen.flip()
    screen.waitVblankStart()
    oldpad=pad
    end
    D:

  26. #1046
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    look closer at my post. Anyway, the controls that you want to do something only ones if pressed should be in the "if pad~=oldpad then" and "end" commands. Now you have exactly those outside of them.
    Geändert von Altair (03-22-2006 um 06:28 AM Uhr)
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  27. #1047
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    I don't understand. :Argh:
    D:

  28. #1048
    Think, Do, Gloat.
    Points: 12.687, Level: 73
    Level completed: 60%, Points required for next Level: 163
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    England, Norwich
    Beiträge
    1.422
    Points
    12.687
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    you have added the right bits to the controls.
    if pad:------directional button-------() and
    oldpad:------directional button-------() ~= pad:------directional button-------() then
    (-------sound here-----)lay()
    end
    end
    obviously delete the spaces i created there. it's just to show you where to put them. make sure oldpad = pad is at the end, before you have the ends. so in the loop. and make sure you have
    oldpad = Controls.read()
    out of the loop at the beginning and finaly, make sure you have
    pad = Controls.read()
    at the beginning of the loop.


    obviously, change it from the sound play, to whatever you want it to do.

  29. #1049
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    So this would be correct?:

    Code:
    if pad:right() and 
    oldpad:right() ~= pad:right() then
    dificulty = dificulty + 1
    end
    
    if pad:left() and
    oldpad:left() ~= pad:right() then
    dificulty = dificulty - 1
    end
    if so it doesnt work
    D:

  30. #1050
    Think, Do, Gloat.
    Points: 12.687, Level: 73
    Level completed: 60%, Points required for next Level: 163
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    England, Norwich
    Beiträge
    1.422
    Points
    12.687
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    you spelt dificulty wrong, don't know if that makes a difference. it's difficulty.
    i'll take a look at the script if you want.


 

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 .