Seite 173 von 342 ErsteErste ... 73 123 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 223 273 ... LetzteLetzte
Zeige Ergebnis 5.161 bis 5.190 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 andyauff Okay, so I have just begun learning lua recently, and I am making a stupid app for ...

  
  1. #5161
    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 andyauff
    Okay, so I have just begun learning lua recently, and I am making a stupid app for practice/learning. I have this code:
    Code:
    --App by andyauff
    --Version .02 of "Useless Music App", finished January   , 2007
    
    --define colors---------------------------------------------------
    
    white = Color.new (255,255,255)
    blue = Color.new (0,0,255)
    black = Color.new (0,0,0)
    red = Color.new (255,0,0)
    green = Color.new (0,255,0)
    yellow = Color.new (255,255,0)
    purple = Color.new (255,0,255)
    
    --create the menu function----------------------------------------
    
    function drawMenu()  
    
    gamestate = "menu"
    oldpad = Controls.read()
    song = "mindwave"
    
    selector = { image = Image.createEmpty (145,15), x = 147, y = 77}
    selector.image:clear(yellow)
    
    screen:clear(green)
    
    pad = Controls.read()
    
    screen:blit(selector.x,selector.y,selector.image)
    
    screen:print(150,80,"Mindwave",blue)
    screen:print(150,100,"Minute",blue)
    
    --controls
    
    if pad:up() and oldpad:up() ~= pad:up() then
    selector.y = 77
    song = "mindwave"
    end
    
    if pad:down() and oldpad:down() ~= pad:down() then
    selector.y = 97
    song = "minute"
    end
    
    if pad:cross() and oldpad:cross() ~= pad:cross() then
    inGame()
    end
    screen.flip()
    end
    
    --create the game funtion------------------------------------------
    
    function inGame()
    
    gamestate = "start"
    
    pad = Controls.read()
    
    screen:clear(red)
    screen:print(150,100,"To play song, press X.",green)
    screen:print(150,120,"To pause song, press X again.",yellow)
    screen:print(150,140,"Enjoy!",purple)
    
    if pad:cross() and gamestate == "start" and song == "mindwave" then
    Music.playFile("mindwave.mod", false)
    gamestate = "playing"
    end
    
    if pad:cross() and gamestate == "start" and song == "minute" then
    Music.playFile("minute.xm", false)
    gamestate = "playing"
    end
    
    if pad:cross() and gamestate == "playing" then
    Music.pause()
    gamestate = "paused"
    end
    
    if pad:cross() and gamestate == "paused" then
    Music.resume()
    gamestate = "playing"
    end
    
    if pad:start() then
    gamestate = "menu"
    end
    screen.flip()
    end
    
    --main loop---------------------------------------------------------
    
    while true do
    
    drawMenu()
    oldpad = pad
    end
    First let me tell you what it is supposed to do- there is a start screen that is a menu with choices between 2 different songs to play. If you click (cross) on a song, it should go to a new screen that says "press x to play song, press x again to pause song, enjoy." The selected song should play once pressing cross, pause if cross is pressed again, and that's about it. I have many problems-the selector for the menu doesn't move, when I press X it sometimes plays music, sometimes it doesn't, and instead of pausing it stops it completely and starts back over when I press X again. Thanks for any help, I know this is confusing. Hopefully the code is at least sort of neat.
    I believe this should work. :)
    Its not very much different from yours, i believe you can figure out the differences and their effects.

    Code:
    --App by andyauff
    --Version .02 of "Useless Music App", finished January   , 2007
    
    --define colors---------------------------------------------------
    
    white = Color.new (255,255,255)
    blue = Color.new (0,0,255)
    black = Color.new (0,0,0)
    red = Color.new (255,0,0)
    green = Color.new (0,255,0)
    yellow = Color.new (255,255,0)
    purple = Color.new (255,0,255)
    
    oldpad = Controls.read()
    song = "mindwave"
    
    --create the menu function----------------------------------------
    
    function drawMenu()  
    	gamestate = "menu"
    
    	selector = { image = Image.createEmpty (145,15), x = 147, y = 77}
    	selector.image:clear(yellow)
    
    	screen:clear(green)
    
    	pad = Controls.read()
    
    	screen:blit(selector.x,selector.y,selector.image)
    
    	screen:print(150,80,"Mindwave",blue)
    	screen:print(150,100,"Minute",blue)
    
    	--controls
    
    	if pad:up() and oldpad:up() ~= pad:up() then
    		selector.y = 77
    		song = "mindwave"
    	end
    
    	if pad:down() and oldpad:down() ~= pad:down() then
    		selector.y = 97
    		song = "minute"
    	end
    
    	screen.flip()
    end
    
    --create the game funtion------------------------------------------
    
    function inGame()
    	gamestate = "start"
    
    	pad = Controls.read()
    
    	screen:clear(red)
    	screen:print(150,100,"To play song, press X.",green)
    	screen:print(150,120,"To pause song, press X again.",yellow)
    	screen:print(150,140,"Enjoy!",purple)
    
    	if pad:cross() and oldpad:cross() ~= pad:cross() then
    		if gamestate == "start" then
    			if song == "mindwave" then
    				Music.playFile("mindwave.mod", false)
    			elseif song == "minute" then
    				Music.playFile("minute.xm:, false)
    			end
    			gamestate = "playing"
    		elseif gamestate == "playing" then
    			Music.pause()
    			gamestate = "paused"
    		elseif gamestate == "paused" then
    			Music.resume()
    			gamestate = "playing"
    		end
    	end
    
    	if pad:start() then
    		gamestate = "menu"
    	end
    
    	screen.flip()
    end
    
    --main loop---------------------------------------------------------
    
    while true do
    	drawMenu()
    
    	inGame()
    
    	oldpad = pad
    end


    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

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

    Thanks a lot for the help, but unfortunately that didn't work either. It was flashing quickly between the menu and the instructions screen, and the music still starts over instead of pausing. Also, the selector still doesn't move. I think some of it may have to do with the main loop, it may be trying to run both functions at the same time? I'm new to lua but that sounds reasonable to me. Thanks a lot for the help, I'll see if I can mess around with it. And if you want to waste more time helping me, I can give you the eboot so you can run the script to test it. Just if you feel like it though. Thanks a lot for helping.

  3. #5163
    QJ Gamer Green
    Points: 8.746, Level: 62
    Level completed: 99%, Points required for next Level: 4
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    www.ultimatetalkforums.com Games, RPG, quickchat and more!
    Beiträge
    532
    Points
    8.746
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    omfg ive triedso harf to fix my game go go go! but noone will help!
    [CENTER][COLOR=black][COLOR=black][URL="http://forums.qj.net/f-psp-firmware-discussion-253/t-psp-firmware-30-get-it-58053.html"][COLOR=cyan]would you upgrade?[/COLOR][/URL] [/COLOR][FONT=Times New Roman][COLOR=navy][URL="http://www.mindistortion.net/iwantyoursoul/?i_am=altunozara"]OMG ITS REAL![/URL][/COLOR][/FONT][COLOR=black] [URL="http://forums.qj.net/showthread.php?t=61756&page=1&pp=10"][COLOR=lime]Sony vs Nintendo[/COLOR][/URL][/COLOR][/COLOR][/CENTER]
    [CENTER] [/CENTER]
    [CENTER][URL="http://www.ultimatetalkforums.com"][IMG]http://i94.photobucket.com/albums/l82/Altunozara/userbar2.jpg[/IMG][/URL][/CENTER]
    [CENTER][SIZE=3]i [/SIZE][URL="http://forums.qj.net/www.gamingwell.com"][SIZE=3]wonder what could be under this hyperlink..hmm[/SIZE][/URL][/CENTER]
    [CENTER][SIZE=3][COLOR=green][B][I]Maniakc is awsome!!![/I][/B][/COLOR][/SIZE][/CENTER]
    [CENTER][FONT=Arial Black][SIZE=3][COLOR=#660099][I][U][URL="http://forums.qj.net/member.php?u=58299"]The Brain Pwns!!![/URL][/U][/I][/COLOR][/SIZE][/FONT][/CENTER]

    [COLOR=sienna]Creator of:[/COLOR][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-go-go-go-beta-66652.html"][COLOR=sienna]GO GO GO![/COLOR][/URL]

  4. #5164
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Can somone anwser to my question please.Page 516 firstpost.
    allot of people dont use the default vBulletin settings for posts per page.
    get the post id.

  5. #5165
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    I do :P whats the post id?
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  6. #5166
    QJ Gamer Green
    Points: 8.746, Level: 62
    Level completed: 99%, Points required for next Level: 4
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    www.ultimatetalkforums.com Games, RPG, quickchat and more!
    Beiträge
    532
    Points
    8.746
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    hey guys u know when you say like when you clickm square do something
    what would it be for the right d pad like wats it called when you right it...r?
    [CENTER][COLOR=black][COLOR=black][URL="http://forums.qj.net/f-psp-firmware-discussion-253/t-psp-firmware-30-get-it-58053.html"][COLOR=cyan]would you upgrade?[/COLOR][/URL] [/COLOR][FONT=Times New Roman][COLOR=navy][URL="http://www.mindistortion.net/iwantyoursoul/?i_am=altunozara"]OMG ITS REAL![/URL][/COLOR][/FONT][COLOR=black] [URL="http://forums.qj.net/showthread.php?t=61756&page=1&pp=10"][COLOR=lime]Sony vs Nintendo[/COLOR][/URL][/COLOR][/COLOR][/CENTER]
    [CENTER] [/CENTER]
    [CENTER][URL="http://www.ultimatetalkforums.com"][IMG]http://i94.photobucket.com/albums/l82/Altunozara/userbar2.jpg[/IMG][/URL][/CENTER]
    [CENTER][SIZE=3]i [/SIZE][URL="http://forums.qj.net/www.gamingwell.com"][SIZE=3]wonder what could be under this hyperlink..hmm[/SIZE][/URL][/CENTER]
    [CENTER][SIZE=3][COLOR=green][B][I]Maniakc is awsome!!![/I][/B][/COLOR][/SIZE][/CENTER]
    [CENTER][FONT=Arial Black][SIZE=3][COLOR=#660099][I][U][URL="http://forums.qj.net/member.php?u=58299"]The Brain Pwns!!![/URL][/U][/I][/COLOR][/SIZE][/FONT][/CENTER]

    [COLOR=sienna]Creator of:[/COLOR][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-go-go-go-beta-66652.html"][COLOR=sienna]GO GO GO![/COLOR][/URL]

  7. #5167
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    buttonstate:left()

    and i don't know what the post id is, i was asking zereox to get it for me.

  8. #5168
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    The psp buttons

    pad = Controls.read()

    pad:cross()

    pad:square()

    pad:triangle()

    pad:circle()

    --shoulder buttons
    pad:r()
    pad:l()

    --d pad
    pad:left()
    pad:right()
    pad:up()
    pad:down()

    Im pretty sure thats all right.

    Now to use them its just if pad:down() then or however you want to use them.
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  9. #5169
    QJ Gamer Green
    Points: 8.746, Level: 62
    Level completed: 99%, Points required for next Level: 4
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    www.ultimatetalkforums.com Games, RPG, quickchat and more!
    Beiträge
    532
    Points
    8.746
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard Go Go Go!

    you might have heard of GO GO GO! i want to make an ai and ive tried to just do a test...and hmm heres my code can anyone tell me what ive done rong...it wont work


    Code:
     
    -- Loading music
    Music.playFile ("ame002.it", true)
    green=Color.new(0,255,0)
    timer=Timer.new()
    math.randomseed(os.time())
    -- load graphics
    tiles = Image.load("tiles.png")
    figure = Image.load("figure.png")-- load graphics
    tiles = Image.load("tiles.png")
    figure = Image.load("figure.png")
    -- the map
    mapSource = {
     "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
     "meaaaaaaaaaaaaaaaaaaaaaaaaaafm",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "aiooooooooooooooooooooooooooja",
     "oooooooooooooooooooooooooooooo",
     "clooooooooooooooooooooooooookc",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "mdoooooooooooooooooooooooooobm",
     "mhccccccccccccccccccccccccccgm",
     "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
    }
     
    -- offsreen image, where the map will be drawn
    board = Image.createEmpty(480, 272)
     
    -- draw one tile on the map
    function drawTile(tile, x, y)
     tile = string.byte(tile, 1) - string.byte("a")
     local tileX = math.mod(tile, 4)
     local tileY = math.floor(tile / 4)
     board:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)
    end 
     
    -- copy the map source to an array for easier access and draw the offscreen board
    map = {}
    for y = 1, 17 do
     line = mapSource[y]
     map[y] = {}
     for x = 1, 30 do
      tile = string.sub(line, x, x)
      map[y][x] = tile
      drawTile(tile, x - 1, y - 1)
     end
    end
     
    -- current player position
    playerX = 6
    playerY = 14
    -- current player 2 position
    playerX = 15
    playerY = 15
     
    -- current player animation image
    animation = 0
     
    -- 1 = animation images increases, -1: decreases
    animationDirection = 1
     
    -- animation slowdown counter
    animationSlowDown = 0
     
    -- controls the movement speed. At speedStep == 0, the last
    -- pad will be evaluated, other steps the pad movements are only
    -- saved
    speedStep = 0
     
    -- last pad direction
    dx = 0
    dy = 0
     
    -- current score
    score = 0
     
    -- text color
    white = Color.new(255, 255, 255) 
    gameover = Image.load("gameover.png")
    -- text color
    white = Color.new(255, 255, 255) 
    gameover = Image.load("gameover.png")
    while true do
    timer:start()
    if timer:time() > 10 then
     screen:blit(0,0,gameover,    true)
      end
     
    -- read current pad
     pad = Controls.read()
     
     if pad:start() then
      -- exit to lowser, if started from there
      break
     end
     if speedStep == 0 then
      -- save old player position
      oldPlayerX = playerX
      oldPlayerY = playerY
      
      -- add last movement
      playerX = playerX + dx
      playerY = playerY + dy
      
      -- check new tile
      newTile = map[playerY][playerX]
      
      -- if the position is not allowed, restore old player position
      if newTile ~= "n" and newTile ~= "o" and newTile ~= "r" and newTile ~= "s" and newTile ~= "t" and newTile ~= "p" and newTile ~= "q" then
       playerX = oldPlayerX
       playerY = oldPlayerY
      end
      
      -- if it is a tile which can be eaten, eat it
      if newTile == "o" then score = score + 1 end
      if newTile == "o" then
       -- set background tile
       map[playerY][playerX] = "n"
     
       -- draw background tile
       drawTile("o", playerX - 1, playerY - 1)
      end
      
      -- reset last movement
      dx = 0
      dy = 0
     else
    --Player movements
      
      if pad:up() then
       dy = -1
      elseif pad:down() then
       dy = 1
      elseif pad:left() then
       dx = -1
      elseif pad:right() then
       dx = 1
                    elseif pad:cross() then
    drawTile("o", playerX - 1, playerY - 1)
    elseif pad:square() then
    drawTile("r", playerX - 1, playerY - 1)
    elseif pad:circle() then
    drawTile("s", playerX - 1, playerY - 1)
    elseif pad:triangle() then
    drawTile("t", playerX - 1, playerY - 1)
    elseif pad:l() then
    drawTile("n", playerX - 1, playerY - 1)
    elseif pad:r() then
    dofile("battle land.lua")
      end
    end
     
     -- update speed step counter
     speedStep = speedStep + 1
     if speedStep == 5 then
      speedStep = -1
     end
     
     -- blit board
     screen:blit(0, 0, board, 0, 0, board:width(), board:height(), false)
     
     -- blit current player animation image
     screen:blit((playerX - 1) * 16 - 4, (playerY - 1) * 16 - 4, figure, 1 + 25 * animation, 1, 24, 24)
     
     -- calculate next animation image
     animationSlowDown = animationSlowDown + 1
     if animationSlowDown == 3 then
      animationSlowDown = 0
      animation = animation + animationDirection
      if animation == 4 then
       animationDirection = -1
      elseif animation == 0 then
       animationDirection = 1
      end
     end
     
     -- print score
     screen:print(10, 260, "Score: " .. score, white)
            --print time
     screen:print(0,0,"Time:"..timer:time()/1000,green)
     -- wait for vertical sync and show new screen
     screen.waitVblankStart()
     screen:flip()
    end
    --** AI MOULD CREATION **--
    --Mould 1 - figure
    figuremould = {}
    --figuremould.AI = math.random(1, 100)   To be done later
    figuremould.run = true
    figuremould.jog = false
    figuremould.sprint = false
    figuremould.x = 0
    --**AI Mould Creation End**
    --main loop
    while true do
    screen:clear()
    screen:blit(0, 0, tiles)
    --figure AI
    if figuremould.x <= 480 then
    figuremould.AI = math.random(1, 100)
    if figuremould.AI == 75 or Easymould.AI == 100 then
    figuremould.run = false
    figuremould.jog = true
    figuremould.sprint = false
    end
    if figuremould.AI == 99 then
    figuremould.sprint = false
    figuremould.run = true
    figuremould.jog = false
    end
    if figuremould.AI == 2 then
    figuremould.sprint = true
    figuremould.run = false
    figuremould.jog = false
    end
    if figuremould.run == true then
    figuremould.x = figuremould.x + 2
    end
    if figuremould.jog == true then
    figuremould.x = figuremould.x + 1
    end
    if figuremould.sprint == true then
    figuremould.x = figuremould.x + 3
    endend
    --****ARTIFICIAL INTELLIGENCE**** END
    figuremould.AI = math.random(1, 100)
    if figuremould.AI == 75 or Easymould.AI == 100 then
    figuremould.jog = true
    if figuremould.run == true then
    figuremould.x = figuremould.x + 2
    end
    if figuremould.jog == true then
    figuremould.x = figuremould.x + 1
    end
    if figuremould.sprint == true then
    figuremould.x = figuremould.x + 3
    end
    screen:blit(figuremould.x, 42, figure)
    [CENTER][COLOR=black][COLOR=black][URL="http://forums.qj.net/f-psp-firmware-discussion-253/t-psp-firmware-30-get-it-58053.html"][COLOR=cyan]would you upgrade?[/COLOR][/URL] [/COLOR][FONT=Times New Roman][COLOR=navy][URL="http://www.mindistortion.net/iwantyoursoul/?i_am=altunozara"]OMG ITS REAL![/URL][/COLOR][/FONT][COLOR=black] [URL="http://forums.qj.net/showthread.php?t=61756&page=1&pp=10"][COLOR=lime]Sony vs Nintendo[/COLOR][/URL][/COLOR][/COLOR][/CENTER]
    [CENTER] [/CENTER]
    [CENTER][URL="http://www.ultimatetalkforums.com"][IMG]http://i94.photobucket.com/albums/l82/Altunozara/userbar2.jpg[/IMG][/URL][/CENTER]
    [CENTER][SIZE=3]i [/SIZE][URL="http://forums.qj.net/www.gamingwell.com"][SIZE=3]wonder what could be under this hyperlink..hmm[/SIZE][/URL][/CENTER]
    [CENTER][SIZE=3][COLOR=green][B][I]Maniakc is awsome!!![/I][/B][/COLOR][/SIZE][/CENTER]
    [CENTER][FONT=Arial Black][SIZE=3][COLOR=#660099][I][U][URL="http://forums.qj.net/member.php?u=58299"]The Brain Pwns!!![/URL][/U][/I][/COLOR][/SIZE][/FONT][/CENTER]

    [COLOR=sienna]Creator of:[/COLOR][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-go-go-go-beta-66652.html"][COLOR=sienna]GO GO GO![/COLOR][/URL]

  10. #5170
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Well before I look into the vast lines of code you have there what error are you getting?
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  11. #5171
    QJ Gamer Green
    Points: 8.746, Level: 62
    Level completed: 99%, Points required for next Level: 4
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    www.ultimatetalkforums.com Games, RPG, quickchat and more!
    Beiträge
    532
    Points
    8.746
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    umm what do i do to check again..its njust flashing...so what do i dfo like...cmd then somethign or somehting like that
    [CENTER][COLOR=black][COLOR=black][URL="http://forums.qj.net/f-psp-firmware-discussion-253/t-psp-firmware-30-get-it-58053.html"][COLOR=cyan]would you upgrade?[/COLOR][/URL] [/COLOR][FONT=Times New Roman][COLOR=navy][URL="http://www.mindistortion.net/iwantyoursoul/?i_am=altunozara"]OMG ITS REAL![/URL][/COLOR][/FONT][COLOR=black] [URL="http://forums.qj.net/showthread.php?t=61756&page=1&pp=10"][COLOR=lime]Sony vs Nintendo[/COLOR][/URL][/COLOR][/COLOR][/CENTER]
    [CENTER] [/CENTER]
    [CENTER][URL="http://www.ultimatetalkforums.com"][IMG]http://i94.photobucket.com/albums/l82/Altunozara/userbar2.jpg[/IMG][/URL][/CENTER]
    [CENTER][SIZE=3]i [/SIZE][URL="http://forums.qj.net/www.gamingwell.com"][SIZE=3]wonder what could be under this hyperlink..hmm[/SIZE][/URL][/CENTER]
    [CENTER][SIZE=3][COLOR=green][B][I]Maniakc is awsome!!![/I][/B][/COLOR][/SIZE][/CENTER]
    [CENTER][FONT=Arial Black][SIZE=3][COLOR=#660099][I][U][URL="http://forums.qj.net/member.php?u=58299"]The Brain Pwns!!![/URL][/U][/I][/COLOR][/SIZE][/FONT][/CENTER]

    [COLOR=sienna]Creator of:[/COLOR][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-go-go-go-beta-66652.html"][COLOR=sienna]GO GO GO![/COLOR][/URL]

  12. #5172
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    alright i tried doing math.random() but it just says unexpected symbol i dont understand :ARGH:

  13. #5173
    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 eyece
    no, thats what i tried, it didn't work, it just returns the "attempt to index field '?'" error,
    i may have to have all the table parts set to false, kind of gay though, LUA-Player v0.21 should have implemented something like this:
    if ~variable then
    ...
    end
    It works for me. What is your exact code?

  14. #5174
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    alright i tried doing math.random() but it just says unexpected symbol i dont understand :ARGH:
    I think you need to give it a range of numbers to go through...like math.random(1,20) that way, it will pick a number in between (and including) 1 through 20. hope this helps.
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  15. #5175
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Quick question about modules:

    How come the variables declared in my modules are not accessible outside of them(the module)? I thought Lua variables defaulted to global? Is there some exception with modules? and is there a way around this?


    Smaller question: How do I output a new line to a file? I tried "/n" and nothing worked

  16. #5176
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSPhakkor

    Smaller question: How do I output a new line to a file? I tried "/n" and nothing worked
    Im pretty interested in this as well!
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  17. #5177
    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 PSPhakkor
    Quick question about modules:

    How come the variables declared in my modules are not accessible outside of them(the module)? I thought Lua variables defaulted to global? Is there some exception with modules? and is there a way around this?


    Smaller question: How do I output a new line to a file? I tried "/n" and nothing worked
    your terminology is better than mine, so forgive me if i'm mistaken, but by 'modules' i'm assuming you mean something like a function or a loop.

    anyways, no, lua variables do not always default to global. if you were just declaring a variable normally without loops or modules, it would be global, but if used like below, it would not be global.

    Code:
    --some simple function
    function CustomNameHere(LocalVariableNameHereWhichIsOptional)
    if LocalVariableNameHereWhichIsOptional == something then
    DoSomething
    end --end 'if'
    end --end 'function'
    "LocalVariableNameHereWhi chIsOptional" would not be global.

    oh and "/n" is supposed to be "\n". lol. small mistakes...they suck dont they?
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  18. #5178
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    "/n" still doesn't work! It's supposed to be in quotes, right?

    A module is a file of code that index.lua uses rather than putting all the code in one file. It's a lot more organised, but it doesn't matter if I can't get it working. I'll just have a disorganised program if I have to... No one will know when they play the game

  19. #5179
    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 PSPhakkor
    "/n" still doesn't work! It's supposed to be in quotes, right?

    A module is a file of code that index.lua uses rather than putting all the code in one file. It's a lot more organised, but it doesn't matter if I can't get it working. I'll just have a disorganised program if I have to... No one will know when they play the game
    (lol. i still dont get the modules, i'd have to see it.)

    as for the newline, use the other diagonal line. you have "/" when its supposed to be "\".

    and its used like this: file:write("\nText")
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

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

    There isn't a newline character for that function.

    Don't assume variables will be declared global across files. It is poor practise and design. Parameter pass the values or objects needed to the functions that you call from other files.

  21. #5181
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    I need some help with something....(obviously :P)

    Alright, what i need help with is, I'm trying to make a Bar, a Vertical bar.
    now this is easy to do normally, but i need it so that when L and R are pressed, the Bar, rises, until it hits 100, then it does something ( a charge shot)
    then returns to 0, This is pretty easy to do, I can do that, the problem is the Bar goes Down, while charging, instead of up, I've tried using Negative numbers without luck, any Help?
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

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

    well blackshark, you know the drill! post the code soldier! j/k
    or PM it if you want, though making a bar shouldnt be anything to hide...
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  23. #5183
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von EminentJonFrost
    (lol. i still dont get the modules, i'd have to see it.)

    as for the newline, use the other diagonal line. you have "/" when its supposed to be "\".

    and its used like this: file:write("\nText")
    I'm sorry, I typed it wrongly in the post. my program has it going the right way, but it doesn't do anything. Here's the format I'm using: file:write(string1, "\n", string2)

    If there's no newline character for that function, then how do I get new lines in my files?


    As for modules, check out this tut. It's when a lua file connects to another lua file and uses it as code.

  24. #5184
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Blackshark; easiest way is to use screen:fillRect but thats inefficient so ill show you somethin else:

    Code:
    barfill = 0
    bar = Image.createEmpty(10,100)
    bar:clear(colorofbar)
    while true do
    screen:clear()
    pad = Controls.read()
    if pad:l() then barfill = barfill + 0.2 end --or some other number
    screen:blit(x,*the number you want to be the bottom of the bar*-barfill,bar,0,0,10,barfill)
    if barfill > 100 then barfill = 100 end
    if barfill == 100 and *buttontobepressedtoactivateattackispressed* then
    *dotheattack*
    barfill = 0
    end
    screen.waitVblankStart()
    screen.flip()
    end

  25. #5185
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    It works for me. What is your exact code?
    well, i never actualy tried using "~", i just assumed it would not work :P
    did it work with tables though? i'd expect it not to, buts its what i need it for.

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

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

    Standard

    Sorry to ask again but what do I put where it say number dpiX/Y and what is ther original width and height or the normal print function lettering.

    Font Font:setCharSize(number width, number height, number dpiX, number dpiY)
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  27. #5187
    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 eyece
    well, i never actualy tried using "~", i just assumed it would not work :P
    did it work with tables though? i'd expect it not to, buts its what i need it for.
    Yes it did which is why I asked for the exact code.

    Zitat Zitat von PSPhakkor
    I'm sorry, I typed it wrongly in the post. my program has it going the right way, but it doesn't do anything. Here's the format I'm using: file:write(string1, "\n", string2)

    If there's no newline character for that function, then how do I get new lines in my files?


    As for modules, check out this tut. It's when a lua file connects to another lua file and uses it as code.
    Printing to the screen, the newline character doesn't work. 'Printing' to files, the newline character 'works' as intended.

    As for your module question, it looks like the variable has to exist in the module to be used in the module.
    -= Double Post =-
    Did a bit of research. The "\n" does work for files BUT it uses the 'unix' version of newline which notepad does not recognise. Use notepad2, Crimson Editor, Notepad++ (basically any decent text editor) and you 'see' it.
    Geändert von yaustar (01-20-2007 um 05:32 PM Uhr) Grund: Automerged Doublepost

  28. #5188
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Crimson Editor Rules!
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  29. #5189
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Wow. Thanks for doing research for me!

    So you're saying that if I use a different text editor, It will work? That's funny.

    Unfortunately, I'm limited to LuaDevKit because I don't have my psp at the moment, and I can only test my programs on its tester thing. It's really handy.

    However, I did realize that when I used "\n" (or whatever is the correct one, I can't remember!), it wasn't outputted to the file. Unfortunately, neither was the new line. I just got the two strings right next to each other. I hope the different editor will fix this.


    Thanks again for your time

  30. #5190
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    hehe ya, LuaDevKit is pretty handy for debugging
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.


 

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

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