Seite 212 von 342 ErsteErste ... 112 162 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 262 312 ... LetzteLetzte
Zeige Ergebnis 6.331 bis 6.360 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 myschoo ok coz i needed file check , i didnt know exactly how to do it so i ...

  
  1. #6331
    QJ Gamer Green
    Points: 5.382, Level: 47
    Level completed: 16%, Points required for next Level: 168
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    508
    Points
    5.382
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    ok coz i needed file check , i didnt know exactly how to do it so i just used:

    blah = io.open("file","r")
    if blah then
    boo = 1 else boo = 0
    end

    i tried to use blah:close() but if the file didnt exist, i got error...
    do this:
    if io.open("file", "r") then
    ...do stuff...
    io.close("file")
    else
    ...print("file does not exist")
    end



  2. #6332
    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

    hey that looks good, i will try :)

    edit.
    works great,thx again ;)
    Geändert von myschoo (03-22-2007 um 01:30 PM Uhr)

  3. #6333
    Developer
    Points: 6.074, Level: 50
    Level completed: 62%, Points required for next Level: 76
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    270
    Points
    6.074
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Fuzzie360
    just use:
    Code:
    tests = "\n" .. test1 .. "\n" .. test2
    It will return the variable value instead of the string
    Thanks! but now how do i read them?
    Geändert von ro0kie42 (03-22-2007 um 07:07 PM Uhr)

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

    Zitat Zitat von xpack
    Try downgrading then upgrading back to your firmware. Unless you have a copy of your flash0 before the problem. I had a problem with IRSHELL as well now when I press 'O' when listening to music my psp crashs after doing the restart psp to vsh.


    already tried that...
    -= Double Post =-
    hmm this is really bad...

    i cant try my flashing program since it stoped working...

    it works on other psp's
    Geändert von ai3gtmc (03-23-2007 um 05:36 AM Uhr) Grund: Automerged Doublepost

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

    Use my program FileFlasher to see if it works. If not I recomend a downgrade then an upgrade to see if that fixes the problem

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

    He's having flash issues and your recommending that he formats his Flash0?

    Bad advice. Unless you can diagnose the problem dont be too quick to give out that kind of advice.

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

    Can you at least flash USB mode

  8. #6338
    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

    ai3: post your code here, maybe we can test it or fix something ;)

  9. #6339
    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'll take a look at it if you want also

  10. #6340
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    I made some animation code for character movement and I made some code for when the character is standing still. I don't know how to get it so that when the player is pressing nothing it will display the character standing still. Could someone help?

    I basically want something to set walkflag = true when nothing is being pressed.

    Code:
    dofile("animLib.lua")
    background = Image.load("background2.jpg")
    cleo = Image.load("cleofacedown.png")
    cleowalkdown = ANIM.new(4, "down", "png", "walkdown/")
    cleowalkup = ANIM.new(4, "up", "png", "walkup/")
    cleowalkleft = ANIM.new(4, "left", "png", "walkleft/")
    cleowalkright = ANIM.new(4, "right", "png", "walkright/")
    CleoX = 100
    CleoY = 100
    walkflag = true
    cleodown = true
    
    --WALKING AND CONTROL ANIMATIONS--
    while true do
    pad=Controls.read()
    screen:blit(0,0,background)
    
    	if pad:down() then
    	walkflag = false
    	CleoY = (CleoY + 4)
    	cleowalkdown:blit(CleoX,CleoY,100)
    	cleodown = true
    	cleoup = false
    	cleoright = false
    	cleoleft = false
    	end
    
    	if pad:up() then
    	walkflag = false
    	CleoY = (CleoY - 4)
    	cleowalkup:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = true
    	cleoright = false
    	cleoleft = false
    	end
    
    	if pad:left() then
    	walkflag = false
    	CleoX = (CleoX - 4)
    	cleowalkleft:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = false
    	cleoright = false
    	cleoleft = true
    	end
    
    	if pad:right() then
    	walkflag = false
    	CleoX = (CleoX + 4)
    	cleowalkright:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = false
    	cleoright = true
    	cleoleft = false
    	end
    
    --RESET FACE POSITION--
    if walkflag then
    	if cleodown then
    	cleo = Image.load("cleofacedown.png")
    	screen:blit(CleoX,CleoY,cleo)
    	end
    
    	if cleoleft then
    	cleo = Image.load("cleofaceleft.png")
    	screen:blit(CleoX,CleoY,cleo)
    	end
    
    	if cleoright then
    	cleo = Image.load("cleofaceright.png")
    	screen:blit(CleoX,CleoY,cleo)
    	end
    
    	if cleoup then
    	cleo = Image.load("cleofaceup.png")
    	screen:blit(CleoX,CleoY,cleo)
    	end
    end
    
    screen.flip()
    screen.waitVblankStart()
    end

  11. #6341
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    try this:

    Code:
    if not pad:right() and not pad:left() and not pad:up() and not pad:down() then
         walkflag = true
    end
    one thing, in the "reset face position" section, instead of re-loading images each time you stop after changing direction it would be better to load all four images at the start of your program and put them into a table like this:

    Code:
    cleo = {}
    cleo[1] = Image.load("cleofacedown.png")
    cleo[2] = Image.load("cleofaceleft.png")
    cleo[3] = Image.load("cleofaceright.png")
    cleo[4] = Image.load("cleofaceup.png")
    end
    then, in "reset face position" you could do this:

    Code:
    if walkflag then
    
    	if cleodown then direction = 1 end
    	if cleoleft then direction = 2 end
    	if cleoright then direction = 3	end
    	if cleoup then direction = 4 end
    
    	screen:blit(CleoX,CleoY,cleo[direction])
    end
    Geändert von Merick (03-23-2007 um 01:15 PM Uhr)

  12. #6342
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    PERFECT!

    Thank you SO much.

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

    next time. Use animlib

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

    remember, states dont automatically reset themselves. ;) dont forget to set a state to false, if its not true anymore. and also, you should use else and elseif's a lot more. it gives you many more extra CPU cycles. you whole code can be made much better just by adding elseif's:


    Code:
    dofile("animLib.lua")
    background = Image.load("background2.jpg")
    cleo = Image.load("cleofacedown.png")
    cleowalkdown = ANIM.new(4, "down", "png", "walkdown/")
    cleowalkup = ANIM.new(4, "up", "png", "walkup/")
    cleowalkleft = ANIM.new(4, "left", "png", "walkleft/")
    cleowalkright = ANIM.new(4, "right", "png", "walkright/")
    CleoX = 100
    CleoY = 100
    walkflag = true
    cleodown = true
    
    --WALKING AND CONTROL ANIMATIONS--
    while true do
    pad=Controls.read()
    screen:blit(0,0,background)
    
    	if pad:down() then
    	walkflag = false
    	CleoY = (CleoY + 4)
    	cleowalkdown:blit(CleoX,CleoY,100)
    	cleodown = true
    	cleoup = false
    	cleoright = false
    	cleoleft = false
    	elseif pad:up() then
    	walkflag = false
    	CleoY = (CleoY - 4)
    	cleowalkup:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = true
    	cleoright = false
    	cleoleft = false
    	end
    
    	if pad:left() then
    	walkflag = false
    	CleoX = (CleoX - 4)
    	cleowalkleft:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = false
    	cleoright = false
    	cleoleft = true
    	elseif pad:right() then
    	walkflag = false
    	CleoX = (CleoX + 4)
    	cleowalkright:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = false
    	cleoright = true
    	cleoleft = false
    	end
    
    	if not pad:right() and not pad:left() and not pad:up() and not pad:down() then
    	     walkflag = true
    	end
    	
    --RESET FACE POSITION--
    if walkflag then
    	if cleodown then
    	cleo = Image.load("cleofacedown.png")
    	screen:blit(CleoX,CleoY,cleo)
    	elseif cleoleft then
    	cleo = Image.load("cleofaceleft.png")
    	screen:blit(CleoX,CleoY,cleo)
    	elseif cleoright then
    	cleo = Image.load("cleofaceright.png")
    	screen:blit(CleoX,CleoY,cleo)
    	elseif cleoup then
    	cleo = Image.load("cleofaceup.png")
    	screen:blit(CleoX,CleoY,cleo)
    	end
    end
    
    screen.flip()
    screen.waitVblankStart()
    end
    -= Double Post =-
    Zitat Zitat von eldiablov
    next time. Use animlib
    he is already using it.
    Geändert von Grimfate126 (03-23-2007 um 01:27 PM Uhr) Grund: Automerged Doublepost
    --------------------------------------------------------------------------------------

  15. #6345
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Mmhmm, I see what you mean Grim. Thank you.

    @Merick: Tables you say? I think I'll give it a go. Thanks.

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

    Ok this is really annoying me. Can someone tell me why "w+" mode is not working on luaplayer 0.20?!?! Is there an alternative way to overwrite all existing data in the text file? This is what i wrote, and when i try to write to it i get 'attempt to call file10 - a nil value'

    Code:
    file10 = io.open("data/load.img","w+")

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

  17. #6347
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    I'm getting a type error I don't understand:

    Code:
    if cleodown then
    	if (MobX - 10 >= CleoX >= MobX + 10) and (MobY - 10 >= CleoY >= MobY + 10) then
    		screen:blit(-100,-100,monster)
    	end
    end
    I'm trying to get it so that when you hit the attack button while facing down it will count the attack as taking place if you are pretty much within 10 pixels of the object...

    I get the error "Trying to compare number with boolean" for the second line...but MobX is 150 and MobY is 100 and Cleo X and Y are also numbers...

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

    You must of changed the values of the co-ordinates to a boolean (true/false) somewhere else in the code. Re-check the rest of the code.

  19. #6349
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Here is my entire code and I don't see how CleoX, CleoY, MobX, MobY could be boolean (But I only started coding yesterday).

    Code:
    dofile("animLib.lua")
    monster = Image.load("monster.png")
    background = Image.load("background3.jpg")
    cleowalkdown = ANIM.new(4, "down", "png", "walkdown/")
    cleowalkup = ANIM.new(4, "up", "png", "walkup/")
    cleowalkleft = ANIM.new(4, "left", "png", "walkleft/")
    cleowalkright = ANIM.new(4, "right", "png", "walkright/")
    CleoX = 100
    CleoY = 100
    MobX = 200
    MobY = 150
    walkflag = true
    cleodown = true
    cleo = {}
    cleo[1] = Image.load("cleofacedown.png")
    cleo[2] = Image.load("cleofaceleft.png")
    cleo[3] = Image.load("cleofaceright.png")
    cleo[4] = Image.load("cleofaceup.png")
    cleo[5] = Image.load("cleoattackdown.png")
    cleo[6] = Image.load("cleoattackleft.png")
    cleo[7] = Image.load("cleoattackright.png")
    cleo[8] = Image.load("cleoattackup.png")
    
    --WALKING AND CONTROL ANIMATIONS--
    while true do
    pad=Controls.read()
    screen:blit(0,0,background)
    screen:blit(MobX,MobY,monster)
    
    --Down--
    	if pad:down() and not pad:cross() and not pad:left() and not pad:right() then
    	walkflag = false
    	CleoY = (CleoY + 3)
    	cleowalkdown:blit(CleoX,CleoY,100)
    	cleodown = true
    	cleoup = false
    	cleoright = false
    	cleoleft = false
    	elseif pad:down() and pad:right() and not pad:cross() then
    	walkflag = false
    	CleoY = (CleoY + 2)
    	CleoX = (CleoX + 2)
    	cleowalkdown:blit(CleoX,CleoY,100)
    	cleodown = true
    	cleoup = false
    	cleoright = false
    	cleoleft = false
    	elseif pad:down() and pad:left() and not pad:cross() then
    	walkflag = false
    	CleoY = (CleoY + 2)
    	CleoX = (CleoX - 2)
    	cleowalkdown:blit(CleoX,CleoY,100)
    	cleodown = true
    	cleoup = false
    	cleoright = false
    	cleoleft = false
    	end
    
    --Up--
    
    	if pad:up() and not pad:cross() and not pad:left() and not pad:right() then
    	walkflag = false
    	CleoY = (CleoY - 3)
    	cleowalkup:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = true
    	cleoright = false
    	cleoleft = false
    	elseif pad:up() and pad:right() and not pad:cross() then
    	walkflag = false
    	CleoY = (CleoY - 2)
    	CleoX = (CleoX + 2)
    	cleowalkup:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = true
    	cleoright = false
    	cleoleft = false
    	elseif pad:up() and pad:left() and not pad:cross() then
    	walkflag = false
    	CleoY = (CleoY - 2)
    	CleoX = (CleoX - 2)
    	cleowalkup:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = true
    	cleoright = false
    	cleoleft = false
    	end
    
    --Left--
    
    	if pad:left() and not pad:cross() and not pad:up() and not pad:down() then
    	walkflag = false
    	CleoX = (CleoX - 3)
    	cleowalkleft:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = false
    	cleoright = false
    	cleoleft = true
    	end
    
    --Right--
    
    	if pad:right() and not pad:cross() and not pad:up() and not pad:down() then
    	walkflag = false
    	CleoX = (CleoX + 3)
    	cleowalkright:blit(CleoX,CleoY,100)
    	cleodown = false
    	cleoup = false
    	cleoright = true
    	cleoleft = false
    	end
    
    if not pad:right() and not pad:left() and not pad:up() and not pad:down() and not pad:cross() then
         walkflag = true
    end
    
    --RESET FACE POSITION--
    if walkflag then
    
    	if cleodown then direction = 1 end
    	if cleoleft then direction = 2 end
    	if cleoright then direction = 3 end
    	if cleoup then direction = 4 end
    
    	screen:blit(CleoX,CleoY,cleo[direction])
    end
    
    --ATTACKING--
    if pad:cross() then
    
    	if cleodown then direction = 5 end
    	if cleoleft then direction = 6 end
    	if cleoright then direction = 7 end
    	if cleoup then direction = 8 end
    
    	screen:blit(CleoX,CleoY,cleo[direction])
    
    --ATTACKDAMAGE--
    
    	if (MobX - 10 <= CleoX <= MobX + 10) and (MobY - 10 <= CleoY <= MobY + 10) then
    		MobX = -100
    		MobY = -100
    	end
    
    end
    
    screen.flip()
    screen.waitVblankStart()
    end

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

    Exclamation

    Zitat Zitat von myschoo
    ai3: post your code here, maybe we can test it or fix something ;)

    Code:
    Red = Color.new(255, 0, 0)
    Blue = Color.new(0,0,200)
    
    
    
    function PrintCentered(y,string,color)
    screen:print( 240 - (string.len(string)*8) / 2 ,y,string,color);
    end
    
    
    
    
    Background = Image.load("background1.png")
    
    
    System.Unassign("flash0:" )
    
    
    System.Assign("flash0:", "lflash0:0,0", "flashfat0:")
    
    
    while true do
    
    current = 1
    oldpad = Controls.read()
    
    while true do
    
    pad = Controls.read()
    
    
    screen:blit(0,0,Background)
    PrintCentered(3,"Lua Theme Flasher", Blue)
    PrintCentered(18,"By ai3gtmc", Blue)
    screen:print(137, 96, "=> 01-12.bmp background", Blue)
    screen:print(137, 106, "=> TopMenu_Plugin", Blue)
    screen:print(137, 116, "=> Opening_Plugin", Blue)
    screen:print(137, 126, "=> Gameboot.PMF", Blue)
    screen:print(137, 136, "=> System_Plugin_bg", Blue)
    screen:print(137, 146, "=> System_Plugin_fg", Blue)
    screen:print(137, 156, "=> System_Plugin", Blue)
    screen:print(137, 166, "=> Game_Plugin", Blue)
    screen:print(137, 176, "=> photo_plugin", Blue)
    screen:print(137, 186, "=> impose_plugin", Blue)
    screen:print(137, 196, "=> ltn0.pgf", Blue)
    screen:print(137, 210, "=> Enable USB", Blue)
    screen:print(137, 220, "=> Disable USB",Blue)
    screen:print(137, 240, "=> EXIT", Blue)
    
    
    
    
    if current == 1 then
    screen:print(137, 96, "=> 01-12.bmp background", Red)
    end
    
    if current == 2 then
    screen:print(137, 106, "=> TopMenu_Plugin.rco", Red)
    end
    
    if current == 3 then
    screen:print(137, 116, "=> Opening_Plugin.rco", Red)
    end
    
    if current == 4 then
    screen:print(137, 126, "=> Gameboot.PMF", Red)
    end
    
    
    if current == 5 then
    screen:print(137, 136, "=> System_Plugin_bg.rco", Red)
    end
    
    if current == 6 then
    screen:print(137, 146, "=> System_Plugin_fg.rco", Red)
    end
    
    if current == 7 then
    screen:print(137, 156, "=> System_Plugin.rco", red)
    end
    
    if current == 8 then
    screen:print(137, 166, "=> Game_Plugin.rco", red)
    end
    
    if current == 9 then
    screen:print(137, 176, "=> photo_plugin.rco", red)
    end
    
    if current == 10 then
    screen:print(137, 186, "=> impose_plugin.rco", red)
    end
    
    if current == 11 then
    screen:print(137, 196, "=> ltn0.pgf", red)
    end
    
    if current == 12 then
    screen:print(137,210, "=> Enable USB!", red)
    end
    
    if current == 13 then
    screen:print(137,220, "=> Disable USB!", red)
    end
    
    
    if current == 14 then
    screen:print(137, 240, "=> EXIT", red)
    end
    
    
    
    if pad:up() and oldpad:up() ~= pad:up() then
    current = current-1
    end
    
    if pad:down() and oldpad:down() ~= pad:down() then
    current = current+1
    end
    
    if current == 15 then
    current = 1
    end
    
    if current == 0 then
    current = 14
    end
    
    
    
    if pad:cross() and current == 1 then
    System.writeFile("ms0:/theme/01-12.bmp","flash0:/vsh/resource/01-12.bmp","yes")
    end
    
    if pad:cross() and current == 2 then
    System.writeFile("ms0:/theme/topmenu_plugin.rco","flash0:/vsh/resource/topmenu_plugin.rco","yes")
    end
    
    if pad:cross() and current == 3 then
    System.writeFile("ms0:/theme/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco","yes")
    end
    
    
    if pad:cross() and current == 4 then
    System.writeFile("ms0:/theme/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf","yes")
    end
    
    
    if pad:cross() and current == 5 then
    System.writeFile("ms0:/theme/system_plugin_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco","yes")
    end
    
    if pad:cross() and current == 6 then
    System.writeFile("ms0:/theme/system_plugin_fg.rco","flash0:/vsh/resource/system_plugin_fg.rco","yes")
    end
    
    if pad:cross() and current == 7 then
    System.writeFile("ms0:/theme/system_plugin.rco","flash0:/vsh/resource/system_plugin.rco","yes")
    end
    
    if pad:cross() and current == 8 then
    System.writeFile("ms0:/theme/game_plugin.rco","flash0:/vsh/resource/game_plugin.rco","yes")
    end
    
    if pad:cross() and current == 9 then
    System.writeFile("ms0:/theme/photo_plugin.rco","flash0:/vsh/resource/photo_plugin.rco","yes")
    end
    
    if pad:cross() and current == 10 then
    System.writeFile("ms0:/theme/impose_plugin.rco","flash0:/vsh/resource/impose_plugin.rco","yes")
    end
    
    if pad:cross() and current == 11 then
    System.writeFile("ms0:/theme/ltn0.pgf","flash0:/vsh/font/ltn0.pgf","yes")
    end
    
    if pad:cross() and current == 12 then
    System.usbDiskModeActivate()
    end
    
    if pad:cross() and current == 13 then
    System.usbDiskModeDeactivate()
    end
    
    if pad:cross() and current == 14 then
    System.Quit()
    end
    
    
    
    
    
    ---ScreenShot---
    if pad:select() then
    Image:save("screenshot.png")
    end
    
    
    if pad:start() then
    System.Quit()
    end
    
    
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    
    end
    
    end
    here..

    it works on other psp's

    worked on my psp few days ago...

    I didnt edit anything since it worked....
    but now it wont work...

  21. #6351
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Looks to me like youve got a extra 'end' at the end. I dont know if thats true I just went through it really fast.

  22. #6352
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    If you scroll up you'll see my code...but...I also just noticed something:

    I tried replacing all the variables in that line with numbers so the line makes sense but it keeps giving me the same error anyways...and I've tried with and without brackets.

    Code:
    --ATTACKDAMAGE--
    
    if 140 <= CleoX <= 160 and 190 <= CleoY <= 210 then
    	MobX = -100
    	MobY = -100
    end
    The error is: Attempt to compare boolean with number.

    And the line it is listed under is the blank space between --Attack damage-- and the if statement.

  23. #6353
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    try this:

    Code:
    if MobX - 10 <= CleoX and CleoX <= MobX + 10 and MobY - 10 <= CleoY and CleoY <= MobY + 10 then
    also, you need another "end" at the end of this block

    Code:
    --ATTACKING--
    if pad:cross() then
    
    	if cleodown then direction = 5 end
    	if cleoleft then direction = 6 end
    	if cleoright then direction = 7 end
    	if cleoup then direction = 8 end
    
    	screen:blit(CleoX,CleoY,cleo[direction])

  24. #6354
    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 need help with trying to get Urameshi to show animation when following Ichigo, here's my code:

    Code:
    white=Color.new(255,255,255)
    
    Level=Image.load("./images/backgrounds/forest1.png")
    Sasuke=Image.load("./images/Characters/sasukeleft.png")
    
    ------------Good Guy
    Ichigo=Image.load("./images/New Characters/Ichigoright.png")
    Ichigo1=Image.load("./images/New Characters/Ichigo-left.png")
    IchigorRight=Image.load("./images/New Characters/IchigorunRight.png")
    IchigorLeft=Image.load("./images/New Characters/IchigorunLeft.png")
    IchigobRight=Image.load("./images/New Characters/IchigoblockRight.png")
    IchigobLeft=Image.load("./images/New Characters/IchigoblockLeft.png")
    Ichigodeath=Image.load("./images/New Characters/Ichigodeath.png")
    IchigoPunchr=Image.load("./images/New Characters/IchigofightRight.png")
    IchigoPunchl=Image.load("./images/New Characters/IchigofightLeft.png")
    
    
    ---------------Bad Guy
    Urameshi=Image.load("./images/Urameshi/Urameshi.png")
    Urameshi1=Image.load("./images/Urameshi/Urameshi1.png")
    UrameshirRight=Image.load("./images/Urameshi/UrameshiRRun.png")
    UrameshirLeft=Image.load("./images/Urameshi/UrameshiLRun.png")
    UrameshiPunchr=Image.load("./images/Urameshi/UrameshiPunchRight.png")
    UrameshiPunchl=Image.load("./images/Urameshi/UrameshiPunchLeft.png")
    UrameshiHurtR=Image.load("./images/Urameshi/HurtRight.png")
    UrameshiHurtL=Image.load("./images/Urameshi/HurtLeft.png")
    
    
    
    --Right empty
    r1=Image.createEmpty(66,45)
    r2=Image.createEmpty(66,45)
    r3=Image.createEmpty(66,45)
    
    ur1=Image.createEmpty(48,37)
    ur2=Image.createEmpty(48,37)
    ur3=Image.createEmpty(48,37)
    
    --Left Empty
    l1=Image.createEmpty(66,45)
    l2=Image.createEmpty(66,45)
    l3=Image.createEmpty(66,45)
    
    ul1=Image.createEmpty(48,37)
    ul2=Image.createEmpty(48,37)
    ul3=Image.createEmpty(48,37)
    
    --Left animation
    l1:blit(0,0,IchigorLeft,148,3,66,45)
    l2:blit(0,0,IchigorLeft,70,3,66,45)
    l3:blit(0,0,IchigorLeft,0,4,66,45)
    
    ul1:blit(0,0,UrameshirLeft,114,1,48,37)
    ul2:blit(0,0,UrameshirLeft,59,0,48,37)
    ul3:blit(0,0,UrameshirLeft,0,1,48,37)
    
    --Right Animation
    r1:blit(0,0,IchigorRight,0,3,66,45)
    r2:blit(0,0,IchigorRight,74,3,66,45)
    r3:blit(0,0,IchigorRight,146,3,66,45)
    
    ur1:blit(0,0,UrameshirRight,0,1,48,37)
    ur2:blit(0,0,UrameshirRight,55,1,48,37)
    ur3:blit(0,0,UrameshirRight,115,1,48,37)
    
    r={Ichigo,r1,r2,r3}
    l={Ichigo1,l1,l2,l3}
    ur={Urameshi,ur1,ur2,ur3}
    ul={Urameshi1,ul1,ul2,ul3}
    
    Player={x=0,y=200,w=77,h=54,d=r,f=0,s=2,animt=0,img=Ichigo,oldimg=Ichigo1}
    Sasuke={x=400,y=200,w=32,h=38,img=Sasuke}
    Urameshi={x=400,y=200,w=48,h=37,d=ul,s=1,animt=0,img=Urameshi,oldimg=Urameshi1}
    
    Timer=0
    
    math.randomseed(os.time())
    
    -------------------------------------------------------functions 
    function Level1()
    	while true do
    	screen:clear()
    movePlayer()
    chasePlayer(Urameshi)
    
    if collision(Player,Urameshi) and Player.d == r then
    		Player.img=Ichigodeath
    		Player.s=0
    elseif collision(Player,Sasuke) and Player.d==l then
    		Player.img=Ichigodeath
    		Player.s=0
    end
    
    if Player.img == Ichigodeath then
    Player.x=Player.x
    end
    
    
    screen:blit(0,0,Level)
    screen:blit(Player.x,Player.y,Player.img)
    screen:blit(Urameshi.x,Urameshi.y,Urameshi.oldimg)
    
    	screen.flip()
    	screen.waitVblankStart()
    end
    end
    
    ----------------------------------------------------------------Not Levels
    function pausetillx()
       while true do   --infinite loop used to pause game
           pad = Controls.read()
           if pad:cross() then
    	screen:clear()
              while pad:cross() do
    	screen:clear()
                 pad = Controls.read()  
    	end  
    	break     --breaks loop resuming game
           end
       end
    end
    
    function collision(ob1,ob2) 
         if (ob1.x + ob1.w > ob2.x) and (ob1.x < ob2.x + ob2.w) and (ob1.y + ob1.h > 
    
    ob2.y) and (ob1.y < ob2.y + ob2.h) then 
              return true 
         else 
              return false 
         end 
    end
    function anim(ob)
    	ob.img=ob.oldimg
    	ob.animt = ob.animt + 1
    	if ob.animt > 15 then
    		ob.animt = 1
    	end
    	if ob.animt < 6 then
    		ob.img = ob.d[2]
    	end
    	if ob.animt > 5 then
    		ob.img = ob.d[3]
    	end
    	if ob.animt > 10 then
    		ob.img = ob.d[4]
    
    end
    end		
    
    function chasePlayer(ob)
    stallchase = math.random(2)
    		if ob.x > Player.x then
    		ob.x=ob.x - 2
    		anim(Urameshi)
    else 
    	if ob.x < Player.x then
    	ob.x = ob.x + 2
    	anim(Urameshi)
    	end
    end
    end
    
    function movePlayer()
    pad=Controls.read()
    if pad:right() then 
    		Player.d=r
    		anim(Player)
    		Player.x=Player.x+Player.s
    else
    Player.img=Player.d[1]
    		end		
    	if pad:left() then
    		Player.d=l
    		anim(Player)
    		Player.x=Player.x-Player.s
    		end
    	if pad:cross() then
    		Player.oldimg = Player.img
    		if Player.d == r then Player.img=IchigobRight elseif Player.d == 
    
    l then Player.img = IchigobLeft end
    		Player.s=2
    		defending=true
    		end
    		if defending and not pad:cross() then
    		defending=false Player.img=Player.oldimg
    		Player.s=2
    		end	
    	if pad:square() then
    		Player.oldimg=Player.img
    		if Player.d == r then Player.img=IchigoPunchr else if Player.d == 
    
    l then Player.img=IchigoPunchl end
    		Player.s=2
    		punching=true
    		end
    		if punching and not pad:square() then
    		punching=false Player.img=Player.oldimg
    		Player.s=2
    		end
    end
    end
    
    
    oldpad=Controls.read()
    crouching=false
    defending=false
    punching=false
    alreadycolliding=true 
    numberoftimescollide=3
    death=true
    numberofcollisiontimes=0
    movingstate=0
    
    -----------------------------------------------------------------main loop
    
    while true do	
    screen:clear()
    
    
    Level1()
    	
    	screen.flip()
    	screen.waitVblankStart()
    	oldpad=pad
    end

  25. #6355
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    First of all you have fuctions that you didn't even say what they do from the begining. Like chaseplayer(Urameshi)

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

    Urameshi chases the Player, but it wont animate the chasing so its like he's moving towards Player but he's not technically moving, he's standing

  27. #6357
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Thats not the point, you never said what chaseplayer does you have to have a function like:
    Code:
    function chaseplayer(playername)
    anim(playername)--I just made that up but you get the point.
    end

  28. #6358
    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 already have a chasePlayer function though, do i make another?

  29. #6359
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Merick
    try this:

    Code:
    if MobX - 10 <= CleoX and CleoX <= MobX + 10 and MobY - 10 <= CleoY and CleoY <= MobY + 10 then
    also, you need another "end" at the end of this block

    Code:
    --ATTACKING--
    if pad:cross() then
    
    	if cleodown then direction = 5 end
    	if cleoleft then direction = 6 end
    	if cleoright then direction = 7 end
    	if cleoup then direction = 8 end
    
    	screen:blit(CleoX,CleoY,cleo[direction])
    Works like a charm thank you again for your help. I understand now that I can't check if a variable is between something the traditional way because after the first two steps it'll be either "True" or "False" and True >= 160 makes no sense.

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

    Code:
    red = Color.new(255, 0, 0)
    Blue = Color.new(0,0,200)
    
    function PrintCentered(y,string,color)
    screen:print( 240 - (string.len(string)*8) / 2 ,y,string,color);
    end
    
    Background = Image.load("background1.png")
    
    System.Unassign("flash0:" )
    
    System.Assign("flash0:", "lflash0:0,0", "flashfat0:")
    
    
    current = 1
    oldpad = Controls.read()
    
    while true do
    
    pad = Controls.read()
    
    screen:blit(0,0,Background)
    PrintCentered(3,"Lua Theme Flasher", Blue)
    PrintCentered(18,"By ai3gtmc", Blue)
    screen:print(137, 96, "=> 01-12.bmp background", Blue)
    screen:print(137, 106, "=> TopMenu_Plugin", Blue)
    screen:print(137, 116, "=> Opening_Plugin", Blue)
    screen:print(137, 126, "=> Gameboot.PMF", Blue)
    screen:print(137, 136, "=> System_Plugin_bg", Blue)
    screen:print(137, 146, "=> System_Plugin_fg", Blue)
    screen:print(137, 156, "=> System_Plugin", Blue)
    screen:print(137, 166, "=> Game_Plugin", Blue)
    screen:print(137, 176, "=> photo_plugin", Blue)
    screen:print(137, 186, "=> impose_plugin", Blue)
    screen:print(137, 196, "=> ltn0.pgf", Blue)
    screen:print(137, 210, "=> Enable USB", Blue)
    screen:print(137, 220, "=> Disable USB",Blue)
    screen:print(137, 240, "=> EXIT", Blue)
    
    
    
    
    if current == 1 then
    screen:print(137, 96, "=> 01-12.bmp background", red)
    end
    
    if current == 2 then
    screen:print(137, 106, "=> TopMenu_Plugin.rco", red)
    end
    
    if current == 3 then
    screen:print(137, 116, "=> Opening_Plugin.rco", red)
    end
    
    if current == 4 then
    screen:print(137, 126, "=> Gameboot.PMF", red)
    end
    
    
    if current == 5 then
    screen:print(137, 136, "=> System_Plugin_bg.rco", red)
    end
    
    if current == 6 then
    screen:print(137, 146, "=> System_Plugin_fg.rco", red)
    end
    
    if current == 7 then
    screen:print(137, 156, "=> System_Plugin.rco", red)
    end
    
    if current == 8 then
    screen:print(137, 166, "=> Game_Plugin.rco", red)
    end
    
    if current == 9 then
    screen:print(137, 176, "=> photo_plugin.rco", red)
    end
    
    if current == 10 then
    screen:print(137, 186, "=> impose_plugin.rco", red)
    end
    
    if current == 11 then
    screen:print(137, 196, "=> ltn0.pgf", red)
    end
    
    if current == 12 then
    screen:print(137,210, "=> Enable USB!", red)
    end
    
    if current == 13 then
    screen:print(137,220, "=> Disable USB!", red)
    end
    
    
    if current == 14 then
    screen:print(137, 240, "=> EXIT", red)
    end
    
    
    
    if pad:up() and oldpad:up() ~= pad:up() then
    current = current-1
    end
    
    if pad:down() and oldpad:down() ~= pad:down() then
    current = current+1
    end
    
    if current == 15 then
    current = 1
    end
    
    if current == 0 then
    current = 14
    end
    
    
    
    if pad:cross() and current == 1 then
    System.writeFile("ms0:/theme/01-12.bmp","flash0:/vsh/resource/01-12.bmp","yes")
    end
    
    if pad:cross() and current == 2 then
    System.writeFile("ms0:/theme/topmenu_plugin.rco","flash0:/vsh/resource/topmenu_plugin.rco","yes")
    end
    
    if pad:cross() and current == 3 then
    System.writeFile("ms0:/theme/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco","yes")
    end
    
    
    if pad:cross() and current == 4 then
    System.writeFile("ms0:/theme/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf","yes")
    end
    
    
    if pad:cross() and current == 5 then
    System.writeFile("ms0:/theme/system_plugin_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco","yes")
    end
    
    if pad:cross() and current == 6 then
    System.writeFile("ms0:/theme/system_plugin_fg.rco","flash0:/vsh/resource/system_plugin_fg.rco","yes")
    end
    
    if pad:cross() and current == 7 then
    System.writeFile("ms0:/theme/system_plugin.rco","flash0:/vsh/resource/system_plugin.rco","yes")
    end
    
    if pad:cross() and current == 8 then
    System.writeFile("ms0:/theme/game_plugin.rco","flash0:/vsh/resource/game_plugin.rco","yes")
    end
    
    if pad:cross() and current == 9 then
    System.writeFile("ms0:/theme/photo_plugin.rco","flash0:/vsh/resource/photo_plugin.rco","yes")
    end
    
    if pad:cross() and current == 10 then
    System.writeFile("ms0:/theme/impose_plugin.rco","flash0:/vsh/resource/impose_plugin.rco","yes")
    end
    
    if pad:cross() and current == 11 then
    System.writeFile("ms0:/theme/ltn0.pgf","flash0:/font/ltn0.pgf","yes")
    end
    
    if pad:cross() and current == 12 then
    System.usbDiskModeActivate()
    end
    
    if pad:cross() and current == 13 then
    System.usbDiskModeDeactivate()
    end
    
    if pad:cross() and current == 14 then
    System.Quit()
    end
    
    
    ---ScreenShot---
    if pad:select() then
    Image:save("screenshot.png")
    end
    
    if pad:start() then
    System.Quit()
    end
    
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    
    end
    this works for me, repaired some errors... try it


 

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

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