Seite 194 von 342 ErsteErste ... 94 144 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 244 294 ... LetzteLetzte
Zeige Ergebnis 5.791 bis 5.820 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; 1) If i clear the screen and make it white, then blit a transperent image on it, and take a ...

  
  1. #5791
    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

    1) If i clear the screen and make it white, then blit a transperent image on it, and take a screen shot will the screen shot be transperent.

    2) As for enycryption, could I do something like this:
    Code:
    if VAR == 4 then
    VAR = "B"
    end
    3) How can I select characters from a txt file from a txt file like maybe the third letter in a txt file. So i want something like this:
    Code:
    if (i dont what goes here) == "3" then
    whatever
    end
    The "i don't know what goes here" will be the third letter in the txt file.



  2. #5792
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak9
    1) If i clear the screen and make it white, then blit a transperent image on it, and take a screen shot will the screen shot be transperent.
    No, the screen can never have a transparent value.

    Zitat Zitat von pspfreak9
    2) As for enycryption, could I do something like this:
    Code:
    if VAR == 4 then
    VAR = "B"
    end
    Yes, but make sure you make the "B" a 4

    Zitat Zitat von pspfreak9
    3) How can I select characters from a txt file from a txt file like maybe the third letter in a txt file. So i want something like this:
    Code:
    if (i dont what goes here) == "3" then
    whatever
    end
    The "i don't know what goes here" will be the third letter in the txt file.
    whatever = string.sub(file:read(3),3 ,3)
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  3. #5793
    QJ Gamer Blue
    Points: 4.812, Level: 44
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    London, United Kingdom
    Beiträge
    131
    Points
    4.812
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    2)I had thought about using BASE64 or ROT13 as a method of obfuscation.
    Though I have never attempted it as obfuscation. BASE64 is already being used

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

    Zitat Zitat von youresam
    No, the screen can never have a transparent value.


    Yes, but make sure you make the "B" a 4


    whatever = string.sub(file:read(3),3 ,3)
    Ok thanks but can you explain the line of code i bolded, and underlined plz.

  5. #5795
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    file:read(3) will return 3 characters from the text file
    and Im telling it to take from character 3 to character 3 of that string.

    you could also do:
    file:seek("set",3)
    whatever = file:read(1)
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

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

    Ok, I get it thanks youresam.
    -= Double Post =-
    Are there any tuts on LUA file io anywhere?
    -= Double Post =-
    any1...
    Geändert von pspfreak9 (02-23-2007 um 08:13 PM Uhr) Grund: Automerged Doublepost

  7. #5797
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    I really could use sme help getting this fixed dont have a clue how to fix it the error is at the bottom
    heres the code:
    Code:
    System.usbDiskModeActivate() 
    
    red = Color.new(225,0,0)
    player = Image.load("player.png")
    background = Image.load("background.png")
    pic1 = Image.load("pic1.png")
    pic2 = Image.load("pic2.png")
    Pic = { }
    Pic[1] = { x= 80, y = 95, h = pic1:height(), w = pic1:width() }
    Player = { }
    Player[1] = { x = 50, y = 107, h = player:height(), w = player:width() } 
    screenwidth = 480 - player:width()
    screenheight = 272 - player:width()
    playerHeight = 90
    playerWidth = 90
    function movePlayer()
    pad = Controls.read()
    if pad:left() then 
    Player[1].x = Player[1].x - 1 
    end
    if pad:right() then 
    Player[1].x = Player[1].x + 1 
    end
    if pad:up() then 
    Player[1].y = Player[1].y - 1 
    end
    if pad:down() then 
    Player[1].y = Player[1].y + 1 
    end
    end
    
    function collision(Pic,Player)
    if (Pic[1].x+Pic[1].w > Player[1].x ) and (Pic[1].x < Player[1].x + Player[1].w) and (Pic[1].y + Pic[1].h > Player[1].y) and (Pic[1].y < Player[1].y + Player[1].h) then
    	return true
    	else
    		return false
    	end
    end
    Player[1].x = Player[1].oldx
    Player[1].y = Player[1].oldy
    while true do
    pad = Controls.read()
    screen:clear()
    screen:blit(0,0,background)
    screen:blit(Pic[1].x,Pic[1].y,pic1)
    screen:blit(140,107,pic2)
    screen:blit(Player[1].x,Player[1].y,player)
    if pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x - 2
    end
    
    if pad:right() and Player[1].x < screenwidth then
    Player[1].x = Player[1].x + 2
    end
    
    if pad:up() and Player[1].y > 0 then
    Player[1].y = Player[1].y - 2
    end
    the exact error says: script.lua:47: calling 'blit' on bad self (number expected, got nil)
    so your sam said i was calling a string and not a number, but i dont see where the error comes from.
    can anyone fix it?

  8. #5798
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von %chrono trigger%
    I really could use sme help getting this fixed dont have a clue how to fix it the error is at the bottom
    heres the code:

    the exact error says: script.lua:47: calling 'blit' on bad self (number expected, got nil)
    so your sam said i was calling a string and not a number, but i dont see where the error comes from.
    can anyone fix it?
    Not sure, the code looks fine to me.
    -= Double Post =-
    Zitat Zitat von pspfreak9
    Ok, I get it thanks youresam.
    -= Double Post =-
    Are there any tuts on LUA file io anywhere?
    -= Double Post =-
    any1...
    -= Double Post =-
    any1...
    -= Double Post =-
    any1...
    -= Double Post =-
    any1...
    -= Double Post =-
    any1...
    -= Double Post =-
    any1...
    -= Double Post =-
    any1...
    Yeah there are. http://www.lua.org/pil/21.1.html
    Geändert von youresam (02-24-2007 um 10:01 AM Uhr) Grund: Automerged Doublepost
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  9. #5799
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    exactly but thanks for trying
    anybody else now?
    could it be my images?
    (im trying everything)

  10. #5800
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    Player[1].x = Player[1].oldx
    Player[1].y = Player[1].oldy
    You never set a value for Player[1].oldx and Player[1].oldy, so the numbers become nil.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  11. #5801
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    that was the problem, so i added those variables into my table. it worked, but now my player wont move.

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

    i think you should do:
    Code:
    Player[1].oldx = Player[1].x
    Player[1].oldy = Player[1].y
    just switch them that way your player.x and player.y will not be the ones changed, allowing you to move

  13. #5803
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    nope didnt work any other suggestions
    p.s. thanks for all the help everyone

  14. #5804
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    His solution was for my bug report.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  15. #5805
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    ok sorry for bugging everyone, but ive got all errors fixed, but i just implemented jumping. now it says my guy is jumping, but he does not appear to be jumping how to i mkae it so he actually changes his "y" value and then comes back down?

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

    Quick Question:
    Code:
    return
    What does that do, return to Lowser?

  17. #5807
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    can someone please tell me where a simple enemy code is

  18. #5808
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak9
    Quick Question:
    Code:
    return
    What does that do, return to Lowser?
    Returns from the current function.
    -= Double Post =-
    Zitat Zitat von pspaquaforce
    can someone please tell me where a simple enemy code is
    http://google.com
    Geändert von youresam (02-25-2007 um 03:41 PM Uhr) Grund: Automerged Doublepost
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  19. #5809
    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

    Ok, I need some help with a bit of code for printing text centered on the screen with truetype fonts.

    Here's what I have so far:


    Code:
    blue = Color.new(0,0,255)
    hyper = Font.load("fonts/hyperion.ttf")
    hyper:setPixelSizes(10, 20)  
    
    function printCentered(font, y, text, color)
         local length = string.len(text)
         local x = 240 - ((length*10)/2)
         screen:fontPrint(font, x, y, text, color)
    end
    
    screen:clear()
    
    printCentered(hyper, 100, "This is a test", blue)
    printCentered(hyper, 200, "This should be centered as well", blue)
    
    screen.flip()
    
    while true do
    	pad = Controls.read()
    	if pad:start() then break
    	end
    end

    Since I've set the font width to 10, If I were using a fixed width font then 240 - ((length*10)/2) or (half of the screen width)-((number of characters in the text string * the pixel width of the font)/2) would center the line. But since I'm using a variable width true type font it's actually coming out to the left of center.

    Can anyone tell if there is a function that can give me the actual pixel length of a string of text when using a variable width font?

    *edit*

    LOL, I post a question then find the answer myself a couple minutes later:

    Code:
    hyper:getTextSize(text)["width"]
    Geändert von Merick (02-25-2007 um 04:09 PM Uhr)

  20. #5810
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    ok i added everything the only thing left is (dramatic silence) collision.
    i added collision on another image and its right, however its giving me an error saying i need to add an end to close my 'while'.
    i have an end at the end of the while true do loop that would end it so i dont understand whats wrong
    any ideas?

  21. #5811
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Check your entire code to make sure every IF and WHILE has an END.

  22. #5812
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    :Jump:

  23. #5813
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    nevermind i fixed it
    Geändert von %chrono trigger% (02-25-2007 um 08:42 PM Uhr)

  24. #5814
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Would you mind posting your code? Or PMing it?

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

    Here is a simple enemy code
    Code:
    enemy1=Image.load(....)    --// enemy image
    
    Enemy= {}
    Enemy[1] = {x = ... , y = ...}     --//X and y Position of Enemy
    
    function moveenemy() --dont forget to call the function
    --your enemy movement function
    if you move right then
       he moves to you
    end                    
    
    end
    
    screen:blit(enemy[1].x, enemy[1].y, enemy1)
    Just edit the code to fit your game, Very simple.

  26. #5816
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    enemy1=Image.load(....) --// enemy image

    Enemy= {}
    Enemy[1] = {x = ... , y = ...} --//X and y Position of Enemy

    function moveenemy() --dont forget to call the function
    --your enemy movement function
    if you move right then
    he moves to you
    end

    end

    screen:blit(enemy[1].x, enemy[1].y, enemy1)
    the function part is what i am having trouble on

  27. #5817
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspaquaforce
    :Jump:
    ...
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  28. #5818
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    yes i thought the code you gave me would work so
    -= Double Post =-
    its really gay witout shake moving
    shake should be kicking meatwads @$$ by now all he can do is give him that funny look
    Geändert von pspaquaforce (02-25-2007 um 07:08 PM Uhr) Grund: Automerged Doublepost

  29. #5819
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspaquaforce
    yes i thought the code you gave me would work so
    -= Double Post =-
    its really gay witout shake moving
    shake should be kicking meatwads @$$ by now all he can do is give him that funny look
    I KNOW ITS SO GAY WITHOUT SHAKE MOVING!


    ...





    ...






    (man I need to stop going to this thread..)
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  30. #5820
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    HELP ME:Argh: didn't i send you the code but you didn't pm me back huh
    youresam's thoughts " that retard pm again i thought i was done with him"
    or did you think of that


 

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:52 AM Uhr.

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