Seite 240 von 342 ErsteErste ... 140 190 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 290 340 ... LetzteLetzte
Zeige Ergebnis 7.171 bis 7.200 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; Obsessive Compulsive Disorder. Like a guy who has to snap his fingers 5 times before opening a door or washing ...

  
  1. #7171
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Obsessive Compulsive Disorder. Like a guy who has to snap his fingers 5 times before opening a door or washing his hands every 5.2 minutes on the dot. That kind of thing.



  2. #7172
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    I'm OCD. More on the line of washing my hands than the snapping my fingers...

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

    i'm just stoopid

  4. #7174
    QJ Gamer Blue
    Points: 3.768, Level: 38
    Level completed: 79%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    70
    Points
    3.768
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    hii there. i have got somthing strange 2 time by now.... i mean.. i was making some code. testing then turnoff psp, and when i back, the code no longer works.... wy ?... luaplayer corrupt files when turn off playing ?.... how to correct my damaged codes?..

  5. #7175
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    i dont think there is a way to fix "currupted files" you could try deleting them then replacing them. i had a simular problem like this but once i did that it all worked

  6. #7176
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    u mean everytime we turn off while using it then it corupts?..

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

    i think it can corrupt if u have usb enabled or something like that

  8. #7178
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    yeah if you using a certain file at the time and you overwrite it then the file become currupt and windows will not let you delete it so you have to delete it with something like IRSHELL

  9. #7179
    QJ Gamer Blue
    Points: 3.768, Level: 38
    Level completed: 79%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    70
    Points
    3.768
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    well i can see the content of the files, my images are visible.. jsut causes he wont, my code crash and reset the psp. but i turned it off working... and i wass on street so no usb...

  10. #7180
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    how can i make my screenshots in different names eg screenshot1,screenshot2,a nd so on..

    and also how browse a file then copy it to another location when pressed?

  11. #7181
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ai3gtmc
    how can i make my screenshots in different names eg screenshot1,screenshot2,a nd so on..

    and also how browse a file then copy it to another location when pressed?
    For the screenshot thing yeah you can heres a code from soulkiller

    Code:
    SUBMITTED BY: Soulkiller 
    oldpad = Controls.read()
    while true do
    pad=Controls.read()
    if pad:select() and pad:select() ~= oldpad:select() then screenshot("ms0:/PSP/PHOTO")
    end
    oldpad = pad
    end
    
    Code:               
    function screenshot(folder)
    local directory = {}
    local counter = 1
    for index, file in System.listDirectory(folder) do
            directory[counter] = file.name
            counter = counter+1
    end
    local max = 0
    for length = 1,table.getn(directory) do
            for length2 = 1,table.getn(directory) do
                    if directory[length2] == "screenshot"..length..".png" then
                            max = length
                    end
            end
    end
    max = max+1
    screen:save(folder.."screenshot"..max..".png")
    end
    And the filebrowser just use something like this that tactical penguin made up but edit it so that is moves the file to where you want. Try using SG57's Luaplayer mod w/ flash but instead dont flash it to flash0:/ but to wherever it is you want it to.

    Code:
    System.currentDirectory("ms0:/")
    white = Color.new(255,255,255)
    red = Color.new(255,0,0)
    fbrowser = {s = 1, fl = System.listDirectory("ms0:/"),ls = 1, sp = 10}
    
    fbrowser.nf = table.getn(fbrowser.fl)
    oldpad = Controls.read()
    
    function runfbrowser()
    
    	for i = ((fbrowser.ls-1)*fbrowser.sp)+1, fbrowser.ls*fbrowser.sp do
    
    		if fbrowser.nf >= i then
    
    			screen:print(0,((i-((fbrowser.ls-1)*fbrowser.sp))*10)-10,fbrowser.fl[i].name,white)
    
    		elseif fbrowser.nf < i then break end
    
    	end
    
    	
    
    	screen:print(0,((fbrowser.s-((fbrowser.ls-1)*fbrowser.sp))*10)-10,fbrowser.fl[fbrowser.s].name,red)
    
    
    	if pad:down() and not oldpad:down() then fbrowser.s = fbrowser.s + 1 end
    
    	if pad:up() and not oldpad:up() then fbrowser.s = fbrowser.s - 1 end
    
    
    
    	if fbrowser.s > fbrowser.nf then fbrowser.s = fbrowser.nf elseif fbrowser.s < 1 then fbrowser.s = 1 end
    
    
    
    	if fbrowser.s > fbrowser.sp*fbrowser.ls then fbrowser.ls = fbrowser.ls + 1
    
    	elseif fbrowser.s < ((fbrowser.ls-1) * fbrowser.sp)+1 then fbrowser.ls = fbrowser.ls - 1 fbrowser.s = (fbrowser.ls)*fbrowser.sp end
    
    	if pad:cross() and not oldpad:cross() then
    
    		if not fbrowser.fl[fbrowser.s].directory then
    
    			if string.lower(string.sub(fbrowser.fl[fbrowser.s].name, -4)) == (".png" or ".jpg") then
    
    				img = Image.load(fbrowser.fl[fbrowser.s].name)
    
    				screen:clear()
    
    				screen:blit(240-img:width()/2,136-img:height()/2,img)
    
    				screen.flip()
    
    				viewingimg = true
    
    				while viewingimg do
    
    					if Controls.read():circle() then viewingimg = false img = nil end
    
    					screen.waitVblankStart()
    
    				end
    
    			end
    
    		elseif fbrowser.fl[fbrowser.s].directory then
    
    			System.currentDirectory(fbrowser.fl[fbrowser.s].name)
    
    			fbrowser.s = 1
    
    			fbrowser.fl=System.listDirectory()
    
    			fbrowser.nf=table.getn(fbrowser.fl)
    			fbrowser.ls = 1
    
    		end
    
    	elseif pad:triangle() and not oldpad:triangle() then
    
    		if System.currentDirectory ~= "ms0:/" then
    
    			System.currentDirectory("./..")
    
    			fbrowser.s = 1
    
    			fbrowser.fl=System.listDirectory()
    
    			fbrowser.nf=table.getn(fbrowser.fl)
    			fbrowser.ls = 1
    
    		end
    
    	end
    
    end
    
    while true do
    	pad = Controls.read()
    	screen:clear()
    	runfbrowser()
    	screen.waitVblankStart()
    	screen.flip()
    	oldpad = pad
    	if pad:start() then break end
    end

  12. #7182
    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

    ai -
    Code:
    g_Screenshot = 0
    
    oldpad = Controls.read()
    
    while true do
         pad = Controls.read()
    
         if pad:select() and pad ~= oldpad then
              g_Screenshot = g_Screenshot + 1
              screen:save( "ms0:/PSP/PHOTO/yourGame/screenshot" .. g_Screenshot .. ".png" )
         end
    
         oladpad = pad
    end
    Whether or not the screen shot function is screen:save is beyond me, so go find it. Also, this will overwrite old screenshots if you restart the app, as g_Screenshot = 0 again. You could use the method above me to get the last screenshot number and assign it to g_Screenshot.

    As for your other question, NO! I will not write a file browser for you and have it copy whatever file pressed to another place. You are so specific I can already tell you're creating a flashing app... You know no one will do what you ask, at least want to... , if they can determine what you're making completely... xpack shouldnt have given you it either, but still...

    I advise you to read up on the System.listCurrentDirecto ry function (i believe thats what it's called) and learn to do it yourself to take all the credit...

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


  13. #7183
    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 guys. Ok i have collision code but when they collide it just restarts. I want it so that it destroys the object. Removes it from the screen. Can someone tell me how to do this.

    Thanks Bob Hoil

  14. #7184
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Post your code so that we can see whats wrong with it

  15. #7185
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    ok thx guys:)

    Sg57: yeah i did.. its already released.. but my psp's LCD is broken for 1month or so... so i forgot a lil about LUA..

    that's why im remaking it:) lol

    another question:
    if i flash a file but the file im trying to flash is not there, how can i make a warning that the file is not there? so i wont get error

  16. #7186
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ai3gtmc
    ok thx guys:)

    Sg57: yeah i did.. its already released.. but my psp's LCD is broken for 1month or so... so i forgot a lil about LUA..

    that's why im remaking it:) lol
    Huh mine too :Argh:

  17. #7187
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    so how do i do it xpack?

  18. #7188
    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

    blah = io.open(filetocheck,"r")
    if blah then
    fileexists = true
    blah:close()
    end

  19. #7189
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    i think its something like

    Code:
    if "ms0:/PSP/GAME/Whatever/whatever.rco" then
    -- your code here
    else
    screen:print(10,10,"File Not Found",color)
    end
    at least i think thats how it works (this was just off the top of my head)...

    Oh or try tp's way that sound like it might work, i was typing when it was posted

  20. #7190
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    ok thx to you guys:) ill try it later.. im at school >.< lol

  21. #7191
    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

    Code:
    background=Image.load("images/menu.png")
    fb=Image.load("images/fb.png")
    fbclicked=Image.load("images/fbclicked.png")
    apps=Image.load("images/apps.png")
    appsclicked=Image.load("images/appsclicked.png")
    wb=Image.load("images/wb.png")
    wbclicked=Image.load("images/wbclicked.png")
    games=Image.load("images/games.png")
    gamesclicked=Image.load("images/gamesclicked.png")
    mp=Image.load("images/mp.png")
    mpclicked=Image.load("images/mpclicked.png")
    white=Color.new(255,250,250)
    cursor = Image.load("images/cursor.png")
    
    sensitivity = 40
    maxspeed = 3
    
    cursor = {x = 30, y = 100, w = 32, h = 32, oldx = 200, oldy = 50, img = Image.load("images/cursor.png"), s = 4}
    
    buttonimg = Image.load("images/fb.png")
    button={}
    button[1] = {x = 21, y = 234, h = buttonimg:height(), w = buttonimg:width()}
    
    function moveCursor()
    pad=Controls.read()
    if pad:analogX() < -sensitivity or pad:analogX() > sensitivity then
         cursor.x = cursor.x + pad:analogX()/(128/maxspeed)
    end
    if pad:analogY() < -sensitivity or pad:analogY() > sensitivity then
         cursor.y = cursor.y + pad:analogY()/(128/maxspeed)
    end
    end
    
    function clock()
    time = os.time()
    timestring = os.date("%c",time)
    timeinfo = os.date("*t", time)
    hour = timeinfo.hour
    if hour > 11 then ampm = "PM"
    elseif hour < 12 then ampm = "AM"
    end
    min = timeinfo.min
    if min < 10 then
    min = "0" .. min
    end
    hour = timeinfo.hour
    if hour > 12 then
    hour = hour - 12
    end
    screen:print(325, 26,hour..":" ..min .. " "..ampm, white)
    end
    
    function collision(cursor,button1)
    	return (cursor.x + cursor.w > button[1].x) and (cursor.x < button[1].x + button[1].w) and (cursor.y + cursor.h > button[1].y) and (cursor.y < button[1].y + button[1].h)
    end
    
    function button()
    if pad:cross() and collision(cursor,button1) then 
    dofile("fb.lua")
    end
    end
    
    function screenPrint()
    screen:blit(0,0,background)
    screen:blit(21,234,fb)
    screen:blit(113,234,mp)
    screen:blit(210,234,apps)
    screen:blit(305,234,games)
    screen:blit(399,234,wb)
    screen:blit(cursor.x,cursor.y,cursor.img)
    screen:print(424,26, System.powerGetBatteryLifePercent(),white)
    end
    
    while true do
    screen:clear()
    
    collision(cursor,button1)
    
    moveCursor()
    
    button()
    
    screenPrint()
    
    clock()
    
    screen.waitVblankStart()
    screen.flip()
    end
    Hey guys i am having some problems with my code. On startup i encounter the following error that i cannot figure out how to fix: Error: main.lua:54: attempt to index global 'button' (a function value)

    It is probably something stupid that i just overlooked but thanks for any help anyone gives.

  22. #7192
    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

    You made button a table and then made it a function. Need to change the names.

  23. #7193
    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 i knew it was something stupid i just noticed that.

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

    Is there a way to check a line of text for a specific phrase, and replace it? or a way without replacing? for example:
    i load a text file, and read a line off it, and if i see the word "lol" in that line, then replace it with the word omg
    just an example^^

  25. #7195
    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

    Awesome it works!!! Thanks a lot to everyone. Now i just need to make the other screens.

  26. #7196
    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

    your welcome dude

  27. #7197
    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 ma having problems with returning to the previous screen. Is there a way to load the last file info out of ram then use that to load the file?

  28. #7198
    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

    can anyone help with my problem above? also, i searched on google and found a few functions like
    string.find, string.sub, and string.gsub... what do these do? thanks for any help

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

    Zitat Zitat von gmansexfo
    can anyone help with my problem above? also, i searched on google and found a few functions like
    string.find, string.sub, and string.gsub... what do these do? thanks for any help
    Doesnt anyone go to lua.org anymore?

    http://www.lua.org/manual/5.1/manual.html#5.4

  30. #7200
    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

    Yeah, people do. Stupid question on your part...

    Bob Hoil - What? Load the last info out of ram and use it to load the file... wtf... Try syllables and sentences and you may get your answer ;)

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



 

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 .