Seite 135 von 342 ErsteErste ... 35 85 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 185 235 ... LetzteLetzte
Zeige Ergebnis 4.021 bis 4.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; Zitat von Grimfate126 i would try animation lib 3. but, you need a better understaanding of lua first.. I can ...

  
  1. #4021
    QJ Gamer Gold
    Points: 16.445, Level: 82
    Level completed: 19%, Points required for next Level: 405
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Ridin' With Urza
    Beiträge
    1.950
    Points
    16.445
    Level
    82
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    i would try animation lib 3. but, you need a better understaanding of lua first..
    I can personally vouch for ANIM Lib 3. It's a godsend because you don't can't load GIF's.

    It's not at all hard to use, if all else fails, just overwrite Grimfate's test pictures and edit the number of frames in the Anilib.lua file.
    -= Double Post =-
    How can I keep the text from running of the side of the screen?

    Also, I've been testing my code on Windows LUA Player, and now I want to try it on the PSP, but I have no clue as to how to incorporate ANIM Lib3 into it. Anyone want to help?


    Geändert von KKlicK (11-10-2006 um 03:02 PM Uhr) Grund: Automerged Doublepost
    http://klick.ws/images/phil.png
    Most baddest mother****er alive.

  2. #4022
    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 Alyssa
    I can personally vouch for ANIM Lib 3. It's a godsend because you don't can't load GIF's.

    It's not at all hard to use, if all else fails, just overwrite Grimfate's test pictures and edit the number of frames in the Anilib.lua file.
    -= Double Post =-
    How can I keep the text from running of the side of the screen?

    Also, I've been testing my code on Windows LUA Player, and now I want to try it on the PSP, but I have no clue as to how to incorporate ANIM Lib3 into it. Anyone want to help?
    ANIM lib work fine for both windows lua and PSP. you shouldnt have to change anything.. just run it as usual and it should work fine.

    if you have any problems, PM me.
    --------------------------------------------------------------------------------------

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

    Grimfate - Stop doubling your work. Get back to what you announced! ;)

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


  4. #4024
    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 SG57
    Grimfate - Stop doubling your work. Get back to what you announced! ;)

    umm, last time i checked, i could do whatever i want. i dont need a 9th grader bossing me around. (NO, assault is not dead. i have a little.. surprise for you all. but ill show you later.)
    --------------------------------------------------------------------------------------

  5. #4025
    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

    Unhappy

    yes, i'm back into lua programming! :)

    ok, here is my question, i am making a pong like game, yet there are four sides in play. I need to get my collisions correct so that when the ball bounces off any of the four bars it will change course. Here is my code, what is wrong with it?

    Code:
    function collision()
    	collide = "false"
    	if ballspot.x == 15 then
    		for a = (barl.y), 50 do
    			if ballspot.y == a then
    				slope.x = slope.x * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()
    		end
    	end
    	if ballspot.x == 465 then
    		for a = (barr.y), 50 do
    			if ballspot.y == a then
    				slope.x = slope.x * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()
    		end
    	end
    	if ballspot.y == 257 then
    		for a = (bard.x), 50 do
    			if ballspot.x == a then
    				slope.y = slope.y * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()
    		end
    	end
    	if ballspot.y == 15 then
    		for a = (baru.x), 50 do
    			if ballspot.x == a then
    				slope.y = slope.y * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()   --you missed the ball
    		end
    	end
    end
    here barl is the left bar
    barr is right, baru is upper, and bard is the lower bar.
    The images for the bars are (10x50) and (50x10)

    they are each located 5 pixels from the outer edge.
    -= Double Post =-
    also, if anyone wants to help me but doesn't understand all that, you can pm me and i will give you my entire code to look at. I trust nobody will steal it because the game is too simple, yet i think will be somewhat fun at the end...
    -= Double Post =-
    grrrr. sorry, i just don't really like the double post merge thing. i guess it helps the site, but still. anyway though, some1 please help
    Geändert von emericaska8r (11-10-2006 um 06:55 PM Uhr) Grund: Automerged Doublepost

  6. #4026
    QJ Gamer Platinum
    Points: 57.528, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    h0000000rj
    Beiträge
    12.867
    Points
    57.528
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Access_Denied
    Well, I thought he had enough experience. After all, he made Text2Phone and fBrowser.
    re: Text2Phone - the original program was written by someone named cools. According to the comments from the version of netlib that the Text2phone program uses, the actual netcall and sms stuff was written by PsPmad and youresam:
    netlib v2.0
    Copyright 2006 by youresam
    Also thanks to PsPmad for help with netcall and netsms!
    re: fBrowser
    This is a file browser script made by fchaos and yoyomacy.
    Guessing he made the images
    [I fail @ life]

  7. #4027
    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 when i run this script i get and error saying attempt to perform arithmetic on global 'player' ( a table value). This is near the start of the main loop where i say player.x = 48 and player.y = 186 . The error is on line 383 and the script is in the attachment
    Angehängte Dateien Angehängte Dateien

  8. #4028
    QJ Gamer Green
    Points: 12.085, Level: 72
    Level completed: 9%, Points required for next Level: 365
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    a
    Beiträge
    545
    Points
    12.085
    Level
    72
    Downloads
    0
    Uploads
    0

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

    why dont you try modifing this for your own use
    http://evilmana.com/tutorials/codebase/name_entry.php
    -= Double Post =-
    now back on to my problem

    -=Edit=-

    Sorry i meant this site http://evilmana.com/tutorials/codeba...rd_program.php
    Geändert von mark.sparky (11-11-2006 um 07:16 AM Uhr) Grund: Automerged Doublepost

  10. #4030
    QJ Gamer Green
    Points: 12.085, Level: 72
    Level completed: 9%, Points required for next Level: 365
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    a
    Beiträge
    545
    Points
    12.085
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    I'd prefer to start from the base up any help?

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

    Any answers to my problem (post #4027)

  12. #4032
    QJ Gamer Silver
    Points: 6.087, Level: 50
    Level completed: 69%, Points required for next Level: 63
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    script.lua
    Beiträge
    426
    Points
    6.087
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Lua is perty!

  13. #4033
    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

    what?

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

    Zitat Zitat von XteticX
    Lua is perty!
    spam if i ever did see it:ROFL:

  15. #4035
    No longer a community member.
    Points: 25.679, Level: 96
    Level completed: 33%, Points required for next Level: 671
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    2
    Points
    25.679
    Level
    96
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    spam if i ever did see it:ROFL:
    A reply to spam is just as bad as spamming itself. (Then why am I replying to a reply that replied to spam...?)

  16. #4036
    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

    And i'm going to reply to your reply about my reply about XteticX's comment by singing "We love you southend we do !" But seriously i think you're an excellent dev so could you tell me whats wrong? I want my player to start at the bottom of the screen but he starts halfway on the screen. Here is my code :


    blue = Color.new(0, 0, 255)
    green=Color.new(0,255,0)
    white = Color.new(255,255,255)
    health = Image.load("images/Healthplayer1-1.png")
    background = Image.load("images/background.png")
    Player = Image.load("images/stick1.png")
    Sprites = {}
    Sprites[1] = Image.load("images/stick4.png")
    Sprites[2] = Image.load("images/stick3.png")
    Sprites[3] = Image.load("images/stick2.png")
    Sprites[4] = Image.load("images/stick1.png")
    Sprites[5] = Image.load("images/stick5.png")
    Sprites[6] = Image.load("images/stick6.png")
    Player = {}
    Player.x = 7
    Player.y = 230
    Player.health = 100
    Player.gravity = 185
    Player.jumpspeed = 10
    Player.jumpstate = "ground"
    currentsprite = 4
    while true do
    pad = Controls.read()
    screen:clear()
    screen:blit(0, 0, background)
    screen:blit(8, 18, health)
    screenrint(15, 7, "1P Health", blue)
    screen:blit(Player.x,Play er.y,Sprites[currentsprite])
    -- Controls

    if pad:right() and Player.x < 455 then
    currentsprite = 4
    Player.x = Player.x + 2
    end
    if pad:left() and Player.x > 7 then
    currentsprite = 2
    Player.x = Player.x - 2
    end
    if pad:up() and Player.y > 6 and Player.jumpstate == "ground" then Player.jumpstate = "jumping" and
    currentsprite = 1
    Player.y = Player.y - 2
    end
    if pad:down() and Player.y < 235 then
    currentsprite = 3
    Player.y = Player.y + 2
    end
    if pad:cross() then
    currentsprite = 5
    end
    if pad:circle() and Player.jumpstate == "ground" then Player.jumpstate = "jumping" end
    if pad:down() and pad:cross() and Player.y > 6 then
    currentsprite = 6
    end
    if pad:start() then
    os.exit()
    end

    -- Gravity function

    if Player.jumpstate == "jumping" then
    Player.jumpspeed = Player.jumpspeed - 0.5
    Player.gravity = Player.gravity - Player.jumpspeed
    end

    if Player.gravity < 0 then
    Player.jumpstate = "falling"
    end

    if Player.gravity < 230 and Player.jumpstate == "falling" then
    Player.gravity = Player.gravity + (Player.jumpspeed + 3)
    end

    if Player.gravity == 230 then
    Player.jumpspeed = 10
    Player.jumpstate = "ground"
    end

    if Player.gravity > 230 then Player.gravity = 230 end

    Player.y = Player.gravity

    screen.waitVblankStart()
    screen.flip()
    end

  17. #4037
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    sry eldiablov but i cant really figure out the answer to ur q. But i have a question myself. Im making a maze game and I have a path my dude walks down and enemies patroling the path moving back and forth in the same direction. but im having a problem here. i figured out how to move my enemies back and forth and it involves using a variable and adding to it and they move and its really complicated it worked yes but im wondering if there is a easier way to make a enemy patrol and path. i saw on evilmana they could make an enemy move in a circle but not in a straight line help plz.
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

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

    Completely off the hip.
    Code:
    Direction = { x = 0, y = 0 }
    Position = { x = 0, y = 0 }
    
    Direction.x = 1
    Position.x = 10
    Position.y = 10
    
    Speed = 3
    
    while true do
    	if Position.x < 10 then
    		Direction.x = 1
    	end
    	
    	if Position.x > 200 then
    		Direction.x = -1
    	end
    	
    	Position.x = Position.x + ( Speed * Direction.x )
    	Position.y = Position.y + ( Speed * Direction.y )
    
    end
    Not brilliant but it works.

  19. #4039
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    ^^^ thats the patrolling code?
    EDIT: yah it is lol ok thanks.
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

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

    Is there a way to display the psp's current time and then use that so that if it is a certain time then the screen will be using a dark map and if it is before the time then it will use the light map

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

    Why would you want to display the current time when you can just press the home button?

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

    because i am making a game and i want it so that when it is say 6 o'clock then a dark map will be displayed but before 6 o'clock a light map will be displayed.

  23. #4043
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    I dont know. I think you would need to access the flash though because of the time.
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  24. #4044
    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 what about when you use random numbers you use os.time() which is where you use the current tmie to determine random numbers

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

    ok, here is my question, i am making a pong like game, yet there are four sides in play. I need to get my collisions correct so that when the ball bounces off any of the four bars it will change course. Here is my code, what is wrong with it?


    Code:
    function collision()
    	collide = "false"
    	if ballspot.x == 15 then
    		for a = (barl.y), 50 do
    			if ballspot.y == a then
    				slope.x = slope.x * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()
    		end
    	end
    	if ballspot.x == 465 then
    		for a = (barr.y), 50 do
    			if ballspot.y == a then
    				slope.x = slope.x * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()
    		end
    	end
    	if ballspot.y == 257 then
    		for a = (bard.x), 50 do
    			if ballspot.x == a then
    				slope.y = slope.y * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()
    		end
    	end
    	if ballspot.y == 15 then
    		for a = (baru.x), 50 do
    			if ballspot.x == a then
    				slope.y = slope.y * -1
    				collide = "true"
    			end
    		end
    		if collide == "false" then
    			gameover()   --you missed the ball
    		end
    	end
    end
    here barl is the left bar
    barr is right, baru is upper, and bard is the lower bar.
    The images for the bars are (10x50) and (50x10)

    they are each located 5 pixels from the outer edge.

    also, if anyone wants to help me but doesn't understand all that, you can pm me and i will give you my entire code to look at. I trust nobody will steal it because the game is too simple, yet i think will be somewhat fun at the end...
    -= Double Post =-
    ok nm guys, i worked it out. the problem was that when I had the for loop run, it would go from the bar's x value to 50, when i wanted it to go from the bar's x value to that number + 50.

    i also fixed some other minor things to make the highscore work and so-on. Now the game will completely work :Jump:
    Geändert von emericaska8r (11-11-2006 um 05:52 PM Uhr) Grund: Automerged Doublepost

  26. #4046
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    is this patrolling code valid? im basing it off head 54us's idea. But im not sure if it will work but it looks valid to me
    if enemy[1].x > 20 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x > 25 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x > 29 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x == 30 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x < 40 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x > 12 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x == 30 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x < 40 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x > 12 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x < 40 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x > 12 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x < 40 then
    enemy[1].y = enemy[1].y + 3
    if enemy[1].x > 12 then
    enemy[1].y = enemy[1].y + 3
    end
    also to make my enemy move backwords i use exactly the same code but subtract from the y coordinate instead. do u guys think this will work?
    EDIT: wow ok i lost track of myself. what are the x and y coordinates on the psp i know what they are but are they like backwords on the psp or something because on a real graph 0,0 is on the bottom left but on the psp 0,0 is on the top left corner. is x the width and y the height ? someone help im confused
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  27. #4047
    .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

    Zitat Zitat von GuitarGod1134
    I dont know. I think you would need to access the flash though because of the time.
    Na, you use os:time()

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

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

    On the PSP, x is width and y is height. I have no experience in patrolling or whatever, so i can't answer your other question.

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

    its not just on the PSP, thats the same on a graph (co-ords) & in matrices its the same, but you use 2 x 4 or whatever (however it means x x y)
    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

  30. #4050
    QJ Gamer Green
    Points: 12.085, Level: 72
    Level completed: 9%, Points required for next Level: 365
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    a
    Beiträge
    545
    Points
    12.085
    Level
    72
    Downloads
    0
    Uploads
    0

    Question

    I am trying to make a five DIGIT password application that you can boot on startup:

    http://forums.qj.net/f-psp-developme...ion-77884.html

    I have finished the main part of the code which was edited from an example program:

    http://evilmana.com/tutorials/codeba...rd_program.php

    Spoiler for the edited code:
    System.usbDiskModeActivat e()

    white = Color.new(255, 255, 255)
    black = Color.new(0, 0, 0)
    blue = Color.new(0, 0, 255)

    p1file = io.open("p1.txt", "r")
    p1f = p1file:read("*n")
    p1file:close()

    p2file = io.open("p2.txt", "r")
    p2f = p2file:read("*n")
    p2file:close()

    p3file = io.open("p3.txt", "r")
    p3f = p3file:read("*n")
    p3file:close()

    p4file = io.open("p4.txt", "r")
    p4f = p4file:read("*n")
    p4file:close()

    p5file = io.open("p5.txt", "r")
    p5f = p5file:read("*n")
    p5file:close()

    screen:clear(black)

    p1 = 1
    p2 = 2
    p3 = 3
    p4 = 4
    p5 = 5
    current = 1

    function Something()
    while true do
    os.exit()
    end
    end

    oldpad = Controls.read()
    while true do
    pad = Controls.read()
    screenrint(164, 89, "Enter your password", white)
    screenrint(194, 109, "p1", white)
    screenrint(214, 109, "p2", white)
    screenrint(234, 109, "p3", white)
    screenrint(254, 109, "p4", white)
    screenrint(274, 109, "p5", white)
    if current == 1 then
    screenrint(194, 109, "p1", blue)
    end
    if current == 2 then
    screenrint(214, 109, "p2", blue)
    end
    if current == 3 then
    screenrint(234, 109, "p3", blue)
    end
    if current == 4 then
    screenrint(254, 109, "p4", blue)
    end
    if current == 5 then
    screenrint(274, 109, "p5", blue)
    end

    if pad:right() and oldpad:right() ~= pad:right() and current < 5 then
    current = current + 1
    end
    if pad:left() and oldpad:left() ~= pad:left() and current > 1 then
    current = current - 1
    end
    if pad:up() and oldpad:up() ~= pad:up() and current == 1 and p1 < 9 then
    p1 = p1 + 1
    end
    if pad:up() and oldpad:up() ~= pad:up() and current == 2 and p2 < 9 then
    p2 = p2 + 1
    end
    if pad:up() and oldpad:up() ~= pad:up() and current == 3 and p3 < 9 then
    p3 = p3 + 1
    end
    if pad:up() and oldpad:up() ~= pad:up() and current == 4 and p4 < 9 then
    p4 = p4 + 1
    end
    if pad:up() and oldpad:up() ~= pad:up() and current == 5 and p5 < 9 then
    p5 = p5 + 1
    end
    if pad:down() and oldpad:down() ~= pad:down() and current == 1 and p1 > 0 then
    p1 = p1 - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() and current == 2 and p2 > 0 then
    p2 = p2 - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() and current == 3 and p3 > 0 then
    p3 = p3 - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() and current == 4 and p4 > 0 then
    p4 = p4 - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() and current == 5 and p5 > 0 then
    p5 = p5 - 1
    end
    if "p1" == "p1f" and "p2" == "p2f" and "p3" == "p3f" and "p4" == "p4f" and "p5" == "p5f" then
    Something()
    end
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end


    This attempts to read the numbers from five text files. These numbers are then put into a variable, which is then referenced when the password is input. When the password is input correctly the application exits to the XMB.

    At the moment, the app loadsup fine and displays the input screen:

    Enter your password
    p1 p2 p3 p4 p5

    You can scroll over each "part" (p1, p2, p3, p4, p5) but when you attempt to change the digit by using up or down on the d-pad, the "part" stays the same, not allowing the exit unless you use HOME; which brings me onto another question. What is the code snippet which disables the use of the HOME button, so no exit from this app is allowed unless you input the password.


 

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 .