Seite 137 von 342 ErsteErste ... 37 87 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 187 237 ... LetzteLetzte
Zeige Ergebnis 4.081 bis 4.110 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; ive edited my post to include the lua files -= Double Post =- hey ive just edited my code and ...

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

    ive edited my post to include the lua files
    -= Double Post =-
    hey ive just edited my code and now when you go outside no matter where you start you end up in the middle of the screen but when you go inside you start at the entrance instead of the center. Can someone please help me because this is confusing


    Geändert von mark.sparky (11-13-2006 um 06:23 AM Uhr) Grund: Automerged Doublepost

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

    okay im getting an error when i run this something like
    index.lua 16 expected near ')' the usual well heres the code
    --//maze of doom
    --loads the map
    grass = Image.load("grass.png")
    --loads the player and enemies
    player = Image.load("player.png")
    enemy1 = Image.load("enemy1.png")
    enemy2 = Image.load("enemy2.png")
    --screen width and height
    screenwidth = 480 - player:width()
    screenheight = 272 - player:width()
    --player table
    Player = {}
    Player[1]= {x=0, y=0}
    -- enemy table
    enemy = {}
    enemy[1]= {x=10, y=10)
    --first loop
    while true do
    pad = Controls.read()
    for a = 0, 14 do
    for b = 0, 8 do
    screen:blit (32*a, 32*b, grass)
    end
    end
    -- print the player to the screen
    screen:blit(Player[1].x,Player[1].y,player)
    -- now lets make him move
    if pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x - 3
    end
    if pad:right() and Player[1].x < screenwidth then
    Player[1].x = Player[1].x + 3
    end

    if pad:up() and Player[1].y > 0 then
    Player[1].y = Player[1].y - 3
    end

    if pad:down() and Player[1].y < screenheight then
    Player[1].y = Player[1].y + 3
    end
    --x=width and y= height
    -- this prints the enemy1 to screen
    screen:blit(enemy[1].x,enemy[1].y,enemy1)
    -- now lets try to get him patrolling
    Direction = { x = 0, y = 0 }
    Direction.x = 1
    enemy[1].x = 10
    enemy[1].y = 10

    Speed = 3

    while true do
    if enemy[1].x < 10 then
    Direction.x = 1
    end

    if enemy[1].x > 200 then
    Direction.x = -1
    end

    enemy[1].x = enemy[1].x + ( Speed * Direction.x )
    enemy[1].y = enemy[1].y + ( Speed * Direction.y )

    end

    screen.waitVblankStart()
    screen.flip()
    end
    Also my patrolling code im still having trouble understanding it but if it looks right then can i just get an ok on it. 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!

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

    on line sixteen in the array( i think that is what it is called ) you have a { and finish with a )

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

    alright i was really bored today as i was waiting for the feedback on my maze thing so i coded a simple rock paper scissors game. i havent tested it yet so can someone just proof read my source really fast and i would appreciate you not taking it because after working on this for a couple more days i may release it.

    --removed the code because of the problem being fixed.

    Smileyface with tongue sticking out == : p (take away the spaces)
    EDIT: O didnt even see your posts mark.sparky thanks for the correction. once im done with rock paper and scissors ill test it again.
    EDIT AGAIN: i tried this game and im getting an error 28 or something like that. it says i have like an unknown symbol or something cant really figure it out help plz.
    Geändert von GuitarGod1134 (11-14-2006 um 08:54 AM Uhr)
    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!

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

    error:28: unexpected symbol near "and"

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

    yah thats the error but whats the fix?
    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!

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

    In this line:

    if pad:circle() then
    screen:blit(390, 20, rock) and player2 = player2 + 3
    end

    You don't put and, you do this:

    if pad:circle() then
    screen:blit(390, 20, rock)
    player2 = player2 + 3
    end

  8. #4088
    QJ Gamer Blue
    Points: 4.031, Level: 40
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    c:\Program Files\World of Warcraft\WoW.exe
    Beiträge
    98
    Points
    4.031
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    lol, I made rock paper scissors for my old calculator, a casio fx 9750g plus.
    I had to type all the things in on the stupid calculator and it made me so mad...
    it was text only too...
    much better with lua.

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

    thanks access denied. i think im gonna actually go really far with this game thing. at first i was just coding it for fun but its a really fun idea and there is one other game but its not being updated.

    EDIT: ok how do i make it so that when i press start it exits the game isnt it like
    if pad:start() then
    os.exit
    or something like that.
    Geändert von GuitarGod1134 (11-14-2006 um 08:29 AM Uhr)
    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!

  10. #4090
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    if pad:start() then
    break
    end

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

    Zitat Zitat von -TacticalPaper-
    if pad:start() then
    break
    end
    That doesn't exit the game. It switches from one loop to another. os.exit() or System.Quit() exits to the XMB. It's most likely os.exit() but System.Quit() might work too.

  12. #4092
    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 tried os.exit() and it just turns the screen black for a second and it starts my game again. one time it even turned the psp off. lol so in that case should i use system.quit()?
    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!

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

    does
    os.exit()
    work on 2.71 SE-B"?
    I try it and it never works for me, It just freezes...

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

    Zitat Zitat von GuitarGod1134
    i tried os.exit() and it just turns the screen black for a second and it starts my game again. one time it even turned the psp off. lol so in that case should i use system.quit()?
    That's the problem with os.exit() it sometimes doesn't work. So if you download LuaPlayer .20 mod by Cools, you can use System.Quit(). It only works with the .20 mod though, not the normal version.

  15. #4095
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Access_Denied
    That's the problem with os.exit() it sometimes doesn't work. So if you download LuaPlayer .20 mod by Cools, you can use System.Quit(). It only works with the .20 mod though, not the normal version.
    Where can i download the mod?

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

    o ok well at the moment im running .20 so i guess ill download the mod thanks. and one more thing to generate a random number isnt it like math.random or something like that but how would you generate a random number between 3-5. like the psp chooses its self either 3, 4 or 5 but random. ?? im looking on evilmana right now cant find anything.
    EDIT: I think i found it
    http://evilmana.com/tutorials/codeba...om_numbers.php
    is that it? pretty sure thats right.
    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!

  17. #4097
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    math.random(3,5)

  18. #4098
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    i have a scrolling background. it repeats it self as it scrools from right to left. but my problem is after it repeats itself twice, it doesnt repeat itsself again leving me with a black background

    bg=background

    Code:
    bgy = 482
    
    bgy = bgy - 5
    
    if bgy<= 482 then
    bgy = 0
    end
    
    if bgy>1 then
    bgy = bgy - 481
    end
    
    screen:blit(bgy,0,bg)
    screen:blit(bgy+bg:width(),0,bg)
    -= Double Post =-
    nevermidn i got it
    Geändert von yoyomacy (11-14-2006 um 03:52 PM Uhr) Grund: Automerged Doublepost

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

    Zitat Zitat von -TacticalPaper-
    math.random(3,5)
    would i do something like this
    if pad:r() then
    computer = math.random(3,5)
    and ya computer is a variable name
    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. #4100
    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

    Can someone give me an example of how to write text thats right justified? I had attempted once but the amount of padding would change depending on the letters and the writing isnt going to be always the same...
    Geändert von trex6662k5 (11-14-2006 um 04:36 PM Uhr)

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

    Just use screenprint but make the pixels on the right part of the screen.

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

    Ok heres part of my code here
    if pad:r() then
    computer = math.random(3,5)
    end
    but the problem is as soon as i press r my pic goes away and the variable returns to its orginal state. how can i make it so that one press of r and boom the pic stays blitted and the variable stays at the random selection. also i tried holding r and since its random it doesnt work it just keeps changing.
    -- Also with the progress im making we may see Lua RPS v0.02 by tomorrow or maybe even today lol.
    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!

  23. #4103
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Something like

    computer = math.random(3,5)
    if computer == 3 then
    blah
    end
    if computer == 4 then
    blah
    end
    if computer == 5 then
    blah
    end

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

    Well I have it like
    if pad:r() then
    computer = math.random(3,5)
    end
    --// then further down i have the
    if computer == bla bla statements
    I thought i would have to do something like oldpad=pad or something so that one i press it i dont have to hold it down.
    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!

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

    If you're going to be using math.random, put this line at the beginning of your code:

    math.randomseed(os.time() )

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

    Zitat Zitat von Access_Denied
    If you're going to be using math.random, put this line at the beginning of your code:

    math.randomseed(os.time() )
    i saw that line on evilmana but shouldnt it be my variable in there too. my variable is computer so shouldnt it be

    math.computer(os.time())) ?

    EDIT

    still need this quesiton

    Well I have it like

    Quote:
    if pad:r() then
    computer = math.random(3,5)
    end
    --// then further down i have the
    if computer == bla bla statements

    I thought i would have to do something like oldpad=pad or something so that one i press it i dont have to hold it down.

    Also is there any definite way to exit the lua script. i see u guys saying that os exit doesnt work and that other function only works on that lua player mod but i want this game to run on all lua players so the common homebrewer will be able to play it.
    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. #4107
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Ok then maybe something like

    variable = 0
    if pad:r() then
    variable = variable + 1
    end
    if variable > 0 then
    computer = math.random(3,5)
    end

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

    Ill try.
    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!

  29. #4109
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    is it possible to do a collision with dofile, i have my bullet settings in one file and my game in another lua file. i want bullets to do collision with oobjects in my game file. how do i do that

  30. #4110
    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 GuitarGod1134
    i saw that line on evilmana but shouldnt it be my variable in there too. my variable is computer so shouldnt it be

    math.computer(os.time())) ?

    ROFL! HAHHAHAHAHAHAHAHAHAHAHA :ROFL: :ROFL: :ROFL: :ROFL: HAHAHAHA..

    lol, sorry, couldnt hold myself there. NO, you keep it
    Code:
    math.randomseed(os.time())
    random.randomseed is a function, you cant change 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 09:01 PM Uhr.

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