Seite 269 von 342 ErsteErste ... 169 219 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 319 ... LetzteLetzte
Zeige Ergebnis 8.041 bis 8.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; this is what i found online: *a - reads the entire file from the current position. ex: file.read("*a") so i ...

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

    this is what i found online:

    *a - reads the entire file from the current position. ex: file.read("*a")

    so i don't know what went wrong for you



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

    For anyone who cares and develops in KDevelop,Kate,KWrite or KEdit, I have added all the PSP LuaPlayer functions to the SVN (much better than the default(which doesn't even support block comments or code collapsing) ) syntax highlighting script.

    Put the lua.xml of your choice in ~/.kde/share/apps/katepart/syntax/ or /opt/kde/share/apps/katepart/syntax/ (depending on your distribution)

    Please post any suggestions/problems/comments.
    Angehängte Dateien Angehängte Dateien
    Geändert von Nielkie (10-13-2007 um 07:30 AM Uhr)

  3. #8043
    BJ2
    BJ2 ist offline
    QJ Gamer Blue
    Points: 3.280, Level: 35
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 73,0%

    Registriert seit
    Sep 2007
    Beiträge
    53
    Points
    3.280
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    hello, i have only just started learning lua yesterday and am VERY new to it so please don't be harsh.
    i try to add a background to my simple text and it doesn't work, this is my lua script:
    Code:
    red = Color.new(255, 0, 0)
    blue = Color.new(0, 0, 255)
    green = Color.new(0, 255, 0)
    white=Color.new(255,255,255)
    
    background = Image.load("background.png")
    screen.flip()
    screen.waitVblankStart()
    
    screen:print(130, 130, "background", white)
    screen:print(100, 200, "SUPID BACKGROUND ISN'T WORKING!!!", red)
    screen.flip()
    
    while true do
    screen.waitVblankStart()
    end
    i know that this is probably i very easy answer for most of you but it isn't working for me and i need to know why. i have a 480 by 272 pivture in the same folder called background and it is a .PNG picture

    thanks for the help
    Geändert von BJ2 (10-14-2007 um 10:21 PM Uhr)

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

    Aye, it is a simple mistake. Common among new developers as the tutorials are misleading (IMO). There are a few mistakes ultimately making it not do as you wish. For one, you aren't ever really blit'ing the image ,rather just loading it into the var 'background' and printing the var's name ;). Secondly, you have an even number of screen.flip()'s therefore making anything you wish to actually display 'hidden'. It's best to only have 1 screen.flip() and 1 screen.waitVblankStart() (unless you have specific needs for them). Since you aren't doing anything needing to continually check for something, you just need an indefinate delay at the end, nothing more :)
    Code:
    red = Color.new(255, 0, 0)
    blue = Color.new(0, 0, 255)
    green = Color.new(0, 255, 0)
    white=Color.new(255,255,255)
    
    background = Image.load("background.png")
    
    screen:blit(0,0,background)
    
    screen.waitVblankStart()
    screen.flip()
    
    while true do
    end
    P.S. Use [ code][/ code] tags as well, they prevent smilies and preserve tabs) And yeah, if you do get flamed, it's no biggie, ask one of the vet's to look over the situation to see what's really what ;)

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


  5. #8045
    BJ2
    BJ2 ist offline
    QJ Gamer Blue
    Points: 3.280, Level: 35
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 73,0%

    Registriert seit
    Sep 2007
    Beiträge
    53
    Points
    3.280
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    thanks, but it still doesn't work, i even tried to copy and paste the code you wrote. i also fixed the
    Code:
    white =Color.new(255, 255, 255)
    so there was a space between the = and the C.

    btw, im using "luaplayerwindows-0.20"
    lua for the computer. i dont yet know how to make it an eboot

  6. #8046
    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

    What's your error exactly? You probably don't have the background.png in the same folder. The space between the = and C isn't an error. And you don't make Lua scripts into EBOOTs ;) You get the Lua Player for PSP and run the script just like on windows.

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


  7. #8047
    BJ2
    BJ2 ist offline
    QJ Gamer Blue
    Points: 3.280, Level: 35
    Level completed: 54%, Points required for next Level: 70
    Overall activity: 73,0%

    Registriert seit
    Sep 2007
    Beiträge
    53
    Points
    3.280
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    kk, thaks a bunch for the help SG57. i finaly figured out how to fix, it was i nooby mistake of having the pic a different format to what i wrote.
    thanks again :)

    and i figured out my lua for PC doesn't work (can't do anything except text on a black background ), cause the exact thing works on my psp.

    anyone got a link to a Lua player for PC that works properly,
    thanks
    Geändert von BJ2 (10-16-2007 um 06:10 AM Uhr)

  8. #8048
    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

  9. #8049
    QJ Gamer Blue
    Points: 5.636, Level: 48
    Level completed: 44%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    300
    Points
    5.636
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Does anyone know how I can blit 25 10x10 images over 3D objects? For some reason, whenever I try to do it, it goes behind the 3D model. :/

  10. #8050
    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

    I don't think you can. However you can compromise by bliting the Image as a 3D model (two textured triangles)

    That problem will be fixed in the next version of Lua Player.

  11. #8051
    Ænima
    Points: 6.447, Level: 52
    Level completed: 49%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Sep 2007
    Beiträge
    587
    Points
    6.447
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Highsight
    Does anyone know how I can blit 25 10x10 images over 3D objects? For some reason, whenever I try to do it, it goes behind the 3D model. :/
    I don't know anything about 3D yet, but I would guess that you just have to make sure you're blitting the images after you blit your textures.

  12. #8052
    QJ Gamer Blue
    Points: 5.636, Level: 48
    Level completed: 44%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    300
    Points
    5.636
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie
    I don't think you can. However you can compromise by bliting the Image as a 3D model (two textured triangles)

    That problem will be fixed in the next version of Lua Player.
    That sounds like it could work fine, the only problem is I need to ensure that it stays exactly in the top left corner of the screen, rather than staying somewhere on the 3D plane. Any suggestions on how I could do that?

  13. #8053
    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 dunno if lua supports depth testing, but try this: (this is the 'traditional' way to do in in the GU)

    1. turn depth test on
    2. do all 3d stuff
    3. turn depth test off
    4. blit image to top right corner.

    done
    --------------------------------------------------------------------------------------

  14. #8054
    QJ Gamer Blue
    Points: 5.636, Level: 48
    Level completed: 44%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    300
    Points
    5.636
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    i dunno if lua supports depth testing, but try this: (this is the 'traditional' way to do in in the GU)

    1. turn depth test on
    2. do all 3d stuff
    3. turn depth test off
    4. blit image to top right corner.

    done
    Sadly, that is what I've been trying to do, I guess it doesn't support depth testing. :/

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

    Where can i get information on how to compile the oslib(oldschool library) on windows? ive searched the docs and googled it to the bone, any body know?
    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.

  16. #8056
    Ænima
    Points: 6.447, Level: 52
    Level completed: 49%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Sep 2007
    Beiträge
    587
    Points
    6.447
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Shouldn't that question be in C help? Anyway, there's probably some documentation in the readme. If not, check the Makefile, it'll be there.

  17. #8057
    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

    whoops, wrong topic :S sorry
    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.

  18. #8058
    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

    Zitat Zitat von Highsight
    That sounds like it could work fine, the only problem is I need to ensure that it stays exactly in the top left corner of the screen, rather than staying somewhere on the 3D plane. Any suggestions on how I could do that?
    If you leave out the Gu.translate statement when drawing the image, then the coordinates in the model table will be relative to the top corner instead of the center of the screen. For an example, take a look at this function (the gu start and end calls aren't use inside the function because if you use this to draw a lot of images it works faster to start and stop the gu before and after doing all the calls to this function):

    Code:
    function Gu.blit(x, y, image, scale, flip)
    	
    	if scale then
    		if type(scale) == "string" then 
    			flip = scale
    			scale = 1
    		else
    			scale = (scale/100) 
    		end
    	end
    	
    	if flip then
    		if flip == "H" then
    			x_start = image:width()
    			y_start = 0
    			x_end  = 0
    			y_end = image:height()
    		elseif  flip == "V" then
    			x_start = 0
    			y_start = image:height()
    			x_end  = image:width()
    			y_end = 0
    		elseif flip == "HV" then
    			x_start = image:width()
    			y_start = image:height()
    			x_end = 0
    			y_end = 0
    		end
    	else
    		x_start = 0
    		y_start = 0
    		x_end = image:width()
    		y_end = image:height()
    	end
    	
    	temp = {
    	{x_start, y_start, x, y, 0},
    	{x_end, y_end, (image:width()*scale)+x, (image:height()*scale)+y, 0}
    	}
    	Gu.enable(Gu.TEXTURE_2D)
    	Gu.texImage(image)
    	Gum.drawArray(Gu.SPRITES, Gu.TEXTURE_32BITF+Gu.VERTEX_32BITF+Gu.TRANSFORM_2D, temp)
    end

  19. #8059
    QJ Gamer Blue
    Points: 5.636, Level: 48
    Level completed: 44%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    300
    Points
    5.636
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Well, in that case, it looks like that function you just posted should do it! But I must be using it wrong, whenever I try to use it, nothing shows up. when I use it I enter in "Gu.blit(0, 0, (image name), 100, false)"

    Did I do something wrong? :/

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

    The last argument, "flip" is not a boolean, it takes one of 3 strings: "H" to flip horizontal, "V" to flip vertical, and "HV" to flip it both ways. If you don't want to flip the image just leave it out: "Gu.blit(0, 0, (image name), 100)"

  21. #8061
    QJ Gamer Blue
    Points: 5.636, Level: 48
    Level completed: 44%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    300
    Points
    5.636
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Ok, I figured it out, I just had it outside of the gu.start method. XD It is almost working, it is bliting as a 3D object with a texture, but it is still behind all the other 3D objects. Any ideas how to fix that? As soon as that is done, it will all work!

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

    about the only thing I can think of for that is to mess around with the z coords inside the model table

  23. #8063
    QJ Gamer Blue
    Points: 5.636, Level: 48
    Level completed: 44%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    300
    Points
    5.636
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    HAHA! That did it! I just made the z values 1000000000000000000. Thanks so much Merick! Expect your name in my MazeGen credits. ;)

  24. #8064
    QJ Gamer Blue
    Points: 3.563, Level: 37
    Level completed: 43%, Points required for next Level: 87
    Overall activity: 54,0%

    Registriert seit
    Sep 2007
    Beiträge
    149
    Points
    3.563
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Is it possible to play a sound when you hit a button.

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

    yes it is

  26. #8066
    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

    request - conversions

    i would like as many people as possible to help with this

    i would like and and all of the conversions for lua code to c and vice versa

    e.g.

    screenrint = pspDebugScreenPrintf

    and so on for a program that i am makeing to help people who know lua to learn c as i do not yet know c myself i cannot convert them all and even if i could i would probably forget some

    the program will help people who know lua to learn c and even if they dont want to lean it it will help them to compile their lua programs into c code

    which would be useful for every one and more people would learn lua and c

    please if you have any conversions for me or have any suggestions of how to do some of the conversions please pm me !!!!!!!!!
    ------ 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).

  27. #8067
    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 FaT3oYCG
    the program will help people who know lua to learn c and even if they dont want to lean it it will help them to compile their lua programs into c code
    You can compile your LUA scripts into C files? How? :ROFL:

  28. #8068
    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

    I'm don't know how to do this with C, however on the FreeBasic messageboard one of the guys posted a macro that will cause a file (of any type) to be compiled into the exe. When the program is run, the data from that file is loaded into a memory buffer. Using this, I was able to compile some scripts into my FreeBasic programs and run them with lual_loadbuffer and lua_pcall

  29. #8069
    QJ Gamer Blue
    Points: 3.563, Level: 37
    Level completed: 43%, Points required for next Level: 87
    Overall activity: 54,0%

    Registriert seit
    Sep 2007
    Beiträge
    149
    Points
    3.563
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    CAn some one put the code for have a sound play when i push a button and an ohther one when i push another button.

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

    Can't you code it yourself, it'll take like 5 lines.


 

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 .