Seite 169 von 342 ErsteErste ... 69 119 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 219 269 ... LetzteLetzte
Zeige Ergebnis 5.041 bis 5.070 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 im trying to get my tab reader working and im trying to print all the lines of a tab ...

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

    Ok im trying to get my tab reader working and im trying to print all the lines of a tab to the screen from a text file named tab.txt and its not working. So far here is my code
    Code:
    --declare some colors and whatnot
    blue = Color.new(0,0,255)
    red = Color.new(255,0,0)
    background = Image.createEmpty(480,272)
    background:clear(blue)
    --main loop
    while true do
    screen:blit(0,0,background)
    --now lets read the tab
    y = 5
    file = io.open("tab.txt","r")
    for line in file:lines() do
    y = y + 5
    screen:print(0,y,line,white)
    end
    file:close
    screen.waitVblankStart()
    screen.flip()
    end
    And here is whats inside my text file
    named tab.txt
    Code:
    -3---3--------------2-0-------|
    -3-----3---3------3-----3---3-|
    -0-------0------2---------2---|
    -0------------0---------------|
    ------------------------------|
    -3----------------------------|
    Im trying to get scrollign to work also if someone could help me there too. and one more thing this line

    Code:
    file = io.open("tab.txt","r")
    What is my tab is in a certain directory wouldnt it be
    Code:
    file = io.open("./tab/tab.txt","r")
    right?

    Could use some help.
    O yah adn the error im getting is like something wrong with the argument screen on line 20 or somethign
    -= Double Post =-
    Anyone?


    Geändert von GuitarGod1134 (01-15-2007 um 01:06 PM Uhr) Grund: Automerged Doublepost
    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!

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

    For one, your asking sooo much of other people. Please - you don't learn anything asking people to write your code for you. You should simply say your error you recieved, what your trying to do and the code on that line.

    I say this because you dont even have 20 lines of code in that thing you posted.. Want help - ask appropriately. And for scrolling, move the X coordinate of the text your printing to the left. Oh and one more thing, default text height in lua is 10 pixels, so y = y + 5 will have every letter cut off from the top by the other...

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


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

    Ok I run it, I changed the y coordinate and I still get an error.

    It thinks or from what I can tell, there is something wrong with screen.waitVblankStart()
    It says
    error :snake.lua:17: function arguments expected near 'screen'
    -= Double Post =-
    O and the 20 lines, I took some notes there for coordinates and stuff but now I removed it and it says the error is on 17. and I dont see anything wrong with screen.waitVblankStart()
    Geändert von GuitarGod1134 (01-15-2007 um 02:20 PM Uhr) Grund: Automerged Doublepost
    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!

  4. #5044
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Didn't you have this question before?? And you got a answer. Plus what is line 20??

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

    No, and its the 20th line of code , but its really the 17th line.
    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!

  6. #5046
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    you should read some tuts. I'm no sure how to do it but i Think this is how:
    Code:
    tab = "./tab/tab.txt"
    file = io.open(tab, "r")
    print(file)

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

    Sticky.
    :)

  8. #5048
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Anti-QJ
    Sticky.
    :)
    What do you mean by sticky the Lua Help Thread??

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

    You see, When its sticky, It stays at the top of the forum, So its easier to find, So i have to pay like 700 points a week to do so, I don't know why a moderator just doesn't do it but it doesn't matter, Cause i got the points to do so.

  10. #5050
    QJ Gamer Blue
    Points: 4.917, Level: 44
    Level completed: 84%, Points required for next Level: 33
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    In a cave according to SG57 lol
    Beiträge
    273
    Points
    4.917
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    How can I make an image move on it's own without any key commands?

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

    Zitat Zitat von ZeroMega
    How can I make an image move on it's own without any key commands?
    well if you did have it controlled with key commands you would do:
    Code:
    if pad:left() then
    image.x = image.x - 2
    end
    so if you want to make it go on it's own, then in your main loop simply put the
    Code:
    image.x = image.x - 2

  12. #5052
    QJ Gamer Blue
    Points: 4.917, Level: 44
    Level completed: 84%, Points required for next Level: 33
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    In a cave according to SG57 lol
    Beiträge
    273
    Points
    4.917
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von emericaska8r
    so if you want to make it go on it's own, then in your main loop simply put the
    Code:
    image.x = image.x - 2
    It keeps saying loop ingettable when I try running it

    Here's the code (I'm using Evil Mana's tute)
    Code:
    --Test
    
    grass = Image.load("grass.png")
    player = Image.load("player.png")
    flower = Image.load("flower.png")
    
    screenwidth = 480 - player:width()
    screenheight = 272 - player:width()
    
    Player = { }
    Player[1] = { x = 200, y = 50 }
    
    -- Function to check player movements
    function playerMovement()
    pad = Controls.read()
    if pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x - 2
    end
    
    if pad:right() and Player[1].x < screenwidth then
    Player[1].x = Player[1].x + 2
    end
    
    if pad:up() and Player[1].y > 0 then
    Player[1].y = Player[1].y - 2
    end
    
    if pad:down() and Player[1].y < screenheight then
    Player[1].y = Player[1].y + 2
    end
    end
    
    -- Function to paste images to screen
    function pasteImages()
    for a = 0, 14 do
    for b = 0,8 do
    screen:blit(32 * a, 32 * b, grass)
    end
    end
    
    screen:blit(100,100,flower)
    screen:blit(300,220,flower)
    
    screen:blit(Player[1].x,Player[1].y,player)
    end
    
    -- Main Loop
    while true do
    
    screen:clear()
    
    pasteImages()
    
    playerMovement()
    
    screen.waitVblankStart()
    screen.flip()
    end
    Where would I put the script so flower can move?

  13. #5053
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Do it like this:
    Code:
    while true do
    image = Image.load("image.png")
    image.x = image.x-2
    screen:blit(image.x,0,image,false)
    end
    -= Double Post =-
    ITS THE SAME THING I DID!!??
    Geändert von pspfreak9 (01-15-2007 um 06:51 PM Uhr) Grund: Automerged Doublepost

  14. #5054
    QJ Gamer Blue
    Points: 4.917, Level: 44
    Level completed: 84%, Points required for next Level: 33
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    In a cave according to SG57 lol
    Beiträge
    273
    Points
    4.917
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak9
    ITS THE SAME THING I DID!!??
    I'm using this tutorial as my main example
    http://evilmana.com/tutorials/lua_tutorial_08.php

    btw i dont know where to put the code

  15. #5055
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Ok. I gotta loading bar that displays a red line. If it were 50% loaded it would be halfway filled up and if it were at 100% it would be filled completely up. Now I wanna know how I can make to where I can change the percentage each time something is loaded.

    Like:

    Code:
    if Image.load("something.png") then
    data.loaded = 50
    end
    But that doesn't seem to bring it to being halfway filled up. Actually it displays an error message. Is there a way where if I load something it will raise the loading bar by however much?

  16. #5056
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    IS data.loaded a real function??

  17. #5057
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    No i made it before the loop. It looks like this.

    Code:
    data {}
    data.loaded = 0
    while true do

  18. #5058
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    ok do this:
    Code:
    if data.loaded = 50 then
    Image.load("50.png")
    end
    You know most people just make a loading bar animation when nothing is being loaded. But if you wanna do that add a random feature that changes the thime of loading each time. ;)

  19. #5059
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    that would take a lot of different image files. :X

    EDIT: and even if I decided to do that it still goes back to my question. how would I raise data.loaded everytime I loaded something.

  20. #5060
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    I told you just make a load bar that doesnt have to do with the data. And add different ones that take different time. Then make them random thats should make it seem like it's real.

  21. #5061
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    I don't want it to seem real.. I want it to be real.. O_o

  22. #5062
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Whats loading in your game??

  23. #5063
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Just like the maps, menus, extra data, libraries.. That stuff. But I only want it on a loading menu to look cool. ;)

  24. #5064
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    While can I see part of your code then??

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

    Cheez_Pirate. Add to a variable after each image is loaded. Print out that variable in a percent form. Or if you want a loading bar, do the same but apply it to the sourcex/sourcey of an image when blitting.

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


  26. #5066
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    I'm having a hard time understanding that SG57. I'm trying to do something like.. A GTA loading screen. It's the very first thing that comes up on GTA except the rockstar logo. It pretty much loads the bigger parts in the game such as the maps weapons and characters. And everytime something is loaded the bar will go farther.

    EDIT: 300th post.

  27. #5067
    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

    screen:fillRect(x,y,varua ble,h,color)

    Make a variable and as you load the stuff make the variable go up.

    IE Image.load("img.png") loadingvariable = loadingvariable + 1

    Then with screen:fillRect fill in the rectangle and where i put variable in it thats the width of the bar, the higher the number gets the wider the bar gets.

  28. #5068
    Points: 3.536, Level: 37
    Level completed: 24%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    14
    Points
    3.536
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    just a quick question about sprite sheets

    if your using a sprite sheet with animlibv.4 does the sprite sheet have to be 272 in hight and 480 in diamiter to work?

    I am using my own sprite sheet which is about 500 by 600, though the individual images on the sprite sheet are 240 by 200. when i load the program, it gives me a cannot load image error.

    If this isnt possible , is there a way to shrink my sprite sheet, then use a code to magnify each frame to the size it was intended to be?


    does anyone no how to solve this ?

    Thanks

  29. #5069
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TacticalPinguin
    screen:fillRect(x,y,varua ble,h,color)

    Make a variable and as you load the stuff make the variable go up.

    IE Image.load("img.png") loadingvariable = loadingvariable + 1

    Then with screen:fillRect fill in the rectangle and where i put variable in it thats the width of the bar, the higher the number gets the wider the bar gets.
    It works. But it will reload the image everytime it loops. :o Like the orange light will blink non-stop.

  30. #5070
    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 yotop456
    just a quick question about sprite sheets

    if your using a sprite sheet with animlibv.4 does the sprite sheet have to be 272 in hight and 480 in diamiter to work?

    I am using my own sprite sheet which is about 500 by 600, though the individual images on the sprite sheet are 240 by 200. when i load the program, it gives me a cannot load image error.

    If this isnt possible , is there a way to shrink my sprite sheet, then use a code to magnify each frame to the size it was intended to be?


    does anyone no how to solve this ?

    Thanks

    animation lib supports all sizes that are compatible with lua. you CANNOT load ANY image greater than 512x512 in lua, which you are attempting to do.
    --------------------------------------------------------------------------------------


 

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 .