Seite 90 von 342 ErsteErste ... 40 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 140 190 ... LetzteLetzte
Zeige Ergebnis 2.671 bis 2.700 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; OKay I wrote this code so when you press X you throw something. But I have to hold X for ...

  
  1. #2671
    Is in your zone.
    Points: 24.342, Level: 94
    Level completed: 99%, Points required for next Level: 8
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Jacksonville, FL
    Beiträge
    3.429
    Points
    24.342
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    OKay I wrote this code so when you press X you throw something. But I have to hold X for it to travel across the screen. What would I put in the code?
    Code:
    if pad:cross() then
       
       if z == 2 then
          poox = poox + poospeed
       elseif z == 1 then
          poox = poox - poospeed
       end
       screen:blit(poox, pooy, poo)
        if poox >= 480 then
          poox = player.x
          pooy = player.y + 12
        elseif poox <= 0 then
          poox = player.x
          pooy = player.y + 12
        end
    end



    --XBL Gamertag: PhenoM904--

  2. #2672
    QJ Gamer Green
    Points: 5.866, Level: 49
    Level completed: 58%, Points required for next Level: 84
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Dark_Alex Command Center
    Beiträge
    597
    Points
    5.866
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    I am having trouble using \n (newline) option with lua 0.16 and .20. here is my code...

    --Readfile config file, print
    --


    red = Color.new(255, 0 , 0)
    black= Color.new(0,0,0)
    white= Color.new(255,255,255)
    blue= Color.new(0,0,255)
    grey= Color.new(192,192,192)


    file = io.open("TODO", "r")
    if file then
    screen:clear(white)
    screenrint(140,126,"File Found")
    screen.flip()
    System.sleep(2000)
    screen:clear(white)
    for line in file:lines() do
    screenrint(10,10,line .. "\n")
    screen.flip()
    end

    end

    else
    screen:clear(black)
    screenrint(140,100,"file Don`t Exist!",red)
    screen.flip()
    end


    ---------------------------------
    What i want it to do is print the textfile to screen which it does but it only prints one line and goes off screen i want to use \n newline option but it doesn't seem to work for me. Instead of newline i get a wierd circle symbol. I am also using ttlde2.0 to edit and run my lua scripts if that helps.
    Thanks for any help
    [FONT=Fixedsys][spoiler="PSP DAX_Hacks"]PSP1001 3.71-M33-4 ------------------------------------------
    - 17 Diff Castlevania Games on 4Gb Stick Cps2psp2.30 - MVSpsp[/FONT][FONT=Fixedsys]2.30[/FONT][FONT=Fixedsys] + Bootlegs - gpSP09 - PsUltraRip - Manhunt2 Uncensored
    [/spoiler] [/FONT][FONT=Fixedsys]Consoles Pwnd: PSP, Xbox360
    Pwnd: PSP, PSOne, PS2, Xbox360
    [/FONT]

  3. #2673
    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 MaSt3r_ShAk3
    OKay I wrote this code so when you press X you throw something. But I have to hold X for it to travel across the screen. What would I put in the code?
    Code:
    if pad:cross() then
       
       if z == 2 then
          poox = poox + poospeed
       elseif z == 1 then
          poox = poox - poospeed
       end
       screen:blit(poox, pooy, poo)
        if poox >= 480 then
          poox = player.x
          pooy = player.y + 12
        elseif poox <= 0 then
          poox = player.x
          pooy = player.y + 12
        end
    end

    try this:

    Code:
    if pad:cross() and oldpad:cross() ~= pad:cross() then
    if poofire == false then
    poofire = true
    elseif poofire == true then
    poofire = true
    end
    THEN put:

    Code:
    if poofire == true then
      if z == 2 then
          poox = poox + poospeed
       elseif z == 1 then
          poox = poox - poospeed
       end
       screen:blit(poox, pooy, poo)
        if poox >= 480 then
          poox = player.x
          pooy = player.y + 12
        elseif poox <= 0 then
          poox = player.x
          pooy = player.y + 12
        end
    end
    youll have to put in oldpad statements tho.
    --------------------------------------------------------------------------------------

  4. #2674
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    i am having the same problem as mstrhelix if anyone could help
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  5. #2675
    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 Glynnder- PSPro
    i am having the same problem as mstrhelix if anyone could help
    i could try, i guess.
    --------------------------------------------------------------------------------------

  6. #2676
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    You cant use it to go to a next line on the screen, because it doesnt know what a return is. It works when you write to a file.
    For the screen you have to have a variable for the y coordinate and add 8 to it for every new line.

    BTW Grimfate why do you post that you will try, what help is that?
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

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

    or to solve the throwing problem you could just use a loop like:

    Code:
    if pad:cross() then
    while true do
    poox = poox + speed
    if poox > 480 then
    throw = false
    end
    else
    screen:blit(poo)
    end

  8. #2678
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    well pplease can u help? that would help lol!

    Also, i get what u mean with the variable thing...
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  9. #2679
    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 emericaska8r
    or to solve the throwing problem you could just use a loop like:

    Code:
    if pad:cross() then
    while true do
    poox = poox + speed
    if poox > 480 then
    throw = false
    end
    else
    screen:blit(poo)
    end

    that would work, but you cant have too many loops.

    @ gynnder -PSPro, i need your code.
    --------------------------------------------------------------------------------------

  10. #2680
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    It sets the transparency. 0 is no transparency and 255 is full transparency.
    OK thanks, how do i use it in screen:blit() then?
    --Vaza

  11. #2681
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    kk, i'll try and give it to you, its gonna be simple cos its part of something huge!

    Also, why aint this a sticky anymore?
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  12. #2682
    Developer
    Points: 12.360, Level: 72
    Level completed: 78%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    Isle of Wight
    Beiträge
    491
    Points
    12.360
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Yea I dunno why its not a sticky. Its harder to find.


    PM me for a sig like this!

    http://dspspforums.com/forums/index.php SIGN UP NOW!

  13. #2683
    QJ Gamer Green
    Points: 7.598, Level: 58
    Level completed: 24%, Points required for next Level: 152
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    NoWhere . . . .
    Beiträge
    1.266
    Points
    7.598
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    I got two questons
    1.
    Can any one help me I want my program to Save a irda signal to a variable on a botton press while selecting an object on a menu.
    This is what I have so far:
    Code:
    if pad:circle() and menustatus == -1 then
    irdasignal = System.irdaRead()
    end
    2.
    when I hit left or right my pic. doesnt move but when I hit up or down it moves .
    Code:
    red = Color.new(255, 0, 0);
    white = Color.new(255, 255, 255);
    
    char = Image.load("char.png")
    
    y = 100
    x = 100
    
    while true do
    	screen:clear()
    	-- read current pad
    	pad = Controls.read()
    
    		if pad:up() then
    			y = y - 1
    		elseif pad:down() then
    			y = y + 1
    		elseif pad:left() then
    			X = x - 1
    		elseif pad:right() then
    			X = x + 1
    		end
    	screen:blit(x, y, char, 0, 0, char:width(), char:height(), true)
    screen.flip()
    	screen.waitVblankStart()
    	if pad:start() then break end
    end

  14. #2684
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von zmathue
    I got two questons
    1.
    Can any one help me I want my program to Save a irda signal to a variable on a botton press while selecting an object on a menu.
    This is what I have so far:
    Code:
    if pad:circle() and menustatus == -1 then
    irdasignal = System.irdaRead()
    end
    2.
    when I hit left or right my pic. doesnt move but when I hit up or down it moves .
    Code:
    red = Color.new(255, 0, 0);
    white = Color.new(255, 255, 255);
    
    char = Image.load("char.png")
    
    y = 100
    x = 100
    
    while true do
    	screen:clear()
    	-- read current pad
    	pad = Controls.read()
    
    		if pad:up() then
    			y = y - 1
    		elseif pad:down() then
    			y = y + 1
    		elseif pad:left() then
    			X = x - 1
    		elseif pad:right() then
    			X = x + 1
    		end
    	screen:blit(x, y, char, 0, 0, char:width(), char:height(), true)
    screen.flip()
    	screen.waitVblankStart()
    	if pad:start() then break end
    end
    1. I dont use IRDA so i don know

    2.

    Code:
    red = Color.new(255, 0, 0);
    white = Color.new(255, 255, 255);
    
    char = Image.load("char.png")
    
    y = 100
    x = 100
    
    while true do
    	screen:clear()
    	-- read current pad
    	pad = Controls.read()
    
    		if pad:up() then
    			y = y - 1
    		elseif pad:down() then
    			y = y + 1
    		elseif pad:left() then
    			X = x - 1
    		elseif pad:right() then
    			X = x + 1 --Caps lock on for first X but not on for 2nd X, same with Pad:left().
    		end
    	screen:blit(x, y, char, 0, 0, char:width(), char:height(), true)
    screen.flip()
    	screen.waitVblankStart()
    	if pad:start() then break end
    end

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

    for the ir signal, my only advice would be to look at the ir source code of the program that is bundled into lua player when u get it.

  16. #2686
    QJ Gamer Green
    Points: 7.598, Level: 58
    Level completed: 24%, Points required for next Level: 152
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    NoWhere . . . .
    Beiträge
    1.266
    Points
    7.598
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    um all that does is store it to the variable for like a second then the variable is replaced with null or another empty data.

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

    Whar is the Analog configuration how do i use it EX:

    if nub:up() then ...
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  18. #2688
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ZereoX
    Whar is the Analog configuration how do i use it EX:

    if nub:up() then ...
    i think its:
    if pad:analog() >/</~=/== [number in degrees] then

    ex.

    if pad:analog() > 45 then
    screenrint(10, 10, "Test", red)
    end

    This means that if the Analog is at a angle that is greater than 45 Degrees then the text will print.

    --Vaza

  19. #2689
    Developer
    Points: 7.821, Level: 59
    Level completed: 36%, Points required for next Level: 129
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    751
    Points
    7.821
    Level
    59
    Downloads
    0
    Uploads
    0

    Standard

    Thanks Vaza... That help me alot too!

    (Off subject) haha... it won't let you post screen: print!

  20. #2690
    &lt;img src=&quot;images/smilies/psp.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&quot;inlineimg&quot; /&gt; &lt;img src=&quot;images/smilies/Punk.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    what sound files does lua player surrport>
    is it just mod an wav,, or is there anything else

  21. #2691
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Sousanator
    what sound files does lua player surrport>
    is it just mod an wav,, or is there anything else
    The Mod family and WAV.
    Mod Family consists of Mod, XM, IT, S3M and many more.
    --Vaza

  22. #2692
    &lt;img src=&quot;images/smilies/psp.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&quot;inlineimg&quot; /&gt; &lt;img src=&quot;images/smilies/Punk.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    thanks,,
    but when i convert a mid to an xm, or it,, it wont play right,, is that normal,

  23. #2693
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    errr, didn't think so...
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  24. #2694
    &lt;img src=&quot;images/smilies/psp.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&quot;inlineimg&quot; /&gt; &lt;img src=&quot;images/smilies/Punk.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    i just did a whole bunck of checks,,
    turns out im processing too much at the same time,, cause the music to be chuncky,,
    anyway to avoid that(on pc, it sounds nice)

    and what is the proper way to exit your game from lua player,,
    since break, just breaks the loop,, (and music continues and such)

  25. #2695
    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 Sousanator
    i just did a whole bunck of checks,,
    turns out im processing too much at the same time,, cause the music to be chuncky,,
    anyway to avoid that(on pc, it sounds nice)

    and what is the proper way to exit your game from lua player,,
    since break, just breaks the loop,, (and music continues and such)

    yes i hate it when i quit a game and the music is still playing from it.

  26. #2696
    QJ Gamer Green
    Points: 7.598, Level: 58
    Level completed: 24%, Points required for next Level: 152
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    NoWhere . . . .
    Beiträge
    1.266
    Points
    7.598
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    well you got to kill the music playing before you exit.

  27. #2697
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    anyone good with AI? i have a game with AI but it wont load

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

    Anyone has a good and easy wait to make a scrolling map where you can move a guy.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  29. #2699
    &lt;img src=&quot;images/smilies/psp.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&quot;inlineimg&quot; /&gt; &lt;img src=&quot;images/smilies/Punk.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    well you got to kill the music playing before you exit.
    but even if you do that, the game still continues to run in the bg

  30. #2700
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    It does say so, but if you think about it, you do exit the game loop so it isn't running anymore. I don't know why its saying it is.

    @Vaza
    transparency:
    Code:
    redTrans=Color.new(255, 0, 0, 128)
    transparantPic=Image.createEmpty(width, height)
    transparantPic:clear(redTrans)
    screen:blit(x,y,image,0,0,width,height,true)
    This will create a square of width and height, ay x and y, that has a half-transparant red color. The boldfaced 128 is why its half-transparant. 255 would mean fully transparant and 0 not transparant. Also you have to put true in screen:blit so it knows there are transparant pixels in the image.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]


 

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

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