Seite 324 von 342 ErsteErste ... 224 274 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 ... LetzteLetzte
Zeige Ergebnis 9.691 bis 9.720 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; Tnx for the reply, but I found it already in someone else's script and now I'm testing it with a ...

  
  1. #9691
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    Tnx for the reply, but I found it already in someone else's script and now I'm testing it with a simple recovery.prx flasher (to change colours of recovery menu)

    Code:
    red = Color.new(255, 0, 0)
    background = Image.load("RecoveryMenu")
    done = false
    while true do
    pad = Controls.read()
    if pad:cross() and done == false then
    
    System.unassign("flash0:")
    System.assign("flash0:", "lflash0:0,0", "flashfat0:")
    System.copyFile("ms0:/PSP/GAME/Recovery_menu_flasher/recovery.prx","flash0:/vsh/module/recovery.prx",0) 
    done = true end
    if done == false then
    
    screen:print(200, 130, "Press X to flash your new Recovery Menu", red) else
    screen:print(200, 261, "Done! Please shutdown the PSP...!", red)
    end
    New problem:

    Code:
    if pad:up() and done == false then
    
    System.usbDiskModeActivate()
    done = true end
    if done == false then
    
    screen:print(100, 110, "Press up to activate USB", red)
    end
    
    if pad:down() and done == false then
    
    System.usbDiskModeDeactivate()
    done = true end
    if done == false then
    
    screen:print(100, 140, "Press down to deactivate USB", red)
    end
    When I press up to activate USB, usb gets activated, but the 2 last lines on the screen (= the 2 lines you see here) start to flicker and the loop gets stuck, pressing home works, and the script still accepts button input when putting backlight back on, but is has no effect anyfurther


    Geändert von Ben93 (02-27-2009 um 06:41 AM Uhr) Grund: new problem

  2. #9692
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    instead of done == true/false you should just have
    Code:
     
    if done then --would be true if 'done' is true.
    --OR
    if not done then --which would be if 'done' was false.

  3. #9693
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    tnx, I'll give it a try

  4. #9694
    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

    Zitat Zitat von dan369
    instead of done == true/false you should just have
    It's the same thing...

  5. #9695
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von _dysfunctional Beitrag anzeigen
    It's the same thing...
    I know, it just looks cleaner instead of having '==' everywhere. It also saves a bit of time but not much.

  6. #9696
    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

    You have to be using the eboot with the flash write/assign functions

  7. #9697
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Anti-QuickJay Beitrag anzeigen
    You have to be using the eboot with the flash write/assign functions

    I just make one with miro lua, and it works...

  8. #9698
    Developer
    Points: 13.989, Level: 76
    Level completed: 85%, Points required for next Level: 61
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Nov 2008
    Beiträge
    71
    Points
    13.989
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    yes you can make two buttons function as one, just do this.

    pad = Controls.read()
    if pad:cross() and pad:square() then
    break
    end

  9. #9699
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    If you didn't get it by now.
    Code:
    done = false
    red = Color.new(255,0,0)
    
    while not done do
      if pad:up() then
        System.usbDiskModeActivate()
        done = true
      end
    
      if pad:down() then
        System.usbDiskModeDeactivate()
        done = true
      end
    
      if pad:circle() or pad:triangle() then break end
    
      screen:print(100,110,"Press up to activate USB.",red)
      screen:print(100,120,"Press down to deactivate USB.",red)
      screen:print(100,130,"Press circle or triangle to exit.",red)
    end
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

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

    Zitat Zitat von Digikid13 Beitrag anzeigen
    If you didn't get it by now.
    Code:
    done = false
    red = Color.new(255,0,0)
    
    while not done do
      if pad:up() then
        System.usbDiskModeActivate()
        done = true
      end
    
      if pad:down() then
        System.usbDiskModeDeactivate()
        done = true
      end
    
      if pad:circle() or pad:triangle() then break end
    
      screen:print(100,110,"Press up to activate USB.",red)
      screen:print(100,120,"Press down to deactivate USB.",red)
      screen:print(100,130,"Press circle or triangle to exit.",red)
    end
    wouldn't that immidiatly end the program once u turn on or off the usb?
    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

  11. #9701
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    Your right here this is better.
    Code:
    red = Color.new(255,0,0)
    
    while true do
    
      screen.clear()
      pad = Controls.read()
    
      if pad:up() then
        System.usbDiskModeActivate()
      end
    
      if pad:down() then
        System.usbDiskModeDeactivate()
      end
    
      if pad:circle() or pad:triangle() then break end
    
      screen:print(100,110,"Press up to activate USB.",red)
      screen:print(100,120,"Press down to deactivate USB.",red)
      screen:print(100,130,"Press circle or triangle to exit.",red)
    end
    Geändert von Digikid13 (03-12-2009 um 02:35 PM Uhr)
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  12. #9702
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    you forgot pad = Controls.read()........

  13. #9703
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    .......
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  14. #9704
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Standard

    Hey guys, looking into lua, i wanna see how to do some basic stuff.
    This doesn't work though.

    Code:
    local green = pge.gfx.createcolor(255, 150, 0)
    local white = pge.gfx.createcolor(255, 255, 255)
    local black = pge.gfx.createcolor(0,0,0)
    local whitesemi = pge.gfx.createcolor(255, 255, 255, 50)
    
    local verdana9 = pge.font.load("verdana.ttf", 9, PGE_RAM)
    
    if not verdana9 then
        error("Failed to load font.")
    end
    
    local verdana12 = pge.font.load("verdana.ttf", 30, PGE_RAM)
    
    if not verdana12 then
        error("Failed to load font.")
    end
    
    local logo = pge.texture.load("background.png")
    
    if not logo then
        error("Failed to load logo.")
    end
    
    local index = 1
    
    local basedir = pge.dir.getcwd()
    
    while pge.running() do
    
        pge.controls.update()
        
        pge.gfx.startdrawing()
        
        pge.gfx.clearscreen()
        
        logo:activate()
        
        logo:draweasy(0, 0)
        verdana12:activate()
          verdana12:printcenter(10, white, "TestGame")
          verdana12:printcenter(115, white, "TestGame2")
    	verdana12:printcenter(200, black, "Press X to continue")
    	verdana12:printcenter(235, black, "Press O to Quit.")
             if pge.controls.pressed(PGE_CONTROL_CROSS) then
             verdana12:printcenter(60, white, "X presses")
    	 end
    	if pge.controls.presses(PGE_CONTROL_CIRCLE) then
    	pge.exit()
    	end
    
        
            
        
        pge.gfx.enddrawing()
        
        pge.gfx.swapbuffers()
    
    end
    But i always prints/does what ever is in the X event even when i dont press it.
    Any help?

  15. #9705
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    I'm not sure what is wrong with yours, but this works for me.

    Code:
    local green = pge.gfx.createcolor(255, 150, 0)
    local white = pge.gfx.createcolor(255, 255, 255)
    local black = pge.gfx.createcolor(0,0,0)
    
    local verdana12 = pge.font.load("verdana.ttf", 30, PGE_RAM)
    
    if not verdana12 then
    	error("Failed to load font.")
    end
    
    local logo = pge.texture.load("background.png")
    
    if not logo then
    	error("Failed to load logo.")
    end
    
    while pge.running() do
    
    	pge.controls.update()
    	pge.gfx.startdrawing()
    	pge.gfx.clearscreen()
    
    	logo:activate()
    	logo:draweasy(0, 0)
    
    	verdana12:activate()
    
    	verdana12:printcenter(10, white, "TestGame")
            verdana12:printcenter(115, white, "TestGame2")
            verdana12:printcenter(200, white, "Press X to continue")
    	verdana12:printcenter(235, white, "Press O to Quit.")
    
    	if pge.controls.pressed(PGE_CTRL_CROSS) then	
                    verdana12:printcenter(60, white, "X pressed")
    	end
    
    	if pge.controls.pressed(PGE_CTRL_CIRCLE) then
                    pge.exit()
    	end
    	pge.gfx.enddrawing()
    	pge.gfx.swapbuffers()
    end
    Geändert von Digikid13 (03-15-2009 um 12:31 PM Uhr)
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  16. #9706
    Points: 1.886, Level: 25
    Level completed: 86%, Points required for next Level: 14
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Mar 2009
    Beiträge
    1
    Points
    1.886
    Level
    25
    Downloads
    0
    Uploads
    0

    Standard

    Hello! newbie here

    Is there a LIBCURL like function for LUA? or any function/snippet that can download a file from http/ftp and save it to the memory stick?

    thanks in advance! ^^

  17. #9707
    QJ Gamer Green
    Points: 9.319, Level: 64
    Level completed: 90%, Points required for next Level: 31
    Overall activity: 99,0%

    Registriert seit
    May 2008
    Ort
    GA, USA
    Beiträge
    243
    Points
    9.319
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    Ok, I have finally decided to post to get some help with my script. I need to get this to work on LPHMv2.


    I need to load "icon.png" from all folder under "resource". My folder structure is:

    App Folder
    /\
    resource
    /\
    folder a | folder b | folder c | etc. etc.

    I need to load "icon.png" from folders a,b,c...

    I am trying to load them with:
    Code:
    icon = {}
    
    function get_icons()
    
    	for i=3,listnum do
    		if System.doesFileExist("resource/" ..list[i].name .."/icon.PNG") == 1 then 
    			icon[i-3] = {img = Image.load("resource/" ..list[i].name .."/icon.PNG")}
    				else error_message = "Error: Get Icons Failed." 
    					System.message("Information: \n" ..error_message .."\nError Message: 001HP \nWe apologize for any inconvenience.","0")
    				error = 1
    				break
    			
    		end
    	end
    
    end
    I keep having it crash when I remove "break" from the function. I have been trying to fix this most of today. I am trying to load all the images before I start my main loop so they will be ready to blit.

  18. #9708
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    I'm not really sure what the problem is, it should work.......
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  19. #9709
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Digikid13 Beitrag anzeigen
    Your right here this is better.
    Code:
    red = Color.new(255,0,0)
    
    while true do
    
      screen.clear()
      pad = Controls.read()
    
      if pad:up() then
        System.usbDiskModeActivate()
      end
    
      if pad:down() then
        System.usbDiskModeDeactivate()
      end
    
      if pad:circle() or pad:triangle() then break end
    
      screen:print(100,110,"Press up to activate USB.",red)
      screen:print(100,120,"Press down to deactivate USB.",red)
      screen:print(100,130,"Press circle or triangle to exit.",red)
    end

    tnx for helping me out!
    So, if I get this right, I'm now able to turn off and on usb, without having to reset the app?
    It has been a while since a worked on thisone, but, it's getting much better!

  20. #9710
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    Yes but I forgot something.

    Code:
    red = Color.new(255,0,0)
    
    while true do
    
      screen.clear()
      pad = Controls.read()
    
      if pad:up() then
        System.usbDiskModeActivate()
      end
    
      if pad:down() then
        System.usbDiskModeDeactivate()
      end
    
      if pad:circle() or pad:triangle() then 
       System.usbDiskModeDeactivate() --<---This
       break
     end
    
      screen:print(100,110,"Press up to activate USB.",red)
      screen:print(100,120,"Press down to deactivate USB.",red)
      screen:print(100,130,"Press circle or triangle to exit.",red)
    end
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  21. #9711
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    tnx again!

    But what do i have to do if i want to implement the drivers in my brew.
    Somebody told me it have to be something like this, but it doesn't work

    This on the first line:
    Code:
    doesLPHMDriversExist = System.doesFileExist("ms0:/seplugins/load.pbp")
    And this after pad = Controls.read()
    Code:
    if doesLPHMDriversExist==0 then System.message("The LPHM Drivers don't seem to be installed, please press Yes to install them now.",1)
    button = System.buttonPressed(1) if button == "yes" then dofile("ms0:/PSP/GAME/Recovery_prx_flasher/drivers/installDrivers2.lua")  end
    load.pbp is in seplugins, but i dont know anymore how it got there, was it installed with the drivers? (I deleted them from flash1 for testing the install function now in my brew)

  22. #9712
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    It might have, I'm going to find out.
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  23. #9713
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    There just has to be a way to use some lua functions, whitout having the drivers installed, because, the drivers are just for some functions as ISO etc, don't they?
    Whatever i try, I keep getting the message "luahmdrivers aren't installed....."
    Maybe it works if I do System.runeboot with an eboot - I made of the script for the drivers - for installing the drivers instead of doing dofile for the script to install?
    EDIT: doesn't work either
    Geändert von Ben93 (04-04-2009 um 03:02 PM Uhr)

  24. #9714
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    What HM version you using?

  25. #9715
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    uuuhm, the drivers are from luaplayer hm8 and I make my eboot with mirolua 2.6

  26. #9716
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Why don't you just use HMv2? The drivers are bulit in & its much faster than HM8

  27. #9717
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    So, you are saying that I don't have to make my eboot with mirolua, but that I have to use my script with the eboot from lua hm v2 so that I don't have to install the drivers?

    It's working now, because i just put whole my script after the script for installing the drivers, and use the same eboot for installing the drivers, wich have to be lua hmv2 if I get things right?

    Sorry, pretty noobish

  28. #9718
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    You don't 'have' to use it, but it comes with everything in the eboot(don't have to install drivers).
    Though, there is slight changes in the API, so you'll need to read it's docs.

  29. #9719
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    tnx, I'll take a look at it. So i have to put my script.lua in the same directory as the eboot?

    Another thing: does an mp3 file have to be in special bitrate or sample? because it won't load...

  30. #9720
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Yeah, same directory. Yeah, i think so. I think HMv2 uses the actually PSP media code(to play music), & some mp3 formats aren't support but these are very few, you'll have to ask someone else about the mp3 as i don't use HMv2.


 

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 .