Seite 263 von 342 ErsteErste ... 163 213 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 313 ... LetzteLetzte
Zeige Ergebnis 7.861 bis 7.890 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; Ok thanks i will try this - but this only checks if the file exists, right? I'm trying to make ...

  
  1. #7861
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Ok thanks i will try this - but this only checks if the file exists, right? I'm trying to make sure that the image can actually be used (ie. PNG's over 512x512)



    http://www.yongobongo.com
    PSN - yongobongo

  2. #7862
    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 Yongobongo
    Ok thanks i will try this - but this only checks if the file exists, right? I'm trying to make sure that the image can actually be used (ie. PNG's over 512x512)
    i never did this before, but looking at this list, i'd say this is how to do it:

    Code:
    test = Image.load("test.png")
    testX = test.width()
    testY = test.height()
    
    if testX*testY >= 512*512 then
    [blah blah]
    end
    please correct if i am wrong though

  3. #7863
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    if the image can't be loaded then using Image.load on it will cause the script to break and show the error message, but from what I understand what Yongo wants to do is check to see if an image can be loaded in order to avoid having Image.load break the script

    There are two ways that I can see for doing this. The first would be to do research on the format of the .png header and write a function that could open it as a data file to read the image dimensions and other stuff from the header. The second would be to get into the lua player source and either add a new function to check if the image can be loaded, or else change the Image.load function to prevent it from throwing the error

  4. #7864
    QJ Gamer Blue
    Points: 3.726, Level: 38
    Level completed: 51%, Points required for next Level: 74
    Overall activity: 27,0%

    Registriert seit
    Jun 2007
    Beiträge
    82
    Points
    3.726
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    O.k. I've put the code to recall the random numbers after the correct/incorrect message is shown. Now there is a random bug where I only press the button once, but I get about 2-5 incorrect/correct messages. E.G. I could press left once but the screen shows correct then correct then incorrect then correct again.

    PS The code is the same except after scren.flip() i've added RanNumber = math.random(1,11)

    PPS If anyone doesn't know what code i'm talking about go to page 784. It isn't hard to find. ;)

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

    Your problem is that the button is being pressed for more than one loop. You could use timers, and pause it after a question, or you could use this:

    Code:
    oldpad = Controls.read()
    
    while true do
    	pad = Controls.read()
    
    	if (pad:left() ~= oldpad:left()) and pad:left() then
    		bla bla bla
    	end
    
    	oldpad = pad
    end

    P.S. Can anyone point me to a non-pixel based, circle-rectangle collision algorithm that works with a diagonal rectangle? It would save me some time.

  6. #7866
    QJ Gamer Blue
    Points: 3.726, Level: 38
    Level completed: 51%, Points required for next Level: 74
    Overall activity: 27,0%

    Registriert seit
    Jun 2007
    Beiträge
    82
    Points
    3.726
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie
    Your problem is that the button is being pressed for more than one loop. You could use timers, and pause it after a question, or you could use this:

    Code:
    oldpad = Controls.read()
    
    while true do
    	pad = Controls.read()
    
    	if (pad:left() ~= oldpad:left()) and pad:left() then
    		bla bla bla
    	end
    
    	oldpad = pad
    end

    P.S. Can anyone point me to a non-pixel based, circle-rectangle collision algorithm that works with a diagonal rectangle? It would save me some time.
    I've tried putting in what you suggested but it doesn't make a difference.

    [EDIT]
    I've decided to remake the game from scratch. I've keep getting bug after bug after bug and it's completely useless.

    [EDIT]
    I've redone the code. I now have an error saying bad argument #1 to 'len' (string expected, got nil). Any ideas how to fix this?

    Code:
    math.randomseed(os.time());
    
    NUM_QUESTIONS = 12
    NUM_ANSWERS = 12
    
    question = {}
    
    question[1] = { name = "What countries did Vikings originate from?", answer = {"A: Germany, England and Iceland","B: Greenland, Germany and Iceland","C: Denmark, Sweden and Norway","D: Iceland, Sweden, Norway"}, correctAnswer = 3 }
    question[2] = { name = "Why did the Vikings originally travel to other countries?", answer = {"A: To trade","B: To plunder","C: To kill","D: To sieze power"}, correctAnswer = 1 }
    question[3] = { name = "Vikings had a reputation for being what in battle?", answer = {"A: Couragous","B: Random","C: Strong","D: Skilled"}, correctAnswer = 4 }
    question[4] = { name = "What weapons were used by the Vikings?", answer = {"A: Bows, Rifles and Swords","B: Sword, Double-Axe and Spear","C: Cannons, Arrows and Bows","D: Sword, Arrows and Canons"}, correctAnswer = 2 }
    question[5] = { name = "What was the common name of the plague in medieval Europe?", answer = {"A: Black Plague","B: Dark Plague","C: Black Death","D: Bubonic Death"}, correctAnswer = 3 }
    question[6] = { name = "How long did the Hundred Years' War last?", answer = {"A: 100","B: 116","C: 84","D: 136"}, correctAnswer = 2 }
    question[7] = { name = "What spread the Bubonic Plague?", answer = {"A: Rats","B: Ticks","C: Fleas","D: Beavers"}, correctAnswer = 3 }
    question[8] = { name = "What objects were Vikings buried in?", answer = {"A: Their Ships","B: Graves","C: Crypts","D: Their Homes"}, correctAnswer = 1 }
    question[9] = { name = "What was another name for Vikings", answer = {"A: Plunderers","B: Norsemen","C: Wolfmen","D: They didn't have other names"}, correctAnswer = 2 }
    question[10] = { name = "What countries did Vikings originate from?", answer = {"A: Denmark, Sweden and Norway","B: Greenland, Iceland and Norway","C: Iceland, Germany and Norway","D: Germany, England and Iceland"}, correctAnswer = 1 }
    question[11] = { name = "Knights fought on what?", answer = {"A: Slaves","B: Cows","C: Horses","D: Their Feet"}, correctAnswer = 3 }
    question[12] = { name = "What 4 empires existed prior to the Dark Ages?", answer = {"A: Roman, Persian, English and American","B: Roman, Guptan, Persian and Barbarian","C: Japanese, Chinese, Guptan and Roman","D: Roman, Guptan, Persian and Chinese"}, correctAnswer = 4 }
    
    function printCentered(y,text,color)
    local length = string.len(text)
    local x = 240 - ((length*8)/2)
    screen:print(x,y,text,color)
    end
    
    currentQuestion = math.random(1, NUM_QUESTIONS)
    
    correct = 0
    incorrect = 0
    
    oldQuestion = 0
    oldpad = Controls.read()
    
    
    
    while true do
        pad = Controls.read()
    
        if oldpad ~= pad then
            if pad:left() then
                if question[currentQuestion].correctAnswer == 1 then
                    correct = correct + 1
                else
                    incorrect = incorrect + 1
                end
                
                oldQuestion = currentQuestion
                while currentQuestion == oldQuestion do
                    currentQuestion = math.random(1,12)
                end
            elseif pad:right() then
                if question[currentQuestion].correctAnswer == 2 then
                    correct = correct + 1
                else
                    incorrect = incorrect + 1
                end
    
                oldQuestion = currentQuestion
                while currentQuestion == oldQuestion do
                    currentQuestion = math.random(1,12)
                end
            elseif pad:square() then
                if question[currentQuestion].correctAnswer == 3 then
                    correct = correct + 1
                else
                    incorrect = incorrect + 1
                end
    
                oldQuestion = currentQuestion
                while currentQuestion == oldQuestion do
                    currentQuestion = math.random(1,12)
                end
            elseif pad:circle() then
                if question[currentQuestion].correctAnswer == 4 then
                    correct = correct + 1
                else
                    incorrect = incorrect + 1
                end
    
                oldQuestion = currentQuestion
                while currentQuestion == oldQuestion do
                    currentQuestion = math.random(1,12)
                end
            end
        end
    
        oldpad = pad
    
        screen:clear()
    
        if correct + incorrect == 50 then
           break
        end
    
        printCentered(140,question[currentQuestion].name, Color.new(255,255,255))
    
        for i=1,NUM_ANSWERS do
            printCentered(160 + i*15,question[currentQuestion].answer[i], Color.new(200,200,200))
        end
    
        printCentered(10,"Correct:  " .. correct .. "                                 Incorrect:  " .. incorrect, Color.new(255,255,255))
    
        screen.waitVblankStart()
        screen.flip()
    end
    Geändert von drag_93 (08-05-2007 um 09:54 PM Uhr)

  7. #7867
    Points: 3.059, Level: 34
    Level completed: 6%, Points required for next Level: 141
    Overall activity: 32,0%

    Registriert seit
    Aug 2007
    Beiträge
    1
    Points
    3.059
    Level
    34
    Downloads
    0
    Uploads
    0

    Standard

    I made lua program, now I want to know How I can make EBOOT from my lua program. It isn't very funny to start lua player every time, before starts my program.
    I am sorry for my bad english.

  8. #7868
    QJ Gamer Blue
    Points: 3.726, Level: 38
    Level completed: 51%, Points required for next Level: 74
    Overall activity: 27,0%

    Registriert seit
    Jun 2007
    Beiträge
    82
    Points
    3.726
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ISO-B
    I made lua program, now I want to know How I can make EBOOT from my lua program. It isn't very funny to start lua player every time, before starts my program.
    I am sorry for my bad english.
    To compile an eboot you need cygwin (linux emulator for windows) and psptoolchain. However, because you used Lua as a programming language, you can't compile it into an eboot file.

  9. #7869
    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

    @drag_93: NUM_ANSWERS should be 4.
    P.S. Save some space:
    Code:
        if oldpad ~= pad then
            if pad:left() then
    		answer = 1
            elseif pad:right() then
    		answer = 2
            elseif pad:square() then
    		answer = 3
            elseif pad:circle() then
    		answer = 4
    
            end
        end
    
    	if question[currentQuestion].correctAnswer == answer then
    		correct = correct + 1
    		oldQuestion = currentQuestion
    		while currentQuestion == oldQuestion do
    			currentQuestion = math.random(1,12)
    		end
    		answer = 0
    	elseif answer ~= 0 then
    		incorrect = incorrect + 1
    		oldQuestion = currentQuestion
    		while currentQuestion == oldQuestion do
    			currentQuestion = math.random(1,12)
    		end
    		answer = 0
    	end
    @ISO-B: See http://www.forums.evilmana.com/index.php?topic=861.0
    Geändert von Nielkie (08-06-2007 um 10:23 PM Uhr)

  10. #7870
    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 drag_93
    To compile an eboot you need cygwin (linux emulator for windows) and psptoolchain. However, because you used Lua as a programming language, you can't compile it into an eboot file.
    You can make an EBOOT file that runs LUA scripts. Not sure how though.
    ...Just Returned To The Scene...

  11. #7871
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    Theres a few ways. If you know C, you can program a 'lua player' that has converted all of the lua scrip to Lua commands within the app so it's completely unknown as you'd have to reverse engineer the EBOOT. the other method is embedding the Lua script iwthin the eboot which has been done but is still readable via opening the EBOOT. Not sure what oyu want to compile it for however.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


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

    but then again, if you have no clue what you are doing really, you could do this (the easiest method i believe there is):

    delete applications folder and everything in it. go to system, delete library folder. copy and paste everything from your game in the main luaplayer folder. rename the folders to whatever you want "name" and "name%" and there you go. :)

    theres an app that allows you to modify the eboot, but i dont know it. as long as the eboot remains like it is, it'll come up as 'luaplayer' in the xmb but it will actually be your creation.

  13. #7873
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    yes eminent is right, thats the easiest way. what you need to change what the eboot says and looks like is PSPBrew i think, i will check real quick and then send a link here
    -= Double Post =-
    okay it is, here is the link
    Geändert von emericaska8r (08-07-2007 um 07:40 AM Uhr) Grund: Automerged Doublepost

  14. #7874
    QJ Gamer Blue
    Points: 4.371, Level: 42
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Co. Dublin, Eire
    Beiträge
    137
    Points
    4.371
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    I have a problem with my menu.
    Basically i have an image with three options on it, and i have an image for an arrow to display which one is highlighted.

    I can and have the code for just the arrow to move between each option by pressing up/down, but i want to go a bit more advanced. i want the arrow to move slightly from side to side like

    in first half second
    ->
    2nd:
    . ->
    3rd
    ... -> [ignoring the full stops]
    and back then and repeat that.
    so i made a nother integer , arrow1 (one signifying that it's highlighting the 1st option) and thin int can be 1,2 or 3 which displays it moving.

    Only problem is it doesnt work, the menu gets glitchy and gets linely in places


    PHP-Code:

    oldpad 
    Controls.read()
    screen:clear()
    menu Image.load("menu.png")
    arrow Image.load("arrow.jpg")
    intmenu 

        
    while true do
        
    pad Controls.read() 


    if 
    pad:down() and oldpad:down() ~= pad:down() then 
    intmenu 
    intmenu 1
    end 

    if pad:up() and oldpad:up() ~= pad:up() then 
    intmenu 
    intmenu 
    end 
     
    if intmenu >= 4 then 
    intmenu 

    end 

    if intmenu <= 0 then 
    intmenu 

    end 

    if intmenu == 1 then 


    arrow1 

    screen
    .waitVblankStart(3)
    arrow1 arrow1 1
    if arrow1 >= 4 then 
    arrow1 

    end 

    if arrow1 <= 0 then 
    arrow1 

    end 
        

        
    if arrow1 == 1 then    
        screen
    :clear()

     
    screen:blit(00menu)

        
    screen:blit(3105arrow)

    end
        
    if arrow1 == 2 then
        screen
    :clear() 

        
    screen:blit(2105arrow)
    end
        
    if arrow1 == 3 then
        screen
    :clear() 

        
    screen:blit(1105arrow)
    end
    screen
    :flip() 

            if 
    pad:cross() then
            dofile
    ("character.lua")
            
    end

    end 



    if intmenu == 2 then 

            screen
    :clear()
            
    screen:blit(00menu)
            
    screen:blit(3172arrow

        if 
    pad:cross() then
        dofile
    ("credits.lua")
        
    end

    end 


    if intmenu == 3 then 

            screen
    :clear() 
            
    screen:blit(00menu)
            
    screen:blit(3240arrow

        if 
    pad:cross() then
        dofile
    ("credits.lua")
        
    end

    end



    screen
    :flip() 
    oldpad pad
    end 
    I've only tried it for the first option, i hope to have arrow2 and 3 ints if i can get the 1st one to work
    I have a feeling that i have a blit in the wrong places but tried different ways and didnt work properly

    Anyone see a problem(s)??
    Geändert von DtotheK (08-07-2007 um 08:56 AM Uhr)

  15. #7875
    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

    i havent really looked too much into the code, but try defining arrow1 outside all if statements. (and loops.) instead of in a while statement, like it is now.
    --------------------------------------------------------------------------------------

  16. #7876
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von DtotheK
    I have a problem with my menu.
    Basically i have an image with three options on it, and i have an image for an arrow to display which one is highlighted.

    I can and have the code for just the arrow to move between each option by pressing up/down, but i want to go a bit more advanced. i want the arrow to move slightly from side to side like

    in first half second
    ->
    2nd:
    . ->
    3rd
    ... -> [ignoring the full stops]
    and back then and repeat that.
    so i made a nother integer , arrow1 (one signifying that it's highlighting the 1st option) and thin int can be 1,2 or 3 which displays it moving.

    Only problem is it doesnt work, the menu gets glitchy and gets linely in places


    PHP-Code:

    oldpad 
    Controls.read()
    screen:clear()
    menu Image.load("menu.png")
    arrow Image.load("arrow.jpg")
    intmenu 

        
    while true do
        
    pad Controls.read() 


    if 
    pad:down() and oldpad:down() ~= pad:down() then 
    intmenu 
    intmenu 1
    end 

    if pad:up() and oldpad:up() ~= pad:up() then 
    intmenu 
    intmenu 
    end 
     
    if intmenu >= 4 then 
    intmenu 

    end 

    if intmenu <= 0 then 
    intmenu 

    end 

    if intmenu == 1 then 


    arrow1 

    screen
    .waitVblankStart(3)
    arrow1 arrow1 1
    if arrow1 >= 4 then 
    arrow1 

    end 

    if arrow1 <= 0 then 
    arrow1 

    end 
        

        
    if arrow1 == 1 then    
        screen
    :clear()

     
    screen:blit(00menu)

        
    screen:blit(3105arrow)

    end
        
    if arrow1 == 2 then
        screen
    :clear() 

        
    screen:blit(2105arrow)
    end
        
    if arrow1 == 3 then
        screen
    :clear() 

        
    screen:blit(1105arrow)
    end
    screen
    :flip() 

            if 
    pad:cross() then
            dofile
    ("character.lua")
            
    end

    end 



    if intmenu == 2 then 

            screen
    :clear()
            
    screen:blit(00menu)
            
    screen:blit(3172arrow

        if 
    pad:cross() then
        dofile
    ("credits.lua")
        
    end

    end 


    if intmenu == 3 then 

            screen
    :clear() 
            
    screen:blit(00menu)
            
    screen:blit(3240arrow

        if 
    pad:cross() then
        dofile
    ("credits.lua")
        
    end

    end



    screen
    :flip() 
    oldpad pad
    end 
    I've only tried it for the first option, i hope to have arrow2 and 3 ints if i can get the 1st one to work
    I have a feeling that i have a blit in the wrong places but tried different ways and didnt work properly

    Anyone see a problem(s)??
    Way to many screen:clear() calls, only use one right at the start of your loop and just make sure you build your screen image in the correct order. also you shouldn't have to make new variables for the cursor movement... use the same one. Try to find the algorithms in everything you do, keeps your code a lot cleaner and easier to debug. For instance
    Code:
    menu = {}
    menu.selection = 1
    menu.max = 3
    menu.rowHeight = 70
    menu.cursor = image.load(<IMAGE>)
    menu.cursorSwayMax = 5
    menu.cursorSway = 0
    
    while true do
    screen:clear()
    pad = Controls.read()
    if pad:up() then
        menu.selection = menu.selection - 1
        if menu.selection <= 0 then
            menu.selection = menu.max
        end if
    end if
    if pad:down() then
        menu.selection = menu.selection + 1
        if menu.selection > menu.max then
            menu.selection = 1
        end if
    end if
    
    if menu.cursorSwayMax > 0 then
        menu.cursorSway = menu.cursorSway + 1
    else
        menu.cursorSway = menu.cursorSway - 1
    end if
    if menu.cursorSway == menu.cursorSwayMax then
        menu.cursorSwayMax = menu.cursorSwayMax * -1
    end if
    
    screen:blit(10 - menu.cursorSway, menu.rowHeight*menu.selection, menu.cursor)
    screen.flip()
    end
    anyways, you get the jist (written out of memory so I appologize for any slight syntax errors). If you keep it all in tables it makes it alot easier to unload when switching between game modes to free up memory.
    Geändert von KleptoOne (08-07-2007 um 10:54 PM Uhr)

  17. #7877
    QJ Gamer Blue
    Points: 4.371, Level: 42
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Co. Dublin, Eire
    Beiträge
    137
    Points
    4.371
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    yes! works and looks great! just a few lines needed slight changing, and i'll change the control detection thing cause when you hold down/up down it flys through the options like mad. and i'll stick in the actual backround of the menu.

    Thankyou !!!
    i'll post up the code when i fix it up incase anyone wants it.
    -= Double Post =-
    here it is, works perfectly!
    just have to match up the heights of option and arrow
    and what to do when menu.selection = 1,2 and 3!

    PHP-Code:
    oldpad Controls.read()
    menu = {}
    menu.selection 1
    menu
    .max 3
    menu
    .rowHeight 70
    menu
    .cursor Image.load("arrow.jpg")
    menu.back Image.load("menu.png")
    menu.cursorSwayMax 5
    menu
    .cursorSway 0

        
    while true do
        
    screen:clear()

        while 
    true do
        
    pad Controls.read() 

    if 
    pad:up() and oldpad:up() ~= pad:up() then
        menu
    .selection menu.selection 1
    end 

    if menu.selection <= 0 then
        menu
    .selection menu.max
    end

    if pad:down() and oldpad:down() ~= pad:down() then 
        menu
    .selection menu.selection 1

    end    

    if menu.selection menu.max then
        menu
    .selection 1
    end

    if menu.cursorSwayMax 0 then
        menu
    .cursorSway menu.cursorSway 1
    else
        
    menu.cursorSway menu.cursorSway 1
    end
    if menu.cursorSway == menu.cursorSwayMax then
        menu
    .cursorSwayMax menu.cursorSwayMax * -1
    end
    screen
    :blit(00menu.back)
    screen:blit(10 menu.cursorSwaymenu.rowHeight*menu.selectionmenu.cursor)
    screen.flip()
    oldpad pad
    end
    end 
    :Punk:
    Geändert von DtotheK (08-08-2007 um 12:55 PM Uhr) Grund: Automerged Doublepost

  18. #7878
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    does anyone know if there is a do-while loop in lua? if so how would you construct it. i have been looking and couldn't find it so i figured i'd ask here.

  19. #7879
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von emericaska8r
    does anyone know if there is a do-while loop in lua? if so how would you construct it. i have been looking and couldn't find it so i figured i'd ask here.
    Code:
    repeat
        <code>
    until condition
    Learn basic lua syntax here:
    Program in Lua

  20. #7880
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    DtotheK:

    whats the real point of this:

    while true do
    screen:clear()

    while true do
    pad = Controls.read()

    ??????????????????? o_O

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

    to the point i would like to know how i would go about creating my own font or getting one that is curretly available could someone please help if they know

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

  22. #7882
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    at the top of this page it will tell you how to make or load an existing font. Then, to use this font use:
    Code:
    screen:fontPrint( font, x, y, string, color )

  23. #7883
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    but its very slow... you will see yourself ;)

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

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

    thanks that helped a load
    ------ 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).

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

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

    Standard

    No problem (if that was directed to me).

  27. #7887
    QJ Gamer Blue
    Points: 4.371, Level: 42
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Co. Dublin, Eire
    Beiträge
    137
    Points
    4.371
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    DtotheK:

    whats the real point of this:

    while true do
    screen:clear()

    while true do
    pad = Controls.read()

    ??????????????????? o_O
    i dunno bout the first 2 lines , they were in the code for the swaying arrows i gas given, and i never removed them, but it works fine with them so i just left them in for no reason...

    and the 2 last lines as far as i knew are necessary to keep checking what controls are pressed, and are in all the tutorials i have read as far as i remember..... and the code works with them there!
    but now that you question them...

  28. #7888
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von DtotheK
    i dunno bout the first 2 lines , they were in the code for the swaying arrows i gas given, and i never removed them, but it works fine with them so i just left them in for no reason...

    and the 2 last lines as far as i knew are necessary to keep checking what controls are pressed, and are in all the tutorials i have read as far as i remember..... and the code works with them there!
    but now that you question them...
    They were not in the original code. Go back a page and read carefully, it should be
    Code:
    while true do
        screen:clear()
        pad = Controls.read()
    
    ...rest of code
    The way it is now, you are actually never calling screen:clear() but your background is hiding your old screen every cycle so it still works fine, but if you were to break the inner loop (for program exit as an example) you'll be stuck in an infinite black screen loop, so be careful.

  29. #7889
    QJ Gamer Blue
    Points: 4.371, Level: 42
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Co. Dublin, Eire
    Beiträge
    137
    Points
    4.371
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von KleptoOne
    They were not in the original code. Go back a page and read carefully,
    My bad, got mixed up when i added in all the oldpad stuff...

    Zitat Zitat von KleptoOne
    The way it is now, you are actually never calling screen:clear() but your background is hiding your old screen every cycle so it still works fine, but if you were to break the inner loop (for program exit as an example) you'll be stuck in an infinite black screen loop, so be careful.
    will do, thanks for pointing that out!

  30. #7890
    Points: 3.273, Level: 35
    Level completed: 49%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    America
    Beiträge
    30
    Points
    3.273
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    I got a error for somthing like
    C:/luaplayer> luaplayer script.lua:58 error then expected near "="
    Any help im running luaplayer for windows on windows 98, and im just trying to run a simple menu, Any Help


 

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:00 PM Uhr.

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