Seite 215 von 342 ErsteErste ... 115 165 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 265 315 ... LetzteLetzte
Zeige Ergebnis 6.421 bis 6.450 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; Is there a way to us c/c++ code in a lua script? For instance would it be possible to modify ...

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

    Is there a way to us c/c++ code in a lua script? For instance would it be possible to modify some of the functions from Zettablade's vlib to to let them be used with the lua player, or would they have to compiled into the player itself?



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

    You either have to compile it into luaplayer or load it as an lrx

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

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

    Sorry, but I'm still a newbie, what's an lrx?

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

    It's an extra library that lets you add more functions to your script
    Ive used sysext lrx, for example that adds the ability to play .ogg, overclock the cpu, exit the application, launch static elf's etc.

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

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

    Is an lrx a pre-compiled library, or is it like a script that can be edited?

  6. #6426
    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 Merick
    Is an lrx a pre-compiled library, or is it like a script that can be edited?
    It's a pre-compiled library. It's basically a .prx, with the L from LuaPlayer. :|

  7. #6427
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    hey can i just have a menu coded in lua so i can learn from it and study cause i am learning lua now and want a menu thank you

  8. #6428
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Look in the code snippets thread, Its sticked in this forum.

  9. #6429
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    ok but is there one that will help me with this type of menu
    where there are 3 menu bgs with 3 options in them start credits and quit this is designed in

    and the three images are
    the first one is with the arrow pionting to start second one to credits and 3rd one to quit designed in not coded is there a menu in the snippets like that

  10. #6430
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    So when you highlight an option, It will display the arrow picture next to it?

  11. #6431
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    kinda if you want i can post the pics

  12. #6432
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Guess what i found in the snippets thread?
    Just with some minor indention ;)
    Spoiler for Keep guessing...:
    Code:
    -- Menu code
    -- Lua Snippets thread @ QJ
    
    black = Color.new(0, 0, 0)
    white = Color.new(255, 255, 255)
    index = 1
    xIcon = 0
    yIcon = 0
    offscreen = Image.createEmpty(480, 272)
    offscreen:clear(black)
    function menuCode()
    screen:clear(white)
    
    if index == 1 then
    	screen:print(0, 0, "You have chosen 'Play'.", black)
    		elseif index == 2 then
    			screen:print(0, 0, "You have chosen 'Options'.", black)
    				elseif index == 3 then
    					screen:print(0, 0, "You have chosen 'Exit'.", black)
    end
    		end
    					end
    screen.flip()
    end
    
    function printMenu ()
    	for i = 0, table.getn(menu)-1 do
    	offscreen:print(10, i*15, menu[i+1], white)
    	end
    end
    
    function moveIcon (direction)
    screen:clear(black) -- reset/clear the screen every time the icon moves
    screen:blit(0, 0, offscreen, false)
    	if direction == 1 and index > 1 and index <= table.getn(menu) then
    		index = index - 1
    		yIcon = yIcon - 15
    		else if direction == 2 and index >= 1 and index < table.getn(menu) then
    			index = index + 1
    			yIcon = yIcon + 15
    		end
    end
    
    screen:fillRect (xIcon, yIcon, 5, 5, white)
    screen.waitVblankStart(4) 
    screen.flip()
    end
    
    menu = {}
    menu[1] = "Play"
    menu[2] = "Options"
    menu[3] = "Exit"
    
    printMenu()
    
    screen:blit(0, 0, offscreen, false)
    screen:fillRect(xIcon, yIcon, 5, 5, white)
    screen.flip()
    
    while true do
    pad = Controls.read()
    if pad:start() then
    	System.Quit()
    	end
    	elseif pad:down() then
    		moveIcon(2)
    		end
    		elseif pad:up() then
    			moveIcon(1)
    			end
    			elseif pad:cross() then
    				menuCode()
    				end
    
    screen.waitVblankStart()
    end
    Geändert von Anti-QJ (03-29-2007 um 04:43 PM Uhr)

  13. #6433
    .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

    A basic menu is not hard to make, just simply declare the amount of menu items and make something like this:

    Code:
     if pad:up() then
    menu = menu - 1
    end
    
    if pad:down() then
    menu = menu + 1
    end
    
    if menu > 5 then -- if menu is over the maximum amount
    menu = 1
    end
    
    if menu == 1 then -- if the menu is number 1
    screen:blit(0,0,arrow)
    end
    
    if menu == 2 then -- if menu is number 2
    screen:blit(0,10,arrow)
    end
    and so on.

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

  14. #6434
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    ok these are the images please no one copy these
    menu1


    menu2


    menu3

  15. #6435
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Yongobongo
    A basic menu is not hard to make, just simply declare the amount of menu items and make something like this:

    Code:
     if pad:up() then
    menu = menu - 1
    end
    
    if pad:down() then
    menu = menu + 1
    end
    
    if menu > 5 then -- if menu is over the maximum amount
    menu = 1
    end
    
    if menu == 1 then -- if the menu is number 1
    screen:blit(0,0,arrow)
    end
    
    if menu == 2 then -- if menu is number 2
    screen:blit(0,10,arrow)
    end
    and so on.
    I think that could should be:

    Code:
     if pad:up() then
    menu = menu - 1
    end
    
    if pad:down() then
    menu = menu + 1
    end
    
    if menu > 5 then -- if menu is over the maximum amount
    menu = 5
    end
    
    if menu < 1 then -- if menu is below the minimum amount
    menu = 1
    end
    
    if menu == 1 then -- if the menu is number 1
    screen:blit(0,0,arrow)
    end
    
    if menu == 2 then -- if menu is number 2
    screen:blit(0,10,arrow)
    end
    I just changed some things in it. In your code, if you go above of the 5th option in the menu, the code resets to the 1st option. It should be 5th option if the menu goes above the 5th option. Vice versa for the minimum option.
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  16. #6436
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Just edit the code I posted to display your arrow instead of the arrow it makes.
    Also edit it to blit the arrow on both sides.
    Should be very simple, I just don't want to give you the code cause i would rather have you learn something ;)

  17. #6437
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    ok thanks
    -= Double Post =-
    would it look something like this

    code-
    blue = Color.new(0, 153, 255)
    orange = Color.new(155, 102, 0)
    gray = Color.new(153, 153, 153)
    black = Color.new(0 , 0, 0)

    ---Variables---

    Select = 1

    MaxSelect = 3

    WOC1 = Image.load("images/WoC1.jpg")
    WOC2 = Image.load("images/WoC2.png")
    WOC3 = Image.load("images/WoC3.png")

    ---Loop----
    while true do
    pad = Controls.read()
    screen:clear()

    --Player decision---
    if pad:down()
    Select = Select + 1
    end

    if pad:up() then
    Select = Select - 1
    end

    --Menu Options---

    if Select == 1 then
    screen:blit(0,0,WOC1)
    screen:flip()
    end
    if Select == 2 then
    screen:blit(0,0,WOC2)
    screen:flip()
    end
    if Select == 3 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    if Select < 1 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    if Select > 3 then
    screen:blit(0,0,WOC1)
    end
    screen:flip()
    screen.waitVblankStart()
    end
    Geändert von pspdude10594 (03-29-2007 um 04:55 PM Uhr) Grund: Automerged Doublepost

  18. #6438
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von superbatxs
    I think that could should be:

    Code:
     if pad:up() then
    menu = menu - 1
    end
    
    if pad:down() then
    menu = menu + 1
    end
    
    if menu > 5 then -- if menu is over the maximum amount
    menu = 5
    end
    
    if menu < 1 then -- if menu is below the minimum amount
    menu = 1
    end
    
    if menu == 1 then -- if the menu is number 1
    screen:blit(0,0,arrow)
    end
    
    if menu == 2 then -- if menu is number 2
    screen:blit(0,10,arrow)
    end
    I think it should be:
    Code:
    if pad:up() then
    menu = menu - 1
    end
    elseif pad:down() then
    menu = menu + 1
    end
    elseif menu => 4 then
    menu = 1
    end
    elseif menu <= 0 then
    menu = 3
    end
    elseif menu == 1 then
    screen:blit(0,0,arrow)
    end
    elseif menu == 2 then
    screen:blit(0,10,arrow)
    end
    elseif menu == 3 then
    screen:blit(0,20,arrow)
    end

  19. #6439
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspdude10594
    ok thanks
    -= Double Post =-
    would it look something like this

    code-
    blue = Color.new(0, 153, 255)
    orange = Color.new(155, 102, 0)
    gray = Color.new(153, 153, 153)
    black = Color.new(0 , 0, 0)

    ---Variables---

    Select = 1

    MaxSelect = 3

    WOC1 = Image.load("images/WoC1.png")
    WOC2 = Image.load("images/WoC2.png")
    WOC3 = Image.load("images/WoC3.png")

    ---Loop----
    while true do
    pad = Controls.read()
    screen:clear()

    --Player decision---
    if pad:down()
    Select = Select + 1
    end

    if pad:up() then
    Select = Select - 1
    end

    --Menu Options---

    if Select == 1 then
    screen:blit(0,0,WOC1)
    screen:flip()
    end
    if Select == 2 then
    screen:blit(0,0,WOC2)
    screen:flip()
    end
    if Select == 3 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    if Select < 1 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    if Select > 3 then
    screen:blit(0,0,WOC1)
    end
    screen:flip()
    screen.waitVblankStart()
    end
    does that look ok or needs work

  20. #6440
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Anti-QJ
    I think it should be:
    Code:
    elseif menu =>4 then
    menu = 1
    end
    So if a menu option is more than 4, make the menu option 1? Or if a menu option is equal to 4, make the menu option 1? It depends on the user. You can have a menu either way. Btw, I was talking about 5 menu options. Also, you don't have to have that. Instead of
    Code:
    elseif menu =>4 then
    menu = 1
    end
    you can put

    Code:
    if menu > 3 then
    menu = 1
    end
    Btw, i am not sure if it needs an else if....you can just if alone.

    --Double post--

    Code:
    --Variables
    
    Select = 1
    MaxSelect = 3
    WOC1 = Image.load("images/WoC1.png")
    WOC2 = Image.load("images/WoC2.png")
    WOC3 = Image.load("images/WoC3.png")
    
    ---Loop----
    while true do
    pad = Controls.read()
    
    --Player decision---
    if pad:down()
    Select = Select + 1
    end
    
    if pad:up() then
    Select = Select - 1
    end
    
    --Menu Options---
    
    if Select == 1 then
    screen:blit(0,0,WOC1)
    screen:flip()
    end
    if Select == 2 then 
    screen:blit(0,0,WOC2)
    screen:flip()
    end
    if Select == 3 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    if Select > 3 then
    Select == 1
    end
    if Select < 1 then
    Select == 3
    end
    screen.waitVblankStart()
    end
    Just a simple code cleanup. Yea, that could work. Btw, you don't need the colors, unless you use them later.
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  21. #6441
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    blue = Color.new(0, 153, 255)
    orange = Color.new(155, 102, 0)
    gray = Color.new(153, 153, 153)
    black = Color.new(0 , 0, 0)
    
    ---Variables---
    
    Select = 1
    
    MaxSelect = 3
    
    WOC1 = Image.load("images/WoC1.png")
    WOC2 = Image.load("images/WoC2.png")
    WOC3 = Image.load("images/WoC3.png")
    
    ---Loop----
    while true do
    pad = Controls.read()
    screen:clear()
    
    --Player decision---
    if pad:down()
    Select = Select + 1
    end
    
    if pad:up() then
    Select = Select - 1
    end
    
    --Menu Options---
    
    if Select == 1 then
    screen:blit(0,0,WOC1)
    screen:flip()
    end
    elseif Select == 2 then
    screen:blit(0,0,WOC2)
    screen:flip()
    end
    elseif Select == 3 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    if Select <= 0 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    elseif Select => 4 then
    screen:blit(0,0,WOC1)
    end
    screen:flip()
    screen.waitVblankStart()
    end
    You need to had a statement where if X is press it will do this, You can do that...
    -= Double Post =-
    Zitat Zitat von superbatxs
    So if a menu option is more than 4, make the menu option 1? Or if a menu option is equal to 4, make the menu option 1? It depends on the user. You can have a menu either way. Btw, I was talking about 5 menu options. Also, you don't have to have that. Instead of
    Code:
    elseif menu =>4 then
    menu = 1
    end
    you can put

    Code:
    if menu > 3 then
    menu = 1
    end
    Btw, i am not sure if it needs an else if....you can just if alone.
    => means "equal" or "greater than"
    <= means "equal" or less than"

    "elseif" is a good idea when you have alot of if statements.
    Geändert von Anti-QJ (03-29-2007 um 05:06 PM Uhr) Grund: Automerged Doublepost

  22. #6442
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Anti-QJ
    => means "equal" or "greater than"
    <= means "equal" or less than"

    "elseif" is a good idea when you have alot of if statements.
    Lol, you can use either ways. I was just saying that you don't have to have "elseif", you can just put "if".

    Edit:
    Anti-Qj, in your code

    Code:
    if Select <= 0 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    elseif Select => 4 then
    screen:blit(0,0,WOC1)
    screen:flip()
    end
    What if you keep pressing up? What if you are at Select == -1? If you keep press up, and when you eventually try to go above the 1st option, you will get the 3rd option. But if you keep pressing up, it will stay as the third option. Here is what should work:

    Code:
    if Select < 1 then
    Select == 1
    end
    elseif Select > 3 then
    Select == 3
    end
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  23. #6443
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von superbatxs
    Lol, you can use either ways. I was just saying that you don't have to have "elseif", you can just put "if".
    But if you have alot of if statements, a elseif is a good idea.

    Bad
    Code:
    if blah then
    blah
    end
    if blah then
    blah
    end
    if blah then 
    blah
    end
    Good
    Code:
    if blah then
    blah
    end
    elseif blah then
    blah
    end
    elseif blah then 
    blah
    end

  24. #6444
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Anti-QJ
    But if you have alot of if statements, a elseif is a good idea.

    Bad
    Code:
    if blah then
    blah
    end
    if blah then
    blah
    end
    if blah then 
    blah
    end
    Good
    Code:
    if blah then
    blah
    end
    elseif blah then
    blah
    end
    elseif blah then 
    blah
    end
    Edited previous post*
    Also, doesn't matter to me.....both do the same thing. In fact, "if" is less code than "elseif".
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  25. #6445
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von superbatxs
    In fact, "if" is less code than "elseif".
    ....:Argh:
    -= Double Post =-
    Zitat Zitat von superbatxs
    Lol, you can use either ways. I was just saying that you don't have to have "elseif", you can just put "if".

    Edit:
    Anti-Qj, in your code

    Code:
    if Select <= 0 then
    screen:blit(0,0,WOC3)
    screen:flip()
    end
    elseif Select => 4 then
    screen:blit(0,0,WOC1)
    screen:flip()
    end
    What if you keep pressing up? What if you are at Select == -1? If you keep press up, and when you eventually try to go above the 1st option, you will get the 3rd option. But if you keep pressing up, it will stay as the third option. Here is what should work:

    Code:
    if Select < 1 then
    Select == 1
    end
    elseif Select > 3 then
    Select == 3
    end
    As mentioned before, I dont want to give him the full code, He jsut wanted to know how to use an arrow as a selector.;)
    Geändert von Anti-QJ (03-29-2007 um 05:23 PM Uhr) Grund: Automerged Doublepost

  26. #6446
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    I should point out that there's a mistake there....and that multiple Ifs are longer than Elseifs.

    Code:
    if blah then
    something
    elseif blah then
    something
    end
    
    --AS OPPOSED TO--
    
    if blah then
    something
    end
    if blah then
    something
    end
    Elseifs basically allow you to skip the "end" until you've finished putting in Elseifs.

  27. #6447
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Thats what i have been saying...

    Look, Say you have a program that has this snippet in it...
    Code:
    if x == 2 then
    	blah
    		end
    			if x == 3 then
    	blah	
    		end
    			if x == 4 then
    	blah
    end
    Well, it will check if x is equal to 2, if it is then it will run but it will still check if x is equal to 3 and 4 which is wasting time.

    Now if you put...
    Code:
    if x == 2 then
    	blah
    		end
    			elseif x == 3 then
    	blah	
    		end
    			elseif x == 4 then
    	blah
    end
    It will check and if 2 is equal to x it will run whatever the blah is, but now since you have a elseif statement it will(as mentioned before0 ignore the other two if statements because we already know what x is, x = 5

    It basically saves some time.

    PS. Sorry about the indention if you cant read it, I just am use to indention now.

  28. #6448
    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 superbatxs
    Edited previous post*
    Also, doesn't matter to me.....both do the same thing. In fact, "if" is less code than "elseif".
    your ignorance scares me. if they both do the same thing, why in the world would lua even have it? as aint-qj explained, using else/elseif's saves many cpu cycles, which you desperately need when working with a console such as the psp.
    --------------------------------------------------------------------------------------

  29. #6449
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    I just didn't like how he said " "if" is less code then "elseif" "
    That just seems like something a nub would say.

    BTW, Doesn't this look nice?
    Code:
    if x == 2 then
    	blah
    		end
    			elseif x == 3 then
    	blah	
    		end
    			elseif x == 4 then
    	blah
    end
    Why in the world did i say that?
    Because i think super should learn how to indent.

  30. #6450
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    your ignorance scares me. if they both do the same thing, why in the world would lua even have it? as aint-qj explained, using else/elseif's saves many cpu cycles, which you desperately need when working with a console such as the psp.
    Sorry, i have to be honest. I wasn't thinking properly....just typing while i was doing my math homework (or was I.....?). Honestly, i do use "else if" in my menu code in C.
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)


 

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

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