Seite 284 von 342 ErsteErste ... 184 234 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 334 ... LetzteLetzte
Zeige Ergebnis 8.491 bis 8.520 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; windows luaplayer - includes the simple menu and simple movement examples that i posted on this thread - with their ...

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

    windows luaplayer - includes the simple menu and simple movement examples that i posted on this thread - with their own run files i also included the optional.cmd file just open it and you can choose a file that is in the luaplayer directory to run with the luaplayer

    download:

    http://www.sendspace.com/file/14kijf


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

  2. #8492
    QJ Gamer Blue
    Points: 4.268, Level: 41
    Level completed: 59%, Points required for next Level: 82
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    497
    Points
    4.268
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    thanks alot!!
    -= Double Post =-
    I tryed it and it started, but then my speakers made a wierd noise, and now there is a luaplayer.exe.stackdump in the file. What did I do wrong??
    -= Double Post =-
    nvm, now it works just fine. but the config.cfg wont load, should it??
    Geändert von PSProgramer (04-10-2008 um 11:57 AM Uhr) Grund: Automerged Doublepost

  3. #8493
    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 PSProgramer
    thanks alot!!
    -= Double Post =-
    I tryed it and it started, but then my speakers made a wierd noise, and now there is a luaplayer.exe.stackdump in the file. What did I do wrong??
    -= Double Post =-
    nvm, now it works just fine. but the config.cfg wont load, should it??
    lol i dont know what operating system are you using and the stack dump is just an error file you can delete it unless it has anything usefull that might tell us why it crashed inside

    ok and the config.cfg is just the file where the x and y co-ordinates from the simple_movement.lua are stored press X to save the co-ordinates then close and restart it and it should start from the last position it was at
    ------ 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).

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

    to load it to make Link' X and Y watever is in the Config file
    Code:
    Link = {}
    dofile("/config.cmd")
    That's how Fat30YCG Taught me lol

  5. #8495
    QJ Gamer Blue
    Points: 4.268, Level: 41
    Level completed: 59%, Points required for next Level: 82
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    497
    Points
    4.268
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    thanks alot guys, it's all making since now. One last thing that I'm still haveing trouble with is the adding of alpha, I tryed to follow, your instructions, but I couldn't find the remove color tool. If I PM you a sprite sheet, can you send me back an example of what it's supposed to do?? I only need the first character on the sheet, right now, so I can figure out how to do, this, because I have alllllllllllloooooooooooo oottttttttttttttttt of spites, and sprite sheets.

    thanx again

  6. #8496
    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 just use the CUT tool, use the magic wand and Cut, colour gone.

  7. #8497
    QJ Gamer Blue
    Points: 4.268, Level: 41
    Level completed: 59%, Points required for next Level: 82
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    497
    Points
    4.268
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    By the way, since Dan369 is here, I was wondering if you mind, if I borrow some of your sprites?? They are really similar to mine, maybe from the same sprite sheet. If not it's cool. Just asking.
    Thanks for helping by the way.
    And I think you Zelda is coming along great, hope mine is close to as good as yours.
    -= Double Post =-
    I tried to run my Zelda program so far on lua for windows and I got this error:

    error:Zelda.lua:30: 'end' expected (to close 'if' at line 18) near '(eof)'

    I am working on putting in a timer, so that a stream of text comes at different times, rather than all at once. I do not no how, to fix it, please help, and what is (eof)??
    thanx for the help.
    Geändert von PSProgramer (04-10-2008 um 12:54 PM Uhr) Grund: Automerged Doublepost

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

    eof is end of file - basically you have missed an end out somewhere

    e.g.

    if something then
    blah
    blah
    blah

    should be

    if something then
    blah
    blah
    blah
    end



    Zitat Zitat von PSProgramer
    thanks alot guys, it's all making since now. One last thing that I'm still haveing trouble with is the adding of alpha, I tryed to follow, your instructions, but I couldn't find the remove color tool. If I PM you a sprite sheet, can you send me back an example of what it's supposed to do?? I only need the first character on the sheet, right now, so I can figure out how to do, this, because I have alllllllllllloooooooooooo oottttttttttttttttt of spites, and sprite sheets.

    thanx again
    the remove colour tool is on the picture tool bar, it is the pen with an arrow pointing down and left it is not highlighted bit it is on the last tool bar at the top in the middle of the screen

    like on this picture

    also if dan lets you use his then thats fine if you still cant do it ill do it for you
    Geändert von FaT3oYCG (04-10-2008 um 01:55 PM 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).

  9. #8499
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von PSProgramer
    I tried to run my Zelda program so far on lua for windows and I got this error:

    error:Zelda.lua:30: 'end' expected (to close 'if' at line 18) near '(eof)'

    I am working on putting in a timer, so that a stream of text comes at different times, rather than all at once. I do not no how, to fix it, please help, and what is (eof)??
    thanx for the help.
    eof stands for End of File. Basically, you've got more if/while/repeat/switch statements you have ends. Go back and indent your code if you do not already, and go to line 18, and see if anything doesn't make sense there.

    Next time, post your code. Not the whole program, just the lines around the line the error is referring to. Also, with game mechanics code, I recommend you test it in the lua interpreter (Not to be mistaken with luaplayer for windows) first. While it will not give you a fancy output, it will give you a nice trace-back when an error occurs.

    You need to start learning how to help yourself. Don't go running to the help thread everytime you reach a minor snag. Do some research, etc. Google if you friend.

    Lastly, I don't think you should be tackling such a big project if you can't even create a menu, start smaller games and build your way up (Try a tetris clone, or maybe minesweeper (I haven't seen that for the PSP yet)). I guarantee you that you will abandon this project before you even have your first level running.

    Oh, and to create transparency in an image, go download Gimp. It is an free, open-source image editor that is almost as good as photoshop. There are plenty of guides on the internet that deal with your problem. Also most sprite sheets use a specific colour for transparency. In Gimp, you should just be able to to a colour replace.
    Geändert von Nielkie (04-10-2008 um 05:13 PM Uhr)

  10. #8500
    QJ Gamer Blue
    Points: 4.268, Level: 41
    Level completed: 59%, Points required for next Level: 82
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    497
    Points
    4.268
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Nielkie
    I would like to thank you for your concern, but I plan on writing this entire thing. So what if I can't do some of the things, to get started. Thats always the hard part for me, getting started. Once I get the minor kincks out in the begining, I will be fine for at least a little awhile. Thank you for your help. And yes, I believe i did fix the problem. thank you Fat3oYCG you have helped me alot, and haven't critisized me yet. I thank you for not putting down newer programers. And thanx for the help on the alpha thing, I think I got it.

  11. #8501
    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 PSProgramer
    Nielkie
    I would like to thank you for your concern, but I plan on writing this entire thing. So what if I can't do some of the things, to get started. Thats always the hard part for me, getting started. Once I get the minor kincks out in the begining, I will be fine for at least a little awhile. Thank you for your help. And yes, I believe i did fix the problem. thank you Fat3oYCG you have helped me alot, and haven't critisized me yet. I thank you for not putting down newer programers. And thanx for the help on the alpha thing, I think I got it.
    well thank you for your appreciation not everyone is that nice, also that isnt 100% true, i do put down some new programmer but only the ones that talk rubbish and dont look promising, mainly if they fail from the start then they will fail forever, i learned lua by myself and found it hard to find relevant material until i cam e here and had the same sort of problems as you, but like you i asked and got some good answers, you will see this if you look furnther back through this thread, i now consider myself to be and advanced programer in the lua programming language, although i do not know every little thing i can learn and understand new features of the language quickly, i can see you becoming just as good as me if you practice and put in the work, but make sure you dont just rely on other people telling you the answer, somtimes it is good to try something out and then if you cant get it to work maybe ask if it is the right method to use if you still cant do it then i would ask for some help but overall i wish you the best of luck, you are a budding programmer in the making, happy coding

    thanks

    [email protected]
    ------ 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).

  12. #8502
    QJ Gamer Blue
    Points: 4.268, Level: 41
    Level completed: 59%, Points required for next Level: 82
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    497
    Points
    4.268
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    thank you for the support, and Help, I really do appreciate it, and I will quit asking so many questions. It was just so very overwelming in the beginning, looking at all the stuff I needed to do, but it isn't so bad now that I look at it. I have customized your menu, I do appreciate that by the way. There are only 4 options, rather than 5 and I moved the place, and spaceing of the options. One thing, though that I am haveing trouble with, is putting in a background. I know how to "screen:blit" to input images, but i can't get it to fill the background like I want to. But yeah, other than that I am all good. I got the transparency on my sprites, finally. Thanx for that. I have already got almost all the sprites needed for running in all directions transparent. thanks for all the help. I will PM you later in the day on my progress so far.

    -PSProgramer

  13. #8503
    QJ Gamer Green
    Points: 5.889, Level: 49
    Level completed: 70%, Points required for next Level: 61
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    918
    Points
    5.889
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    hey everyone, im making great progress on my game, but i need help, what is the command to exit?

    ive been using this, but the psp freezes when i press square
    Code:
    if controls:square() then
    os.exit()
    end
    also im using hm6
    My Projects
    [URL="http://www.megaupload.com/?d=Q860B1VV"]BUMPER HARVEST MOD - PEGGLE DELUXE BETA 1[/URL]
    working on Zuno, an uno like game
    [QUOTE=FreePlay]It's a picture of a monkey. There, I spoiled it for you.[/QUOTE]

  14. #8504
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ifiwere1337
    hey everyone, im making great progress on my game, but i need help, what is the command to exit?

    ive been using this, but the psp freezes when i press square
    Code:
    if controls:square() then
    os.exit()
    end
    also im using hm6
    Hi,
    this should work:
    Code:
    if controls:square() then
    	System.Quit()
    end
    I have not tried it but i think it should work because it is on this list:
    http://luaplayerhm.xtreemhost.com/in...view=functions

  15. #8505
    QJ Gamer Green
    Points: 5.889, Level: 49
    Level completed: 70%, Points required for next Level: 61
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    918
    Points
    5.889
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sony psp player
    Hi,
    this should work:
    Code:
    if controls:square() then
    	System.Quit()
    end
    I have not tried it but i think it should work because it is on this list:
    http://luaplayerhm.xtreemhost.com/in...view=functions
    oh, i didnt know they had a list of functions on the site, i will try that thanks
    --edit
    thanks it works
    My Projects
    [URL="http://www.megaupload.com/?d=Q860B1VV"]BUMPER HARVEST MOD - PEGGLE DELUXE BETA 1[/URL]
    working on Zuno, an uno like game
    [QUOTE=FreePlay]It's a picture of a monkey. There, I spoiled it for you.[/QUOTE]

  16. #8506
    QJ Gamer Blue
    Points: 4.355, Level: 42
    Level completed: 3%, Points required for next Level: 195
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    48
    Points
    4.355
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Hey guys,

    could someone tell me, how to assign the ram?

    thx

  17. #8507
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Kooperus
    Hey guys,

    could someone tell me, how to assign the ram?

    thx
    I don't think Luaplayer is able to assign the ram

  18. #8508
    QJ Gamer Green
    Points: 5.889, Level: 49
    Level completed: 70%, Points required for next Level: 61
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    918
    Points
    5.889
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    its not able yet, maybe lua player .20, but not luaplayerhm
    My Projects
    [URL="http://www.megaupload.com/?d=Q860B1VV"]BUMPER HARVEST MOD - PEGGLE DELUXE BETA 1[/URL]
    working on Zuno, an uno like game
    [QUOTE=FreePlay]It's a picture of a monkey. There, I spoiled it for you.[/QUOTE]

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

    the ram is automatically assigned for what is needed when its all used it runs out of ram this is also called memory we can solve this by using the collectgarbage() function or the System.memclean() in luaplayer hm, but it would be good to be able to assign ram / memory so that it could be overwritten every time that section gets full, if it was doing a process that needed lots of ram but didnt need to store all of the data in the ram at one time

    basically no there isnt a function but you can clear the ram of unused variables and code with functions that are available
    ------ 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).

  20. #8510
    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

    Okay. I'm working on saving/loading sets for my Marching Band Drill Writer program. I have saving working so that a text file is written to, with all the x and y coordinates of all the dots on the screen on their own line. For example:

    140
    200
    50
    170

    That would mean that there is a dot at coordinates (140,200) and a dot at coordinates (50,170). So saving is working. But I can't seem to get loading working. What I need to do is read those numbers from the text file and insert them into a table so they can be drawn. Here is what I have:

    Code:
    --outside of loop
    function addLocation(x,y)
       table.insert(locations,{x=x,y=y})
    end
    
    --(looping gamestate starts here)
    
    if pad:square() and not oldpad:square() then
      System.usbDiskModeDeactivate()
      loadFile = io.open("Saved Sets/" .. loadFile2 .. ".txt","r")
      number = 0
      locations = nil
      locations = {}
    
      for line in loadFile:lines() do
           number = number + 1
      end
    
      for j = 1, number do
           xc = loadFile:read()
           yc = loadFile:read()
    
           addLocation(xc,yc)
      end
    
      loadFile:close()
    
      System.usbDiskModeActivate()
      gamestate = "game"
      pausestate = "select"
    end
    
    --here is the code that draws the X's for the dots. it's not actually here in my program, but it's in there
    
    if locations ~= nil then
      for i = 1, table.getn(locations) do
          screen:blit(locations[i].x,locations[i].y,dot)
      end
    end
    That seems to work fine, but when it goes back to the drawing screen, and it tries to draw the dots at the loaded coordinates, I get an error: "calling 'blit' on bad self (number expected, got nil)".
    NOTE: The table inserting and drawing does work fine, because it's the same way I'm doing it for the main program. It must be something with the loading/inserting after loading....

    Also, I know I would have to take into account that it is reading through and reading two lines each time- therefore it should only loop that action 1/2 of the number of lines in the file times (if that makes any sense). But I've messed around with that, and I still can't get it to work at all. Ugh!

    It's really bugging me (no pun intended). Thanks for any help.

  21. #8511
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Code:
      for line in loadFile:lines() do
           number = number + 1
      end
    
      for j = 1, number do
           xc = loadFile:read()
           yc = loadFile:read()
    
           addLocation(xc,yc)
      end
    There are 4 lines in the file. You are reading 4 sets of x and y ordinates, 2 of which don't exist.

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

    you could also just save the co-ordinates in a table, and just read the whole file, then you wouldnt have that problem and it would be much easier to load / save data
    ------ 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).

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

    Zitat Zitat von yaustar
    Code:
      for line in loadFile:lines() do
           number = number + 1
      end
    
      for j = 1, number do
           xc = loadFile:read()
           yc = loadFile:read()
    
           addLocation(xc,yc)
      end
    There are 4 lines in the file. You are reading 4 sets of x and y ordinates, 2 of which don't exist.
    Yeah, that's what I was thinking, but how would I go about only reading as many times as half the number of lines? I've tried but it says you can't manipulate a function (loadFile:lines()). Would "for j = 1, number/2 do" work? Not sure if I've tried it... I'll try it later.

    Zitat Zitat von FaT3oYCG
    you could also just save the co-ordinates in a table, and just read the whole file, then you wouldnt have that problem and it would be much easier to load / save data
    Hmm... I'll have to try that too.

    Thanks to both of you.

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

    im not sure if this works but it should do

    Code:
    white = Color.new(255, 255, 255)
    
    coordinate_table = { }
    
    dofile("./stored_coordinates_table.lua")
    
    function save_coordinate_data()
    coordinate_file = io.open("stored_coordinates_table.lua", "w")
    coordinate_file:write("coordinate_table = { \n")
    for i = 1, table.getn(coordinate_table) do
    coordinate_file:write("{ x = " .. coordinate_table[i].x .. ", " .. "y = " .. coordinate_table[i].y .. "}" .. " , \n")
    end
    coordinate_file:write("}")
    coordinate_file:close()
    end
    
    function addLocation(x, y)
    	table.insert(coordinate_table, {x = x, y = y})
    end
    
    oldpad = Controls.read()
    
    while true do
    
    pad = Controls.read()
    
    screen:clear()
    
    -- insert your main code here
    
    if pad:triangle() and not oldpad:triangle() then
    for i = 1, 10 do
    addLocation(4, 10)
    end
    end
    
    if pad:circle() then
    for i = 1, table.getn(coordinate_table) do
    screen:print(10, 10 + i * 10, coordinate_table[i].x .. " : " .. coordinate_table[i].y, white)
    end
    end
    
    if pad:cross() then
    	 save_coordinate_data()
    end
    
    -- insert your main code here
    
    if pad:start() then
    	break
    end
    
    oldpad = pad
    
    screen.waitVblankStart()
    screen.flip()
    
    end
    Geändert von FaT3oYCG (04-22-2008 um 02:48 PM 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).

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

    for j = 1, math.floor(number/2)*2, 2 do

    the third number is how many to increase the iterator each loop (default 1)
    the math.floor(number/2)*2 will eliminate the possibility of an error from an unexpected odd number of lines in the file

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

    Ok, here is what I have:
    Code:
                  for line in loadFile:lines() do
                      number = number + 1
                  end
    
                  for j = 1, math.floor(number/2)*2, 2 do
                      xc = loadFile:read()
                      yc = loadFile:read()
    
                      table.insert(locations{x=xc,y=yc})
                  end
    I get the error: "attempt to call global 'locations' (a table value)" at the line "table.insert(locations{x =xc,y=yc})".

  27. #8517
    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 forgot a comma in there. table.insert(locations>>> >>>>>,<<<<<<<<"{blahblahb lah})

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

    Ahh... wow. Thanks. But there's still an error :Argh: . "calling 'blit' on bad self (number expected, got nil)". That's the line where I try to blit all of the dots at the newly loaded coordinates. After it loads it won't blit.

  29. #8519
    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:
    for i = 1, table.getn(locations) do
    screen:blit(locations[i].x, locations[i].y, dot)
    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).

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

    Yeah, that's exactly what I have.


 

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 .