Seite 175 von 342 ErsteErste ... 75 125 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 225 275 ... LetzteLetzte
Zeige Ergebnis 5.221 bis 5.250 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; i don't know if i should ask this here, but i will anyway: i am getting ready to release my ...

  
  1. #5221
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    i don't know if i should ask this here, but i will anyway:

    i am getting ready to release my game now, but i want to know how to change the icons that are displayed on the psp when you make your game an eboot. Because right now it looks like it is luaplayer right now.



  2. #5222
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TacticalPinguin
    Alright.

    ANyways for you people having troubles with the number thingie, to get the number of items in a table use this:

    blah = table.getn(nameoftablewit houtquotes)

    blah will now be a number equal to the number of items in the table.
    Thank you so, so much. That helps more than you would ever imagine...

  3. #5223
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von GuitarGod1134
    omg i missed that lol thx
    lol, yea. i hate that like in your case it will detect the whole while loop when the error is really an if statement. With bigger code it is hard to find the error.

  4. #5224
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Does anyone know if I declare a variable as local, then put it through a if...then thing and change it's value will it still be local? for example

    Code:
    local x=4
    if x==4 then
    x=3
    end
    will x still be local?

    And I need some way to save memory because I have a lot of images to load, and the program can't get through half of them

  5. #5225
    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 PSPhakkor
    Does anyone know if I declare a variable as local, then put it through a if...then thing and change it's value will it still be local? for example

    Code:
    local x=4
    if x==4 then
    x=3
    end
    will x still be local?

    And I need some way to save memory because I have a lot of images to load, and the program can't get through half of them
    Yes it will be local but will save you **** all memory in relative to images.

    You need to load images that you need to use and unload the ones you don't.

  6. #5226
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    Yes it will be local but will save you **** all memory in relative to images.

    You need to load images that you need to use and unload the ones you don't.
    That's pretty smart... Nice logic lol. The game actually runs pretty nicely now

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

    whats the problem with this? o_O

    Code:
    read = io.open("flash1:/registry/system.dreg","r")
    read:seek("set", 0x2380)
    line = read:read()
    read:close()
    error:attempt to index global "read" (a nil value)


  8. #5228
    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 myschoo
    whats the problem with this? o_O

    Code:
    read = io.open("flash1:/registry/system.dreg","r")
    read:seek("set", 0x2380)
    line = read:read()
    read:close()
    error:attempt to index global "read" (a nil value)

    It couldn't open the file.

  9. #5229
    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

    thats strange...i will have a look

    edit:

    this is xmODs src code of Pass Retriever:

    Code:
    file = io.open("system.dreg","r")
    file:seek("set", 0x2de0)
    line = file:read(4)
    file:close()
    and it works ...

  10. #5230
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    I'm really just throwing this out there, but maybe either lua can't read from flash1, or the prefix isn't "flash1:\" maybe "f1:\" or something different

  11. #5231
    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

    strange is he didnt even use prefix... o_O

    edit. strange, i probably did a mistake, it works...

    its like this:

    ("flash1:/registry/system.dreg","r")

  12. #5232
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Does anyone know how to completely end a program? I can't use "break" because then the psp starts running the code that's outside of the structure that I "broke" out of. Lua doesn't have a "main" function like C++, does it?

  13. #5233
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    um not that i know of...PSPhakkor. there is a function called 'os.exit()' that does that, but its only usable in one of the modded luaplayers. cools' third mod, i think.
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

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

    nah... thats System.Quit() ;) not os.exit()

  15. #5235
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    can anyone answer my question before? i need to know how to change the pictures shown for a game when you see them in the game folder, actually seen on your psp.

    i used the actual luaplayer, and put my game in it so that it would load my game, but when you go to look for it on your psp it will still show the luaplayer icons, and say luaplayer.

    does anyone know how to change this? because many of you who have released games know i guess, and i need to do this. Any help is appreciated.
    -= Double Post =-
    and after reading my post, it sounds confusing, so i want to tell everyone that i am trying to make it a standalone eboot, instead of having my game loaded from lua player.
    Geändert von emericaska8r (01-24-2007 um 01:34 PM Uhr) Grund: Automerged Doublepost

  16. #5236
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von emericaska8r
    can anyone answer my question before? i need to know how to change the pictures shown for a game when you see them in the game folder, actually seen on your psp.

    i used the actual luaplayer, and put my game in it so that it would load my game, but when you go to look for it on your psp it will still show the luaplayer icons, and say luaplayer.

    does anyone know how to change this? because many of you who have released games know i guess, and i need to do this. Any help is appreciated.
    -= Double Post =-
    and after reading my post, it sounds confusing, so i want to tell everyone that i am trying to make it a standalone eboot, instead of having my game loaded from lua player.
    You're supposed to be able to do that with a program called PSpbrew, but I found it so confusing so I just got one of my beta testers do do it for me

    You can google a tutroial

    Thanks, guys, for answering my question. I got it working

  17. #5237
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    i have a quick question: is it possible to wrap text (on the psp screen) in lua, so i dont have to screen:fontPrint 6 times to fit my words in?

    If so, what function is used? Thanks for your help!

  18. #5238
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    @: parm289
    I had the same problem with my lua app. and the only solution i found to be the easiest and fastest was to make a transparent png and write your text in a program like gimp or photoshop. Save it and then load it and then blitted to the screen if u want an example or any further help i would be glad to help you just send me a pm.

    @: emericaska8r
    Read Your PMs'

  19. #5239
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    yeah, thats a good idea - i just used a lot of screen:fontPrints to do the job. doesnt look too snazzy, but it'll do the job for an faq page.

  20. #5240
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Im glad it helped

  21. #5241
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    no problem, another noob question though:
    i have a variable a, and the value of it constantly changes as the user presses the l and r buttons. i.e.:
    Code:
    if pad:l() then
    a = a+1
    end
    if pad:r() then
    a = a-1
    end
    that's not the real code, but i think you will get the idea. Now, the value of this variable is going to be displayed on the screen for the duration of a "while true do" loop. However, i can't seem to print the variable's value to the screen. I tried this:
    Code:
    screen:fontPrint(comic,0,0,a,white)
    screen:flip()
    screen.waitVblankStart(300)
    end
    .....but it didn't work. How can i get the valua of a variable as a string, so i can print it to the screen? Thanks for your help.

  22. #5242
    QJ Gamer Bronze
    Points: 9.999, Level: 66
    Level completed: 88%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Washington
    Beiträge
    759
    Points
    9.999
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    im trying to make a platform game and cuz im a dumb**** i dont know how to start, like i need to be able to have a flat image just move along all the time as the player does the image stuff is easy for me just the code.....
    (´・ω・‘)ノシ

  23. #5243
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    @: parm289

    Did you establish the value of your variable before your while true do loop

    Some sample code and an error message would be a lot better to help you.
    -= Double Post =-
    @: Jomann

    I believe your problem is scrolling, so you might want to look for some scrolling tutorials. I have the feeling scrolling has been covered in this thread before. If I find a link that can help you with the scrolling I'll post it later.
    Geändert von Dr.Gringo (01-24-2007 um 07:35 PM Uhr) Grund: Automerged Doublepost

  24. #5244
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    yes, i did establish the variable a, as a = 0. Here's some sample code:

    Code:
    while true do
      local pad = Controls.read()
      if pad:select() then
        faq()
      end
    if pad:start( ) then
    screen:clear( )
    countForm( )
    screen:fontPrint(comic,0,0,a,white)
    screen.flip( )
    screen.waitVblankStart(300)
    end
      screen:blit(0, 0, bg2)
      screen:fontPrint(comic,115,20,"Welcome to Parm's Card Counting app.",white)
      screen:fontPrint(comic,130,40,"For help and FAQs, press Select.",white)
      screen:fontPrint(comic,138,60,"To start counting, press Start.",white)
      screen.flip()
    end
    Code:
    function countForm()
    a = 0
    if pad:r( ) then
    a = a+1
    end
    if pad:l( ) then
    a = a-1
    end
    while true do
    screen:print(a)
    screen.flip( )
    screen.waitVblankStart(300)
    end
    end
    However, running this code, i do not get an error message, just a blank (black) screen, with no text. I'm pretty sure this is because i need to somehow obtain the string (which is just a one or two digit number) from the variable a. I'm guessing it only takes a small portion of code to do this, but searched wikis and google, and found nothing....

    Thanks for your almost-immediate replies

    EDIT: I added the function countForm into this post, so you can check out the way i declared the variable.

  25. #5245
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    How do I get it so it waits for one animation blit to be over untill it blits another image? I know i'm not supposed to do this but what else can I do.

    Ex.
    Code:
    while true do
    logo:advancedBlit(0,0,500,1)
    screen:blit(0,0,screen)
    screen:waitVblankStart()
    screen.flip()
    end
    They load correctly, but they just go over eachother, and yes i know if I put screen:clear() between them it would clear the screen for the "screen" image but it won't show the animation.. In time that is..

  26. #5246
    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 Cheez Pirate
    How do I get it so it waits for one animation blit to be over untill it blits another image? I know i'm not supposed to do this but what else can I do.

    Ex.
    Code:
    while true do
    logo:advancedBlit(0,0,500,1)
    screen:blit(0,0,screen)
    screen:waitVblankStart()
    screen.flip()
    end
    They load correctly, but they just go over eachother, and yes i know if I put screen:clear() between them it would clear the screen for the "screen" image but it won't show the animation.. In time that is..

    try this: (not sure itll work however):

    Code:
    state = anim
    
    while true do
    if state == anim then
    logo:advancedBlit(0,0,500,1)
    state = other
    end
    if state == other then
    screen:blit(0,0,screen)
    end
    screen:waitVblankStart()
    screen.flip()
    end
    remember, animlib depends on states.
    --------------------------------------------------------------------------------------

  27. #5247
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    @: Cheez Pirate

    If you want to create an animation I believe using a timer would be the best. If you are a total noob at timers try going to EvilMana for some tutorials.
    -= Double Post =-
    @: parm289

    I have a feeling a should equal 1 when you declare the value but since im doing some really hard homework right now i dont really have time to look for some solutions... I'll be here tomorrow at 6:00 P.M. If you need some more help.

    Wait... you should establish the value of "a" outside the while true do loop and outside your functions so you can access it trough the font print. Go and try it. Report what you get.

    Ohh and one more thing. What are all those waitVblanks for???
    Geändert von Dr.Gringo (01-24-2007 um 09:04 PM Uhr) Grund: Automerged Doublepost

  28. #5248
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    dr gringo: i tried both of your solutions, but i did not get to test them because of another small problem...i cannot get the app to detect the start button when it's being pressed. there is no official error message returned by luaplayer, but at the main menu, the start button doesnt work.
    heres the code that the error is located in:
    Code:
    while true do
      local pad = Controls.read()
      if pad:select() then
        faq()
      end
    if Controls.read():start() then
    screen:clear( )
    countForm( )
    screen:fontPrint(comic,0,0,a,white)
    screen.flip( )
    screen.waitVblankStart(300)
    end
      screen:blit(0, 0, bg2)
      screen:fontPrint(comic,115,20,"Welcome to Parm's Card Counting app.",white)
      screen:fontPrint(comic,130,40,"For help and FAQs, press Select.",white)
      screen:fontPrint(comic,138,60,"To start counting, press Start.",white)
      screen.flip()
    end
    I'm sorry for being noobish, but this is my first lua app, so be patient. Thanks for your help.

    EDIT: gringo: i'm guessing you downloaded the game package from my other thread, which is outdated...but anyway, the waitvblanks are for the loading and splash screens at the launch of the app.

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

    whats the exact error and which line?

  30. #5250
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Yeah you have to be more specific if you want us to help you out


 

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

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