Seite 71 von 342 ErsteErste ... 21 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 121 171 ... LetzteLetzte
Zeige Ergebnis 2.101 bis 2.130 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; Hey-- I recently started learning lua...have never even worked with Luaplayer before though.. So I got a quick (idiotic) question..Which ...

  
  1. #2101
    Developer
    Points: 7.821, Level: 59
    Level completed: 36%, Points required for next Level: 129
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    751
    Points
    7.821
    Level
    59
    Downloads
    0
    Uploads
    0

    Standard

    Hey-- I recently started learning lua...have never even worked with Luaplayer before though.. So I got a quick (idiotic) question..Which will soon be followed by more..

    What is Lowser?


    Geändert von PSPXavier (05-06-2006 um 06:10 PM Uhr)

  2. #2102
    noob

    Points: 11.654, Level: 71
    Level completed: 1%, Points required for next Level: 396
    Overall activity: 99,0%

    Registriert seit
    Jun 2005
    Beiträge
    220
    Points
    11.654
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSPduh
    Hold up, is the v in VarPlayerrage supposed to be in capital? beacuse the next one is not.
    Wow. I am an idiot. Thanks for your help. :)

  3. #2103
    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 PSPXavier
    Hey-- I recently started learning lua...have never even worked with Luaplayer before though.. So I got a quick (idiotic) question..Which will soon be followed by more..

    What is Lowser?
    lowser is like the XMB for lua. when you start up LUA, the list of games/folders you see as a whole is called lowser.
    --------------------------------------------------------------------------------------

  4. #2104
    Developer
    Points: 7.821, Level: 59
    Level completed: 36%, Points required for next Level: 129
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    751
    Points
    7.821
    Level
    59
    Downloads
    0
    Uploads
    0

    Standard

    Ahh-- that's what I thought..But I wasn't sure, and somehow couldn't find much info.

    Thank!
    Geändert von PSPXavier (05-06-2006 um 07:36 PM Uhr)

  5. #2105
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    IS there a Again function like
    Ex:
    if pad:cross() then
    screen:blit(0,0,Backgroun d)
    if pad:cross again then
    screen:blit(0,0,Backgroun dtwo)
    is that possible and if yes do he have to make the function or it exist already?

  6. #2106
    Points: 4.214, Level: 41
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    21
    Points
    4.214
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    hey......i just started makeing my First game in LUA

    I NEED HELP...

    i need a tutorial or somthing to learn:

    HOW TO MAKE A ramdom miser and MATCHER

    EXAMPLE:
    say i make a random dice roll and i get a 5 then i want to be able to click on the number 5 on a number chart and then if right it will keep going and if wronge it will start over and keep ur highscore..

    HOW Could i DO this

    P.S HELP PLEASE THANKS

  7. #2107
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    For tutorial go to:
    Evilmana.com
    You mean a random function?

  8. #2108
    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 ZereoX
    IS there a Again function like
    Ex:
    if pad:cross() then
    screen:blit(0,0,Backgroun d)
    if pad:cross again then
    screen:blit(0,0,Backgroun dtwo)
    is that possible and if yes do he have to make the function or it exist already?
    no, there isnt a again function, but you could do this:

    1. add all your backgrounds to an array:

    Code:
    backgrounds = {}
    
    backgrounds[1] = Image.load("background1.png")
    backgrounds[2] = Image.load("background2.png")
    ... and so on for all backgrounds.
    2. then add this:

    Code:
    currentbackground = 0
    3. now, your code:

    Code:
    if pad:cross() then
    currentbackground = currentbackground + 1
    screen:blit(0,0,backgrounds[currentbackground])
    end
    try that.
    --------------------------------------------------------------------------------------

  9. #2109
    Developer
    Points: 7.821, Level: 59
    Level completed: 36%, Points required for next Level: 129
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    751
    Points
    7.821
    Level
    59
    Downloads
    0
    Uploads
    0

    Standard

    I'm having some trouble installing lower v0.12 on Luaplayer v.16. Could someone tell me how?

    Thanks

  10. #2110
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    it whas an EXAMPLE my real problem is that i can't add a third card to my table
    whitout making it it appear when i press hit first time making the second card appears the third one appers for 2 second andthen dissapear when i press hit agin it appear then dissapear i have to hold it down how can i do so that when i press hit only the second card appears and when i press hit again only the third card appears and stay.
    here is a part of my code:
    Code:
    if pad:cross() and Command == 1 then
    Select:play() Drawcard = 1
    end
    
    if Drawcard == 1 then
    drawCard() Points = Points + Pointstwo
    end

  11. #2111
    QJ Gamer Blue
    Points: 4.899, Level: 44
    Level completed: 75%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    55
    Points
    4.899
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    ok guys im making my first game ever, and it will be released as a beta as soon as this bug is fixed. ok so in the game, when you start it theres a menu. it says press x to begin. but you need to hold x the whole time while playing then game. so thats the problem. also theres a shop that does the same thing, you have to hold square the whole time. and also when you go to begin level 1, it just flashes the screen for a split second and then goes away. plz help

  12. #2112
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Post your code il look at it.

  13. #2113
    QJ Gamer Blue
    Points: 4.899, Level: 44
    Level completed: 75%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    55
    Points
    4.899
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    green = Color.new(0,255,0)
    red = Color.new(255,0,0)
    blue = Color.new(0,0,255)
    white = Color.new(255,255,255)
    inpaintshop = Image.load("inpaintshop.p ng")
    player = Image.load("player.png")
    menu = Image.load("menu.png")
    inpaintshop = Image.load("inpaintshop.p ng")
    playern2o = Image.load("playern2o.png ")
    roadlevel1 = Image.load("roadlevel1.pn g")
    road = Image.load("road.png")
    upcurb = Image.load("uppercurb.png ")
    inshop = Image.load("inshop.png")
    lowcurb = Image.load("lowercurb.png ")
    trash = Image.load("trash.png")
    firstgas = Image.load("1stgasstation .png")
    cash = {}
    cash.money = 200
    mid = Image.load("middle.png")
    playerorange = Image.load("playerorange. png")
    playerred = Image.load("playerred.png ")
    playerredn2o = Image.load("playerredn2o. png")
    playerorangen2o = Image.load("playerorangen 2o.png")
    selectingdiff = { hl = Image.createEmpty(145,15) , x = 114,y = 33 }
    selectingdiff.hl:clear(wh ite)
    timer = Timer.new()
    time = timer:time()
    nitros = {}
    nitros.y = 15
    health = {}
    health.y = 15
    screenwidth = 480 - player:width()
    screenheight = 272 - player:width()
    Player = { }
    Player[1] = { x = 216, y = 197 }
    Player.nitros = 50
    Player.health = 50
    screen.flip()
    gamestate = { w = "game"}


    while true do
    pad = Controls.read()
    -- menu
    gamestate.w = "menu"
    screen:blit(0,0,menu,fals e)
    screenrint(100,150,"Press 'X' to play",red)
    screenrint(100,160,"Press 'O' to quit",red)
    if pad:cross() and gamestate.w == "menu" then
    gamestate.w = "game"

    pad = Controls.read()
    oldpad = Controls.read()
    screen:clear()
    screen:blit(0,0,firstgas, false)
    screen:fillRect(15,15,Pla yer.nitros,nitros.y,blue)
    screen:fillRect(72,15,Pla yer.health,health.y,red)
    screen:blit(Player[1].x,Player[1].y,player)
    screenrint(250,10,"Player.x: " .. Player[1].x,red)
    screenrint(250,20,"Player.y: " .. Player[1].y,red)
    screenrint(15,37,"n2o: " .. Player.nitros,blue)
    screenrint(72,37,"HP: " .. Player.health,red)
    screenrint(123,37,"Cash: " .. cash.money,green)

    if pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x - 4
    end

    if pad:right() and Player[1].x < screenwidth then
    Player[1].x = Player[1].x + 4
    end

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

    if pad:down() and Player[1].y < screenheight then
    Player[1].y = Player[1].y + 4
    end

    if pad:r() then
    screen:blit(Player[1].x,Player[1].y,playern2o)
    end

    if pad:r() and pad:right() and Player[1].x < screenwidth then
    Player[1].x = Player[1].x + 10
    end

    if pad:r() and pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x - 10
    end

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

    if pad:r() and pad:down() and Player[1].y < screenheight then
    Player[1].y = Player[1].y + 10
    end

    if pad:r() and Player.nitros > 0 then
    Player.nitros = Player.nitros - 1
    end

    if Player.health == 0 then
    screen:clear()
    screenrint(25,200,"You ran out of Health, game over. Press Start to Exit", red)
    end

    if Player.health > 50 then
    Player.health = 50
    end

    if Player[1].x <= 272 and Player[1].y <= 57 then
    screenrint(100,200, "Press 'X' to fill up on HP and n2o.", red)
    end

    if pad:cross() and Player[1].x <= 472 and Player[1].y <= 41 then
    Player.health = Player.health + 20
    end

    if pad:cross() and Player[1].x <= 472 and Player[1].y <= 41 then
    Player.nitros = Player.nitros + 20
    end

    if Player.nitros > 50 then
    Player.nitros = 50
    end

    if Player.health < 10 then
    screenrint(240,265,"In risk losing your honor and dieing at the same time!",red)
    end

    if Player[1].x <= 44 and Player[1].y >= 141 then
    screenrint(100,200,"Press 'O' to begin Level 1", red)
    end

    if Player[1].x >= 348 and Player[1].y <= 57 then
    screenrint(100,200,"Press '[_]' to shop", red)
    end
    -- fix nitros bug
    if Player.nitros == 0 and pad:r() and pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x + 6
    screen:blit(Player[1].x,Player[1].y,player)
    end

    if Player.nitros == 0 and pad:r() and pad:right() and Player[1].x < screenwidth then
    Player[1].x = Player[1].x - 6
    screen:blit(Player[1].x,Player[1].y,player)
    end

    if Player.nitros == 0 and pad:down() and pad:r() and Player[1].y < screenheight then
    Player[1].y = Player[1].y - 6
    screen:blit(Player[1].x,Player[1].y,player)
    end

    if Player.nitros == 0 and pad:up() and pad:r() and Player[1].y > 0 then
    Player[1].y = Player[1].y + 6
    screen:blit(Player[1].x,Player[1].y,player)
    end

    if pad:square() and Player[1].x >= 348 and Player[1].y <= 57 then
    gamestate.w = "inshop"
    screen:clear()
    screen:blit(0,0,inshop,fa lse)
    screenrint(114,33,"How may I help you today?",red)
    screenrint(114,53,"Press 'X' for Health Items",red)
    screenrint(114,63,"Press 'O' for Nitros Items",blue)
    screenrint(114,73,"Press '[]' for Car Paint and Tuning",green)
    end
    if pad:square() and gamestate.w == "inshop" then
    gamestate.w = "inpaintshop"
    screen:clear()
    screen:blit(0,0,inpaintsh op,false)
    end
    if pad:square() and gamestate.w == "inpaintshop" and cash.money >= 100 then
    gamestate.w = "playerred"
    cash.money = cash.money - 100
    screen:blit(Player[1].x,Player[1].y,playerred)
    if pad:r() and pad:left() and gamestate.w == "playerred" and Player[1].x > 0 then
    Player[1].x = Player[1].x - 10
    end
    if pad:r() and pad:right() and gamestate.w == "playerred" and Player[1].x < screenwidth then
    Player[1].x = Player[1].x + 10
    end
    if pad:r() and pad:down() and gamestate.w == "playerred" and Player[1].y < screenheight then
    Player[1].y = Player[1].y + 10
    end
    if pad:r() and pad:up() and gamestate.w == "playerred" and Player[1].y > 0 then
    Player[1].y = Player[1].y - 10
    end
    else
    if pad:square() and gamestate.w == "inpaintshop" and cash.money < 100 then
    screen:clear(blue)
    screenrint(100,150,"Not enough cash",red)
    screen.waitVblankStart(12 0)
    gamestate.w = "game"
    end
    end
    if pad:circle() and Player[1].x <= 44 and Player[1].y >= 149 then
    gamestate.w = "level1"
    screen:clear(blue)
    Player[1].x = 898 -- this is messed up
    Player[1].y = 900 -- this to
    screenrint(100,200,"Remember to drive safely, you don't want to die!! Press 'X' to begin",red)

    end
    end
    if gamestate.w == "menu" and pad:circle() then
    break end

    screen.flip()
    screen.waitVblankStart()
    end

  14. #2114
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    you have to do somthing like this

    if pad:cross() and gamestate.w == "menu" then
    gamestate.w = "game"
    end

    If gamestate.w == "game" then
    EXstartgame)
    end

    other EX:

    if pad:cross() anf Mainmenu == Menu then
    Mainmenu = game
    end

    if Mainmenu == game the
    (start the game)
    end
    Geändert von ZereoX (05-07-2006 um 07:53 AM Uhr)

  15. #2115
    Points: 4.622, Level: 43
    Level completed: 36%, Points required for next Level: 128
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    36
    Points
    4.622
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    I'm currently exploring the LUA world, and I was wondering if there is a command/a way to jump to certain bits of code in your program?

  16. #2116
    QJ Gamer Blue
    Points: 4.899, Level: 44
    Level completed: 75%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    55
    Points
    4.899
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    that didnt work...

  17. #2117
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    try removing your code from " like

    gamestate.w = "game"

    gamestate.w = game cause whn its in " its like typing a word

  18. #2118
    QJ Gamer Blue
    Points: 4.899, Level: 44
    Level completed: 75%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    55
    Points
    4.899
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    that didnt work either... should i have the menu code outside the main loop, all by it self, or in another seperate loop then the game loop?

  19. #2119
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    actualy in my game my menu is on a other .lua file i just youse the command:

    if pad:cross() and menustatus == 0 then
    Select: play() dofile("game.lua")
    end

    My menu code:
    Code:
    -- Colors
    white = Color.new(255, 255, 255)
    red = Color.new(255, 0, 0)
    -- Image load
    Title = Image.load("images/TitleScreen.png")
    Selector = Image.load("images/Selector.png")
    Select = Sound.load("sounds/Select.wav",false)
    
    --Variable
    menustatus = 0
    Music.volume(128)
    while true do
    
    pad = Controls.read()
    
    screen:blit(0,0,Title)
    
    screen:print(225, 110, "START", white)
    screen:print(225, 120, "CREDITS", white)
    screen:print(225, 130, "EXIT", white)
    
    if pad:up() and oldpad:up() ~= pad:up() then
    menustatus = menustatus-1
    end
    
    if pad:down() and oldpad:down() ~= pad:down() then 
    menustatus = menustatus+1
    end
    
    if menustatus > 2 then
    menustatus = 0
    end
    
    if menustatus < 0 then
    menustatus = 2
    end
    
    if menustatus == 0  then
    screen:print(225, 110, "START", red) screen:blit(200,110,Selector)
    else
    if menustatus == 1  then
    screen:print(225, 120, "CREDITS", red) screen:blit(200,120,Selector)
    else
    if menustatus == 2  then
    screen:print(225, 130, "EXIT", red) screen:blit(200,130,Selector)
    end
    end
    end
    
    if pad:cross() and menustatus == 0 then
    Select:play() dofile("game.lua")
    end
    
    if pad:cross() and menustatus == 1 then
    Select:play() dofile("credits.lua")
    end
    
    if pad:cross() and menustatus == 2 then
    Select:play() 
    break
    end
    end
    
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end
    IM not the best so you shounld aks Grimfate126 or Sousanator or somone else.
    Geändert von ZereoX (05-07-2006 um 09:24 AM Uhr)

  20. #2120
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Wacko`
    I'm currently exploring the LUA world, and I was wondering if there is a command/a way to jump to certain bits of code in your program?
    eh?
    by the way you ask your question, i can tell you need to learn a little more..

    jump to certain bits of your code..

    well, there are these commands called "Functions". Functions are basically user-created codes.

    Like say you want some photos to show in a slide show-esque manner when you press a button. You make a function that does that.

    Code:
    function slide_show() -- Note: there cannot be a space in the function name. hence, "slide_show" instead of "slide show".
    screen:blit(x, y, photo1)
    screen.flip() 
    screen.waitVblankStart(10)
    screen:blit(x, y, photo2)
    screen.flip() 
    screen.waitVblankStart(10)
    screen:blit(x, y, photo3)
    screen.flip() 
    screen.waitVblankStart(10)
    end
    That answer your question?
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  21. #2121
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Wacko`
    I'm currently exploring the LUA world, and I was wondering if there is a command/a way to jump to certain bits of code in your program?
    Nope there aren't any "label" and "goto" commands. I was looking for those too at first, but you'll have to do with functions. Works just as good.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  22. #2122
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    Nope there aren't any "label" and "goto" commands. I was looking for those too at first, but you'll have to do with functions. Works just as good.
    hmm...I'm the one that needs to learn more.
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  23. #2123
    QJ Gamer Blue
    Points: 5.174, Level: 46
    Level completed: 12%, Points required for next Level: 176
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    125
    Points
    5.174
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    ok, back from my lua coding, here a problem, ive been using io.open to wright settings, but the problem , is that it overwright all the file.So i added the rest of the code to the wright process , but there no Enters... only 1 line and another thing is on that setting file i got a line:
    curentcar = "car/driver.txt"
    well... guess what:

    file:write("curcar = "car/driver.txt"")

    i cant put that!

    what shall i do?

  24. #2124
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von agashka
    ok, back from my lua coding, here a problem, ive been using io.open to wright settings, but the problem , is that it overwright all the file.So i added the rest of the code to the wright process , but there no Enters... only 1 line and another thing is on that setting file i got a line:
    curentcar = "car/driver.txt"
    well... guess what:

    file:write("curcar = "car/driver.txt"")

    i cant put that!

    what shall i do?
    i cant help you there...your ahead of me now. Writing and reading files. I'm learning that myself.
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  25. #2125
    QJ Gamer Blue
    Points: 5.174, Level: 46
    Level completed: 12%, Points required for next Level: 176
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    125
    Points
    5.174
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    thats what i tried but well... i thing im gonna see my bookmark and seach for something usefull

  26. #2126
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von agashka
    ok, back from my lua coding, here a problem, ive been using io.open to wright settings, but the problem , is that it overwright all the file.So i added the rest of the code to the wright process , but there no Enters... only 1 line and another thing is on that setting file i got a line:
    curentcar = "car/driver.txt"
    well... guess what:

    file:write("curcar = "car/driver.txt"")

    i cant put that!

    what shall i do?
    ok heres what you do

    Pay attention to the bold print
    Code:
    //to overwrite the whole file//
    file = io.open("yourfile.txt", "w")
    file:write("yourtext")
    file:close()
    
    //to add to the file//
    file = io.open("yourfile.txt", "a")
    file:write("yourtext")
    file:close()
    
    // to read a file//
    file = io.open("yourfile.txt", "r")
    file:read()
    file:close()
    there are more functions like that.. visit www.evilmana.com for more tuts on that kind of stuff

  27. #2127
    TheMarioKarters
    Guest

    Standard

    Zitat Zitat von montrob
    ok heres what you do

    Pay attention to the bold print
    Code:
    //to overwrite the whole file//
    file = io.open("yourfile.txt", "w")
    file:write("yourtext")
    file:close()
    
    //to add to the file//
    file = io.open("yourfile.txt", "a")
    file:write("yourtext")
    file:close()
    
    // to read a file//
    file = io.open("yourfile.txt", "r")
    file:read()
    file:close()
    there are more functions like that.. visit www.evilmana.com for more tuts on that kind of stuff
    Ahh, that's pretty neat. Thanks for that. :)

  28. #2128
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TheMarioKarters
    Ahh, that's pretty neat. Thanks for that. :)
    welcome..

  29. #2129
    QJ Gamer Gold
    Points: 18.627, Level: 86
    Level completed: 56%, Points required for next Level: 223
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    LOLWUT
    Beiträge
    2.625
    Points
    18.627
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    How would you print a variable to a file? Is it that you have to concentrate it with the ..? Because if i were ever to make a game and want to have highscore, I would write it to another file. Example, if i have a gmae and it has a highscore, I want to write that to another file. How would I do that? (I know i asked the same question 20 times....)

  30. #2130
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSPduh
    How would you print a variable to a file? Is it that you have to concentrate it with the ..? Because if i were ever to make a game and want to have highscore, I would write it to another file. Example, if i have a gmae and it has a highscore, I want to write that to another file. How would I do that? (I know i asked the same question 20 times....)
    just a basic way of doing it

    Code:
    -- code here
    
    file = io.open("yourfile.txt", "w")
    if currentscore >= hiscore then
    file:write("currentscore")
    file:close()


 

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 .