Seite 279 von 342 ErsteErste ... 179 229 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 329 ... LetzteLetzte
Zeige Ergebnis 8.341 bis 8.370 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; any more ideas FaT3oYCG?...

  
  1. #8341
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    any more ideas FaT3oYCG?



  2. #8342
    QJ Gamer Bronze
    Points: 8.665, Level: 62
    Level completed: 72%, Points required for next Level: 85
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    758
    Points
    8.665
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Well, for every one of your "screenrint()" calls, you didn't include a 4th argument. I'm pretty sure you need to supply one, not sure.

  3. #8343
    QJ Gamer Green
    Points: 3.721, Level: 38
    Level completed: 48%, Points required for next Level: 79
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    612
    Points
    3.721
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    A fourth argument is not needed for screenrint, it will default to black.

  4. #8344
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    it isn't needed but if you tell me what to change i can try it just to see.

  5. #8345
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Thanks, TurtlesPwn.

  6. #8346
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    menuBackground=Image.load("fl.png")
    screen:blit(0,0,menuBackground)
    
    screen:print(30,30,"What Does Ds mean?")
    screen:print(80,130,"Dualshock")
    screen:print(300,130,"Duel screen")
    screen:print(200,220,"Dual screens")
    
    oldpad=Controls.read()
    
    while true do
    
    pad=Controls.read()
    
    ---------------------------
    if pad:square() then
    dofile("ni/wrong.lua")
    end
    if pad:circle() then
    dofile("ni/wrong.lua")
    end
    if pad:triangle() then
    dofile("ni/right.lua")
    end
    ---------------------------
    
    screen.flip() 
    screen.waitVblankStart()
    
    oldpad = pad
    
    end
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  7. #8347
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Bol**ks still didn't work, it doesn't seem to even be trying to load the 1.lua file anyway so it must be a kat.lua or its got something else elsewhere relating to it i haven't seen.

  8. #8348
    Points: 2.792, Level: 32
    Level completed: 28%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    10
    Points
    2.792
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard Lua player for 3.71 M33 + System.usbDiskModeActivat e

    Hello,
    I'm just learning Lua, and I'm trying to get System.usbDiskModeActivat e() to work on my PSP-2000 slim cfw3.80M33-5.
    I have LuaPlayer for cfw3.71M33 installed in my /game folder.
    In the Lowser/index.lua if you hit the L trigger, its supposed to trigger USB mode, but all it does is freeze up the LuaPlayer, so I have to hit [home] to quit out of it.
    The memory stick LED flickers a second after I hit L trigger, but just freezes.
    I've tried this on a completely clean memory stick with no plugins installed and only LuaPlayer installed, and connected to two different PC's.
    I've also tried this with the PSPhud 1.3 installed to see if it was hitting the cpu when it locked, but it didn't appear to be.

    I suspect cfw3.80M33-5 has something to do with it.
    I've been searching a while for something about this, but can't seem to find anything.
    Is there a better LuaPlayer for the Slim cfw3.80M33-5 anywhere?
    I'm a complete noob at this, so sorry if theres something obvious I've missed.
    Any help or insight would be greatly appreciated.
    Thanks.

  9. #8349
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von IMIX
    Hello,
    I'm just learning Lua, and I'm trying to get System.usbDiskModeActivat e() to work on my PSP-2000 slim cfw3.80M33-5.
    I have LuaPlayer for cfw3.71M33 installed in my /game folder.
    In the Lowser/index.lua if you hit the L trigger, its supposed to trigger USB mode, but all it does is freeze up the LuaPlayer, so I have to hit [home] to quit out of it.
    The memory stick LED flickers a second after I hit L trigger, but just freezes.
    I've tried this on a completely clean memory stick with no plugins installed and only LuaPlayer installed, and connected to two different PC's.
    I've also tried this with the PSPhud 1.3 installed to see if it was hitting the cpu when it locked, but it didn't appear to be.

    I suspect cfw3.80M33-5 has something to do with it.
    I've been searching a while for something about this, but can't seem to find anything.
    Is there a better LuaPlayer for the Slim cfw3.80M33-5 anywhere?
    I'm a complete noob at this, so sorry if theres something obvious I've missed.
    Any help or insight would be greatly appreciated.
    Thanks.
    it just shows up as corrupted data on mine so you are further than me

    and it probably wont work seen as in 3.80 there were some nid changes which mean that when it was made for 3.71 the nids are now different so do not relate to the same things

    basically i cant get it to work at all and even if it does work like on yours i dbout any of the main functions will work - until a 3.80 version is made if there ever is
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  10. #8350
    Points: 2.792, Level: 32
    Level completed: 28%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    10
    Points
    2.792
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    That makes sense, I didn't think about the nid changes.
    I guess i could try to contact Emeric0101 over at XtreamLua.com to see if there's any chance of a new LuaPlayer release for the new cfw..
    I wish I knew enough to mess with that stuff myself.
    are you saying that the 3.71 luaplayer wont even run for you?
    I formatted and reset my flash1 in recovery after this last update,
    dunno if that would make a difference for you or not.
    Thanks for the quick reply!

  11. #8351
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    I just use Cool's Mod 4 built for 1.50. I use it in 3.80 M33-5 and the System.usbDiskModeActivat e() works perfectly.

  12. #8352
    Points: 2.792, Level: 32
    Level completed: 28%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    10
    Points
    2.792
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    I just ran the 3.71-M33 LuaPlayer on eLoader 1.0, and System.usbDiskModeActivat e() works now!!!
    I've tried running every other LuaPlayer I could find normally, even through eLoader, with no luck.
    how'd you get Mod 4 for 1.50 running on your slim?
    Geändert von IMIX (01-30-2008 um 07:31 PM Uhr)

  13. #8353
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Oh no, not on a slim, sorry. I misunderstood. My bad.

  14. #8354
    Points: 2.792, Level: 32
    Level completed: 28%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    10
    Points
    2.792
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    ah, no problem.
    got it working (or worked around).
    thanks all!
    :Jump:

  15. #8355
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Good job! :)

  16. #8356
    Points: 3.340, Level: 35
    Level completed: 94%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Ort
    Germany
    Beiträge
    8
    Points
    3.340
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    hi,

    i wanted to create a tile engine, but i get "loop in gettable" in line 27, which is
    Code:
    screen:blit(x*picture:width()+1-picture:width(),y*picture:height()+1-picture:heigt(),picture)
    the whole code:

    Code:
    white = Color.new(255,255,255)
    green = Color.new(255,255,255)
    
    tiles = {}
    tiles[1] = Image.createEmpty(30,30)
    tiles[1]:clear(white)
    
    coord = {}
    
    coord[1] = {}
    coord[1].x1 = 1 
    coord[1].x2 = 6
    coord[1].y1 = 3
    coord[1].y2 = 7
    
    coord[2] = {}
    coord[2].x1 = 8
    coord[2].x2 = 11
    coord[2].y1 = 2
    coord[2].y2 = 8
    
    
    function tile(x1,x2,y1,y2,picture)
    
    for x = x1,x2 do
    for y = y1,y2 do
    screen:blit(x*picture:width()+1-picture:width(),y*picture:height()+1-picture:heigt(),picture)
    end
    end
    end
    
    
    while true do
    
    screen:clear()
    
    tile(coord[1].x1,coord[1].x2,coord[1].y1,coord[1].y2,tiles[1])
    tile(coord[2].x1,coord[2].x2,coord[2].y1,coord[2].y2,tiles[1])
    
    screen.flip()
    screen.waitVblankStart()
    end
    i hope you can help me.....im still a noob and it took quite some time to come up with this oO

  17. #8357
    QJ Gamer Green
    Points: 3.721, Level: 38
    Level completed: 48%, Points required for next Level: 79
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    612
    Points
    3.721
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    You misspelled height:
    screen:blit(x*picture:wid th()+1-picture:width(),y*picture :height()+1-picture:heigt(),picture)

  18. #8358
    Points: 3.340, Level: 35
    Level completed: 94%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Ort
    Germany
    Beiträge
    8
    Points
    3.340
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    damn, i spent an hour just changing things in my script..

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

    Not to be rude, but that's hilarious lol

    this too --------------->


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


  20. #8360
    Points: 3.340, Level: 35
    Level completed: 94%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Ort
    Germany
    Beiträge
    8
    Points
    3.340
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    yea, i know ;(...... and the tile engine sucks anyway,im going to make a new one today..... are there any lua tutorials "more advanced" than the ones on evilmana?

  21. #8361
    QJ Gamer Green
    Points: 3.721, Level: 38
    Level completed: 48%, Points required for next Level: 79
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    612
    Points
    3.721
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Don't make a tile engine more complex than it is - it's just a table with a bunch of tables inside it and each entry (tile) has some properties.

  22. #8362
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    i need i tiny bit of help!!!

    I have a variable like this
    enemy.health = 100
    and another one for the player

    i would like to know where to put this if statement

    if enemy.health = 0 then
    dofile("Story2.lua)
    end

    do i put it in the main loop or outside of it and also is that the correct if statement to use :?

  23. #8363
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369
    i need i tiny bit of help!!!

    I have a variable like this
    enemy.health = 100
    and another one for the player

    i would like to know where to put this if statement

    if enemy.health = 0 then
    dofile(&quot;Story2.lua)
    end

    do i put it in the main loop or outside of it and also is that the correct if statement to use :?
    requires tables

    Code:
    player = { health = 100 }
    enemy = { health = 100 }
    
    while  true do
    
    -- game stuff for shooting or whatever
    
    if enemy.health == 0 then
    dofile("story2.lua")
    end
    
    end -- end of while loop
    my code was messed up although right i just edited it to give it popper line formatting
    Geändert von FaT3oYCG (02-14-2008 um 02:44 AM Uhr)
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  24. #8364
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Dang it. I had a great post all typed up and I lost it. Oh well; I'll try again.

    Where you put the if statement depends on the complexity of your script and what you need the if statement to do. If the script is not very complex or the if statement is a big part of the game or application you are making, you can put it in the main loop. However, if you might need to only do the if statement under certain conditions, or if you would need to be able to have more control over the if statement, I would put it in a function outside of the main loop. Then, if need be, you can put that function inside of the main loop; you'll have more control over the if statement and all of your code.

    Secondly, the if statement script you provided is incorrect.

    Code:
    if enemy.health = 0 then
    dofile("Story2.lua)
    end
    It should be:

    Code:
    if enemy.health == 0 then
    dofile("Story2.lua)
    end
    Here's why:

    In lua, "=" and "==" have completely different meanings and uses. "=" is used to set a variable equal to something, such as in "red = Color.new(255,0,0)", or in "gamestate = 1". The symbol "==", however, is used to compare a variable to something, such as in your code, "if enemy.health == 0 then", or "if gamestate == 1 then".

    I remember this difference in the way I say (or rather think) the names of the symbols. For "=" I think "equals", and for "==" I think "is equal to". This helps me keep them separated in my mind.

    As for comparison symbols, there are others besides "==". In lua there are "<, >, <=, >=, and ~=. In order, these are "less than", "greater than", "less than or equal to", "greater than or equal to", and "not equal to". You can use these to compare variables to other variables or to numbers. For instance, "if enemy.health <= 0 then" would allow you to do the action even if the enemy has less than 0 health, as if he was "overkilled". Another example, "if gamestate ~= 1 then", would execute the code only if the variable gamestate is not equal to 1. For a final example, you can use these when using timers, such as in "if timer < 0 then", where timer is the variable connected to the timer in the script. The code would then only execute if the the timer has run below 0.

    I hope this has helped you and others! I know you aren't the only one who didn't understand this concept; I see it being used incorrectly fairly often.

  25. #8365
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    thanks i get it know

  26. #8366
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    No problem. :)

  27. #8367
    QJ Gamer Bronze
    Points: 8.665, Level: 62
    Level completed: 72%, Points required for next Level: 85
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    758
    Points
    8.665
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    And there was no second quote in the dofile.
    You wrote:

    Code:
    dofile("Story2.lua)
    when it should be:

    Code:
    dofile("Story2.lua")

  28. #8368
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Ah, nice catch. Didn't see that.

  29. #8369
    QJ Gamer Blue
    Points: 4.872, Level: 44
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    251
    Points
    4.872
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    This may be a dumb question, but is there an easy way to restart my script? (Eg. Game Over! Press O to play a new game").

    Or is the best thing to do just reset all the variables and things in a function.

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

    littlevish - A typical 'restructure program flow or screw good practice' scenario.

    Bad practice would be unloading all used resources then dofile("thisscript.lua"). One method of good practice would be creating a program that flows via 'game state's so restarting your script would be as easy as settingthe game state to the initial game state and initialize it. ('main menu' or 'intro' typically).

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



 

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

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