Seite 109 von 342 ErsteErste ... 9 59 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 159 209 ... LetzteLetzte
Zeige Ergebnis 3.241 bis 3.270 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; Zitat von Glynnder BTW, thats why the maximum fps you get see on a screen is 60 correct? Yes it ...

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

    Zitat Zitat von Glynnder
    BTW, thats why the maximum fps you get see on a screen is 60 correct?
    Yes it is.



  2. #3242
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von head_54us
    SG57, do you know if the string.gmatch function is implemented in the latest PSP version of Luaplyer. I currently only have access to the Windows version and it doesn't seem to have it.


    Use the millisecond timer and every time you get the number of ms from the timer, divide by 1000 to get the number of seconds.
    i cant display it on the screen tho.. i dunno what the variable is called, i dont really understand the link
    ...Just Returned To The Scene...

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

    Blah = Timer.new() -- Creates a new timer object called Blah. Starts from 0
    Blah:start() -- Starts the timer
    NumberOfMs = Blah:time() -- Gets the number of milliseconds from the timer since the timer started + the start value
    NumberOfSec = math.floor(NumberOfMs /1000) -- Converts from Ms to Secs rounded down.

  4. #3244
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von head_54us
    Blah = Timer.new() -- Creates a new timer object called Blah. Starts from 0
    Blah:start() -- Starts the timer
    NumberOfMs = Blah:time() -- Gets the number of milliseconds from the timer since the timer started + the start value
    NumberOfSec = math.floor(NumberOfMs /1000) -- Converts from Ms to Secs rounded down.
    thanx, so i use number of sec as the variable? and does it stop at 0?
    ...Just Returned To The Scene...

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

    Don't copy and paste that code into your program. I only wrote it to describe how to call and use the functions. You have to apply that knowledge to your code.

  6. #3246
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    timer dont count down:
    Code:
    levelTimer = Timer.new(100000)
    levelTimer:start()
    red = Color.new(255,0,0)
    background = Image.load("cloud.png")
    smiley = Image.load("smile.png")
    sad = Image.load("sad.png")
    math.randomseed(os.time())
    rx = math.random(0,442)
    ry = math.random(0,234)
    boost = 1000
    score = 0
    x = 0
    y = 5
    NumberOfMs = levelTimer:time()
    NumberOfSec = math.floor(NumberOfMs/1000)
    
    function booster()
    if boost < 1 then
    boost = 0
    end
    boost = boost - 1
    end
    
    function CheckBoxCollisionHack()
    	if ((x + 36) > rx) and (x < (rx + 36)) then 
    		if ((y + 36) > ry) and (y < (ry + 36)) then
    			return true
    		end
    	end
    	
    	return false
    end
    
    while true do
    
    screen:clear()
    screen:blit(0,0,background)
    screen:print(0,263,"Press X for SPEED BOOST",red)
    screen:print(0,0,"Boost Left: "..boost ,red)
    screen:print(0,7,"Time: "..NumberOfSec,red)
    screen:blit(x, y, smiley)
    screen:blit(rx, ry, sad)
    ...Just Returned To The Scene...

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

    They count up. These two lines are also incorrect in terms of where you put them in your code
    Code:
    NumberOfMs = levelTimer:time()
    NumberOfSec = math.floor(NumberOfMs/1000)

  8. #3248
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von head_54us
    They count up. These two lines are also incorrect in terms of where you put them in your code
    Code:
    NumberOfMs = levelTimer:time()
    NumberOfSec = math.floor(NumberOfMs/1000)
    how the hell do i get it to count down? i got it to count up now...
    ...Just Returned To The Scene...

  9. #3249
    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:
    TotalTimeLimit = 100000
    
    -- Later on in your code
    NumberOfMs = levelTimer:time()
    NumberOfSec = math.floor(NumberOfMs/1000)
    TimeLeft = TotalTimeLimit - NumberOfSecs
    Seriously, these are really simple abstract problems that you should be able to solve yourself.

  10. #3250
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von head_54us
    Code:
    TotalTimeLimit = 100000
    
    -- Later on in your code
    NumberOfMs = levelTimer:time()
    NumberOfSec = math.floor(NumberOfMs/1000)
    TimeLeft = TotalTimeLimit - NumberOfSecs
    Seriously, these are really simple abstract problems that you should be able to solve yourself.
    total time limit has to be 200, 10000 makes the time go to 9999 and count down.
    i wanted it at 100 and down
    problem i solved myself :P
    ...Just Returned To The Scene...

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

    That's because you start the timer right at the start of your code, by the time the time left has started, the PSP has already spent 1sec loading in graphics and getting to the main loop.

    Edit: Oh you meant you wanted 100 seconds. Nevermind then.

  12. #3252
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    now i need to make the hi score save if its higher than the current hi score, how does this work?
    -= Double Post =-
    also, whats wrong with this:
    Code:
    if TimeLeft < 1 then
    screen:clear
    screen:print(200,135,"Game Over, Your score was: "..score,red)
    end
    g2g for lunch now.. ill check back here l8r for answers.
    Geändert von JaSo PsP (08-17-2006 um 02:50 AM Uhr) Grund: Automerged Doublepost
    ...Just Returned To The Scene...

  13. #3253
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    jaso you need a parentheses after the screen:clear so it looks like this screen:clear() and for the hi-score do something like this


    if highscore < score then
    highscore = score
    end

  14. #3254
    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 mark.sparky
    jaso you need a parentheses after the screen:clear so it looks like this screen:clear() and for the hi-score do something like this


    if highscore < score then
    highscore = score
    end
    wouldnd it be:
    Code:
    if highscore > score then
    highscore = score
    end
    but i guess it depends.
    --------------------------------------------------------------------------------------

  15. #3255
    Rock Star
    Points: 70.899, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    CT| FW: 4.01 M33-2
    Beiträge
    11.844
    Points
    70.899
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    wouldnd it be:
    Code:
    if highscore > score then
    highscore = score
    end
    but i guess it depends.
    No, because then if the high score was greater than the score, the high score would be changed to the lower score.


  16. #3256
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    no because that would be

    if highscore is less than score then
    highscore equals score
    end

    which doesnt make any sense

  17. #3257
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    wouldnd it be:
    Code:
    if highscore > score then
    highscore = score
    end
    but i guess it depends.
    it still wouldnt save it, when i reset the game, the high score will go down to nil, i want it so it writes the high score to a file. also how would i read the contents of that file? (anyone who helps me will go down on a list of all the people that have helped me and they will get some credit for the finished game)
    ...Just Returned To The Scene...

  18. #3258
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von JaSo PsP
    it still wouldnt save it, when i reset the game, the high score will go down to nil, i want it so it writes the high score to a file. also how would i read the contents of that file? (anyone who helps me will go down on a list of all the people that have helped me and they will get some credit for the finished game)
    write contents

    score = io.open("score.txt","w")
    score:write(highscore)
    score:close()

    read

    highscore = io.open("score.txt","r")
    thehighscore = highscore:read()
    highscore:close()

    With the read function, the variable "thehighscore" is you high score read from the file.

  19. #3259
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    this works by the way:
    Code:
    if TimeLeft < 1 then
    levelTimer:stop()
    screen:clear()
    screen:print(200,100,"Game Over, Your Score was: "..score,red)
    end
    -= Double Post =-
    Zitat Zitat von Access_Denied
    write contents

    score = io.open("score.txt","w")
    score:write(highscore)
    score:close()

    read

    highscore = io.open("score.txt","r")
    thehighscore = highscore:read()
    highscore:close()

    With the read function, the variable "thehighscore" is you high score read from the file.
    thanx, this game is so near completion. ill submit it soon.

    ps: what does the w and r mean on the io open brackets?

    hi score works now
    Geändert von JaSo PsP (08-17-2006 um 08:12 AM Uhr) Grund: Automerged Doublepost
    ...Just Returned To The Scene...

  20. #3260
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von JaSo PsP
    this works by the way:
    Code:
    if TimeLeft < 1 then
    levelTimer:stop()
    screen:clear()
    screen:print(200,100,"Game Over, Your Score was: "..score,red)
    end
    -= Double Post =-


    thanx, this game is so near completion. ill submit it soon.

    ps: what does the w and r mean on the io open brackets?

    hi score works now
    The "w" means write and the "r" means read

    Go to evilmana.com and look at thier tutorial on reading and writing files. It'll give you a whole list of functions like that.

  21. #3261
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    the w means write and the r means read but watch out because w means to overwite what was in that file and a means to write after what was already there

  22. #3262
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mark.sparky
    the w means write and the r means read but watch out because w means to overwite what was in that file and a means to write after what was already there
    He wants the "w" though, because he wants to write over the existing high score.

  23. #3263
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    i know i was just telling him in case he wanted to know.

    Anway on to my problem. What is wrong with this code because the all the barricades appear at once and the score goes straight to the highest


    Code:
    function firstLevel()
    level1 = math.random( 1,60)
    if level1 == 24 then
    barricade[1].pic = true
    barricade[2].pic = false
    barricade[3].pic = false
    barricade[4].pic = false
    barricade[5].pic = false
    barricade[6].pic = false
    end
    if level1 == 49 then
    barricade[1].pic = false
    barricade[2].pic = true
    barricade[3].pic = false
    barricade[4].pic = false
    barricade[5].pic = false
    barricade[6].pic = false
    end
    if level1 == 1 then
    barricade[1].pic = false
    barricade[2].pic = false
    barricade[3].pic = true
    barricade[4].pic = false
    barricade[5].pic = false
    barricade[6].pic = false
    end
    if level1 == 15 then
    barricade[1].pic = false
    barricade[2].pic = false
    barricade[3].pic = false
    barricade[4].pic = true
    barricade[5].pic = false
    barricade[6].pic = false
    end
    if level1 == 59 then
    barricade[1].pic = false
    barricade[2].pic = false
    barricade[3].pic = false
    barricade[4].pic = false
    barricade[5].pic = true
    barricade[6].pic = false
    end
    if level1 == 33 then
    barricade[1].pic = true
    barricade[2].pic = false
    barricade[3].pic = false
    barricade[4].pic = false
    barricade[5].pic = false
    barricade[6].pic = true
    end
    if barricade[1].pic == true then
    barricade[1].lane = true
    end
    if barricade[1].lane == true then
    screen:blit( barricade[1].x, barricade[1].y, barricade1)
    barricade[1].x = barricade[1].x - 0.25
    end
    if barricade[1].x == 0 then
    barricade[1].lane = false
    end
    if barricade[2].pic == true then
    barricade[2].lane = true
    end
    if barricade[2].lane == true then
    screen:blit( barricade[2].x, barricade[2].y, barricade1)
    barricade[2].x = barricade[2].x - 0.25
    end
    if barricade[2].x == 0 then
    barricade[2].lane = false
    end
    if barricade[3].pic == true then
    barricade[3].lane = true
    end
    if barricade[3].lane == true then
    screen:blit( barricade[3].x, barricade[3].y, barricade1)
    barricade[3].x = barricade[3].x - 0.25
    end
    if barricade[3].x == 0 then
    barricade[3].lane = false
    end
    if barricade[4].pic == true then
    barricade[4].lane = true
    end
    if barricade[4].lane == true then
    screen:blit( barricade[4].x, barricade[4].y, barricade1)
    barricade[4].x = barricade[4].x - 0.25
    end
    if barricade[4].x == 0 then
    barricade[4].lane = false
    end
    if barricade[5].pic == true then
    barricade[5].lane = true
    end
    if barricade[5].lane == true then
    screen:blit( barricade[5].x, barricade[5].y, barricade1)
    barricade[5].x = barricade[5].x - 0.25
    end
    if barricade[5].x == 0 then
    barricade[5].lane = false
    end
    if barricade[6].pic == true then
    barricade[6].lane = true
    end
    if barricade[6].lane == true then
    screen:blit( barricade[6].x, barricade[6].y, barricade1)
    barricade[6].x = barricade[6].x - 0.25
    end
    if barricade[6].x == 0 then
    barricade[6].lane = false
    end
    if lane == 0 and barricade[1].x <= (player[1].x + player[1].width) then
    player[1].life = player[1].life - 1
    barricade[1].x = 0
    end
    if lane == 1 and barricade[2].x <= (player[1].x + player[1].width) then
    player[1].life = player[1].life - 1
    barricade[1].x = 0
    end
    if lane == 2 and barricade[3].x <= (player[1].x + player[1].width) then
    player[1].life = player[1].life - 1
    barricade[1].x = 0
    end
    if lane == 3 and barricade[4].x <= (player[1].x + player[1].width) then
    player[1].life = player[1].life - 1
    barricade[1].x = 0
    end
    if lane == 4 and barricade[5].x <= (player[1].x + player[1].width) then
    player[1].life = player[1].life - 1
    barricade[1].x = 0
    end
    if lane == 5 and barricade[6].x <= (player[1].x + player[1].width) then
    player[1].life = player[1].life - 1
    barricade[1].x = 0
    end
    if lane ~= 0 and barricade[1].x <= (player[1].x + player[1].width) then
    player[1].score = player[1].score + 2
    player[1].lifescore = player[1].lifescore + 2
    barricade[1].x = 0
    if highscore < player[1].score then
    highscore = highscore + 2
    end
    end
    if lane ~= 1 and barricade[2].x <= (player[1].x + player[1].width) then
    player[1].score = player[1].score + 2
    player[1].lifescore = player[1].lifescore + 2
    barricade[1].x = 0
    if highscore < player[1].score then
    highscore = highscore + 2
    end
    end
    if lane ~= 2 and barricade[3].x <= (player[1].x + player[1].width) then
    player[1].score = player[1].score + 2
    player[1].lifescore = player[1].lifescore + 2
    barricade[1].x = 0
    if highscore < player[1].score then
    highscore = highscore + 2
    end
    end
    if lane ~= 3 and barricade[4].x <= (player[1].x + player[1].width) then
    player[1].score = player[1].score + 2
    player[1].lifescore = player[1].lifescore + 2
    barricade[1].x = 0
    if highscore < player[1].score then
    highscore = highscore + 2
    end
    end
    if lane ~= 4 and barricade[5].x <= (player[1].x + player[1].width) then
    player[1].score = player[1].score + 2
    player[1].lifescore = player[1].lifescore + 2
    barricade[1].x = 0
    if highscore < player[1].score then
    highscore = highscore + 2
    end
    end
    if lane ~= 5 and barricade[6].x <= (player[1].x + player[1].width) then
    player[1].score = player[1].score + 2
    player[1].lifescore = player[1].lifescore + 2
    barricade[1].x = 0
    if highscore < player[1].score then
    highscore = highscore + 2
    end
    end
    if player[1].lifescore == 40 then
    player[1].life = player[1].life + 1
    player[1].lifescore = 0
    end
    end

  24. #3264
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    i get an error with this... i was so close to releasing the game...
    Code:
    if TimeLeft < 1 then
    levelTimer:stop()
    screen:clear()
    if score > theHighScore then --this line brings up error
    writeHiScore()
    end
    screen:print(150,100,"Game Over, Your Score was: "..score,red)
    end
    
    this line works with thehighscore??:
    screen:print(270,263,"Hi Score: "..theHighScore,red)
    the error message says cant compare number with string but they are both variables!!??
    ...Just Returned To The Scene...

  25. #3265
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von JaSo PsP
    i get an error with this... i was so close to releasing the game...
    Code:
    if TimeLeft < 1 then
    levelTimer:stop()
    screen:clear()
    if score > thehighscore then --this line brings up error
    writeHiScore()
    end
    screen:print(150,100,"Game Over, Your Score was: "..score,red)
    end
    What's the error?

  26. #3266
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Access_Denied
    What's the error?
    cant compare string with number but they are both variables? or, it doesnt recognice the hiscore in the txt document as a number? how can i sort this out?
    ...Just Returned To The Scene...

  27. #3267
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    a string is usually a line of characters (a.b.c.d. ect...) Also where are you declaring those two variables? That could be the problem as well

  28. #3268
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    You need if score < thehighscore then instead of if score > thehighscore then and also have you put

    file = io.open("the highscore file","w")
    file:write(thehighscore)
    file:close()

    in the code and just to tell you < is less than and > is greater than

  29. #3269
    QJ Gamer Green
    Points: 9.165, Level: 64
    Level completed: 39%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    England ~¦¦¦|+|¦¦¦~
    Beiträge
    1.112
    Points
    9.165
    Level
    64
    My Mood
    Bored
    Downloads
    0
    Uploads
    0

    Standard

    these are the variables at the start. theres nothing wrong cos it can display them in the game:
    Code:
    highscore = io.open("hiscore.txt","r")
    theHighScore = highscore:read() --this is where it reads the file, it doesnt read it as a number
    score = 0
    -= Double Post =-
    Zitat Zitat von mark.sparky
    You need if score < thehighscore then instead of if score > thehighscore then and also have you put

    file = io.open("the highscore file","w")
    file:write(thehighscore)
    file:close()

    in the code and just to tell you < is less than and > is greater than
    yer, it cant read the info in the document as a number, help!
    Geändert von JaSo PsP (08-17-2006 um 08:57 AM Uhr) Grund: Automerged Doublepost
    ...Just Returned To The Scene...

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

    u probably declared the value of either "score" or "theHighScore" as a string.

    post the code where u declare the vars.
    --------------------------------------------------------------------------------------


 

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

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