Seite 323 von 342 ErsteErste ... 223 273 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 ... LetzteLetzte
Zeige Ergebnis 9.661 bis 9.690 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; thx anyways, ya was playing around with some of the code and it worked. now just have a diff question. ...

  
  1. #9661
    QJ Gamer Bronze
    Points: 4.297, Level: 41
    Level completed: 74%, Points required for next Level: 53
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    20
    Points
    4.297
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    thx anyways, ya was playing around with some of the code and it worked. now just have a diff question.
    |
    |
    |
    \/


    does anyone know how to extract a number from a string?


    Geändert von icemasta (01-14-2009 um 05:18 PM Uhr)

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

    im no expert, but if you typed the code like you did above then your problem is that you have your function inside a table. the format should be:
    Code:
    function functionName()
    so you would make it:
    Code:
    function collision(obj1,obj2)
    if thats what you want your function named. hope tht helps
    Lol you fixed it just as i posted sucks

  3. #9663
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    edit: oops thought this was c/c++ help thread, none of my answers would help
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

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

    Zitat Zitat von icemasta Beitrag anzeigen
    thx anyways, ya was playing around with some of the code and it worked. now just have a diff question.
    |
    |
    |
    \/


    does anyone know how to extract a number from a string?
    use string.find and string.sub

    read this and don't post until you have read it and learned how the functions worked and tried to figure it out
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

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

    also seen as you are extracting a number from a string you may want to take a look at the tonumber() function, as it would be held as a string because that is what you are extracting it from.
    ------ 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).

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

    if he uses the string as if it were a number, lua will generally autoconvert it - generally tostring is the only casting function ever needed in lua.
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

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

    didnt know that, do now thanks for lettin me know i have never come across that situation, but yeah i was just using logic but if its not needed then what the hey.
    ------ 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).

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

    nvm found one

  9. #9669
    Points: 2.005, Level: 27
    Level completed: 4%, Points required for next Level: 145
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jan 2009
    Beiträge
    5
    Points
    2.005
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard having probs

    i have a couple questions..

    i have this code setup inside of the while loop to exit the game when i want by simply changing the variable Quit to true. It doesnt seem to work. It just freezes the psp.

    if Quit == true then
    os.exit()
    end

    also, when i am writing a game and a map editor, and it seems when i go back and forth between the 2 i sometimes get errors like not enough memory or something along those lines. My question is.. Is there a way to clear all the memory from the last .lua you were running so you can start fresh with the new file. Im really new to programming in general and im not sure how im supposed to do everything. learning by trial and error. so i appreciate the help.
    thnx in advance.

  10. #9670
    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

    1. os.exit doesn't and never really has worked
    2. just manage your memory carefully, use tables and local vars, etc - you really shouldn't ever be running out of memory unless there's something drastic that is being overlooked
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  11. #9671
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    I need some tuts for PgeLua if anyone can post some links I would be greatful. ^^
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

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

    read my signature
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  13. #9673
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TurtlesPwn Beitrag anzeigen
    read my signature
    Didn't tell me anything new.......... =.=
    What is the diference between pge.texture.load() and pge.texture.swizzle()???
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  14. #9674
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    umm...alot,

    swizzle an image allows for the image to be drawn faster, however it does make it harder to modify the image data.
    where's loading an image is simple that, loading an image into ram.
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  15. #9675
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    OK that is good for when I don't need to change an image, but how do I use the image.

    Code:
    mypicture = pge.texture.load("test.png") --This returns a pointer to the image data.
    swpicture = pge.texture.swizzle("test.png") --This just returns true or false (maybe 0 or 1).
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  16. #9676
    QJ Gamer Bronze
    Points: 5.826, Level: 49
    Level completed: 38%, Points required for next Level: 124
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Everywhere
    Beiträge
    206
    Points
    5.826
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    When you load an image, it automatically swizzles it...
    You usually don't need to unless you un-swizzled it, to change the alpha, color, or some pixels.

    object = pge.texture.load(filename , [memorylocation], [swizzle])

    Parameters:
    filename - The name of the PNG image to load.
    memorylocation - Optional argument. Either PGE_RAM to load to RAM or PGE_VRAM to load to VRAM. Defaults to PGE_RAM if omitted.
    swizzle - Optional argument. A boolean representing whether to swizzle the texture or not. Defaults to true if omitted.
    To use the image, depends on how you want to use it.
    To print it onto the screen :
    pge.texture.draweasy(text ure, x, y, [rotation], [alpha])
    or
    pge.texture.draw(texture, x, y, [width], [height], [texstartx], [texstarty], [texendx], [texendy], [rotation], [alpha])


    http://lmgtfy.com/?q=pge+lua+documentation
    Pokemon Islands in Development : Qj Forum | Google Forum | Probords Forum

  17. #9677
    Points: 2.005, Level: 27
    Level completed: 4%, Points required for next Level: 145
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jan 2009
    Beiträge
    5
    Points
    2.005
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard summo questions

    is there a way to encrypt lua or whatever it is called to hide your source code?
    i want to

    PGE how much better then regular lua player for psp? i think they are on .20.

    would it be worth me moving from lua.20 to using pge?

    ill release something for you guys to play as soon as i can find a way to hide the code. I will probably go open source later, but for now its our baby(working with another) and id like to see it through first.

    so far we have some basic physics done like Mario(im using those gfx for now)
    Sidescroller.

    Mario physics include.
    run/jump/crouch/climb

    theres some makeshift monster code in with a lil ai.

    i also have a map editor made with some basic features.
    add/delete tile
    change tile attributes (visible/collision/kill/rope/warp)
    you can save to a user specified name.

    anyway..... all of this done using lua player 0.20. is PGE worth moving ny project? Ive been using lplayer and have been running into issues with the psp slowing down. Im sure its my sloppy code but to an extent. Is there any significant speed boost that i can get from pge?

    anywho thnx in advance, ill try and release some beta version soon.

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

    Zitat Zitat von Digikid13 Beitrag anzeigen
    Didn't tell me anything new.......... =.=
    What is the diference between pge.texture.load() and pge.texture.swizzle()???
    Did you actually attempt to apply it by reading documentation, searching google, and reading forums? I seriously doubt this.
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  19. #9679
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    @TurtlesPwn
    Hmmm what can I say.....

    @SectionEight
    Ya it should give you a great boost, PGELUA is made from scrap so everything is made for speed, everything is alot faster.
    Here is the Benchmark.
    I think it is very well worth it, and as far as I know you can't encrypt lua code.......although if you find anything out plz PM me.
    Geändert von Digikid13 (01-26-2009 um 04:48 PM Uhr) Grund: Adding Info.
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  20. #9680
    QJ Gamer Bronze
    Points: 5.826, Level: 49
    Level completed: 38%, Points required for next Level: 124
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Everywhere
    Beiträge
    206
    Points
    5.826
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Protecting or Encrypting Lua/PGE code : http://luaplayer.org/forums/index.php?topic=471.0
    Pokemon Islands in Development : Qj Forum | Google Forum | Probords Forum

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

    Zitat Zitat von Digikid13 Beitrag anzeigen
    @TurtlesPwn
    Hmmm what can I say.....

    @SectionEight
    Ya it should give you a great boost, PGELUA is made from scrap so everything is made for speed, everything is alot faster.
    Here is the Benchmark.
    I think it is very well worth it, and as far as I know you can't encrypt lua code.......although if you find anything out plz PM me.
    Your perceived knowledge makes me seriously doubt you're using the resources available to find answers. You need to start.
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  22. #9682
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TurtlesPwn Beitrag anzeigen
    Your perceived knowledge makes me seriously doubt you're using the resources available to find answers. You need to start.
    Maybe......I'll think about it. I did look for a lua encryptor and I didn't find one =.=
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  23. #9683
    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

    Did you look on lua.org?
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  24. #9684
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TurtlesPwn Beitrag anzeigen
    Did you look on lua.org?
    No, because I didn't think any tools for PC lua would not work on any PSP lua programs.
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  25. #9685
    Points: 2.005, Level: 27
    Level completed: 4%, Points required for next Level: 145
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jan 2009
    Beiträge
    5
    Points
    2.005
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    Im not familiar with pgelua, can someone who has worked with regular luaplayer and pge know if it may be possible to write out a script to maybe convert luaplayer files to pge compatible files.

    Im aware that pge will have more functions, but id much rather look through an already converted lua file looking for ways to optimize my code, then it would be for me to totally rewrite the program.

    I always seem to have trouble describing what i mean, please lemme know if i made my self clear hehe.

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

    Zitat Zitat von Digikid13 Beitrag anzeigen
    No, because I didn't think any tools for PC lua would not work on any PSP lua programs.
    You have a terrible misconception on the difference between Lua and Luaplayer etc. Read more, it helps. And did you even click on my link?

    sectioneight - while it would be possible, it would not be practical or take advantage of PGE's capabilities. I would recommend looking at PGE's samples and programs written with it and just relearning rather than trying to base off LP's API.
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  27. #9687
    Points: 2.005, Level: 27
    Level completed: 4%, Points required for next Level: 145
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jan 2009
    Beiträge
    5
    Points
    2.005
    Level
    27
    Downloads
    0
    Uploads
    0

    Standard

    yeh ive read over the documentation that they have up and it seems like it would help me out alot, just on the gfx rendering stuff alone. the problem is i am far along in my project and it would sux majorly if i were to have to rewrite everything all over again. I guess im looking for an easy answer where there is none. The advantage would be a speed boost but in order to do that i am going to have to completely rewrite the code. There's no windows pge luaplayer and that would mean i lose my partner. I think ill just wait till they release a windows player .

  28. #9688
    QJ Gamer Bronze
    Points: 5.826, Level: 49
    Level completed: 38%, Points required for next Level: 124
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Everywhere
    Beiträge
    206
    Points
    5.826
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    It's not too hard to switch over to PGE. I did it while in mid project in about 3 hours.
    Basically, you only need to rewrite the drawing functions, and texture handling.
    Everything else is pretty much fine. PGE has it's own math functions, but Lua's are still there if you don't want to bother.

    All I did was look at what the PGE's functions were for drawing and setting up the screen, "find and replace"'d the code, and a bit more tweaking, and I had it done.

    Once you get used to, and learn OOP then it's all basically the same.
    Pokemon Islands in Development : Qj Forum | Google Forum | Probords Forum

  29. #9689
    Points: 1.973, Level: 26
    Level completed: 73%, Points required for next Level: 27
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    17
    Points
    1.973
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    Hi guys

    I bet this is asked so many times before, but how do you get flash0 access with lua?
    This is a small piece of a simple menu with different options, including copying files to flash1.

    Code:
    if pad:cross() and not oldpad:cross() and ms == 1 then
    System.removeFile("flash1:/new/test.txt")
    end
    
    if pad:cross() and not oldpad:cross() and ms == 2 then
    afbeelding1 = Image.load("vc.png")
    screen:blit(0, 0, afbeelding1, false)
    screen.flip()
    screen.waitVblankStart(300)
    end
    
    if pad:cross() and not oldpad:cross() and ms == 3 then
    
    direxsist = System.doesDirExist("flash1:/new")
    if direxsist == 1 then
    else
    System.createDirectory("flash1:/new")
    screen.flip()
    end
    
    curdir = System.currentDirectory()
    
    filexist = System.doesFileExist("flash1:/new/test.txt")
    if filexist == 1 then
    System.removeFile("flash1:/new/test.txt")
    screen.flip()
    end
    System.copyFile(curdir.."/test1.txt","flash1:/new/test1.txt",0)
    screen.flip()
    end
    What do i have to change to make this work with flash0???

    tnx

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

    SG57 made a LuaPlayer with flash write access.
    You have to search for it. I remember you had to assign something to something then write a file to flash0.


 

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 .