Results 1 to 9 of 9

Thread: Lua Help

  
  1. #1
    splodger15 is offline -Hacks Newbie
    Join Date
    Aug 2006
    Posts
    39
    Rep Power
    14

    Default

    What i am having trouble is i want images to display one after another when x is pressed how would i do this

    Thanks

    Join my PSP site here: http://splodger15.forum5.com/

  2. #2
    ST@TIC is offline -Hacks Newbie
    Join Date
    Nov 2006
    Location
    South Africa
    Posts
    39
    Rep Power
    14

    Default

    ok first you have to declare your pics
    pic = {}
    pic[1] = Image.load("1.jpg")
    pic[2] = Image.load("2.jpg")
    pic[3] = Image.load("3.jpg")
    and so on..

    then your count
    cnt = 1 -- from 1 so it doesnt give us a error of no pic

    then do this
    red = Color.new(255,0,0)
    while true do
    pad = Controls.read()
    if pad~= oldpad then
    if pad:cross() then cnt = cnt + 1 end
    if pad:triangle() then cnt = cnt - 1 end --to go to previous pic
    if pad:start() then break end --cant forget that:mrgreen:
    end
    if pic[cnt] then --incase no such pic
    screen:blit(0,0,pic[cnt])
    else
    screen:print(0,0,"Sorry no such pic",red)
    end
    screen:flip()
    end


    Hope it helps =)

    \"Death be not proud, some have called thee mighty and great, thou art not so\"

  3. #3
    splodger15 is offline -Hacks Newbie
    Join Date
    Aug 2006
    Posts
    39
    Rep Power
    14

    Default

    Thanks i will give that a try
    Join my PSP site here: http://splodger15.forum5.com/

  4. #4
    splodger15 is offline -Hacks Newbie
    Join Date
    Aug 2006
    Posts
    39
    Rep Power
    14

    Default

    I tried that and it worked but my images show and when i press x nothing happens
    Join my PSP site here: http://splodger15.forum5.com/

  5. #5
    ST@TIC is offline -Hacks Newbie
    Join Date
    Nov 2006
    Location
    South Africa
    Posts
    39
    Rep Power
    14

    Default

    i dont know what u mean by they show but x does nothing?

    \"Death be not proud, some have called thee mighty and great, thou art not so\"

  6. #6
    splodger15 is offline -Hacks Newbie
    Join Date
    Aug 2006
    Posts
    39
    Rep Power
    14

    Default

    my first image shows then you press x and then nothing happens it just stays on that image is what you posted i added my images

    pic = {}
    pic[1] = Image.load("images/1.PNG")
    pic[2] = Image.load("images/2.PNG")
    pic[3] = Image.load("images/3.PNG")
    pic[4] = Image.load("images/4.PNG")


    cnt = 1
    cnt = 2
    cnt = 3
    cnt = 4


    red = Color.new(255,0,0)
    while true do
    pad = Controls.read()
    if pad~= oldpad then
    if pad:cross() then cnt = cnt + 1 end
    if pad:triangle() then cnt = cnt - 1 end
    if pad:start() then break end
    end
    if pic[cnt] then
    screen:blit(0,0,pic[cnt])
    else
    screen:print(0,0,"Sorry no such pic",red)
    end
    screen:flip()
    end
    Join my PSP site here: http://splodger15.forum5.com/

  7. #7
    ST@TIC is offline -Hacks Newbie
    Join Date
    Nov 2006
    Location
    South Africa
    Posts
    39
    Rep Power
    14

    Default

    dude u have to use one count starting at 1, what u have done is made your count = 4.

    so take out the:
    cnt = 2
    cnt = 3
    cnt = 4

    and have only this in its place:
    cnt = 1

    now try it sorry for late reply =) .

    o and sorry forgot a line of code ( My bad =) )

    cnt = 1
    red = Color.new(255,0,0)
    while true do
    pad = Controls.read()
    if pad~= oldpad then
    if pad:cross() then cnt = cnt + 1 end
    if pad:triangle() then cnt = cnt - 1 end
    if pad:start() then break end
    oldpad = pad -------Sorry forgot this
    end
    if pic[cnt] then
    screen:blit(0,0,pic[cnt])
    else
    screen:print(0,0,"Sorry no such pic",red)
    end
    screen:flip()
    end

    \"Death be not proud, some have called thee mighty and great, thou art not so\"

  8. #8
    splodger15 is offline -Hacks Newbie
    Join Date
    Aug 2006
    Posts
    39
    Rep Power
    14

    Default

    Thank you so much its finally working
    Join my PSP site here: http://splodger15.forum5.com/

  9. #9
    lua scripter is offline -Hacks Newbie
    Join Date
    Aug 2008
    Posts
    14
    Rep Power
    0

    Default

    use this code to load the image

    Code:
    "name"=Image.load("images/name.jpg")
    do this code for the button

    Code:
    if pad:cross() then
    screen.blit (0,0, name ,false)
    screen.flip()
    end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •