Seite 181 von 342 ErsteErste ... 81 131 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 231 281 ... LetzteLetzte
Zeige Ergebnis 5.401 bis 5.430 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; BlackShark - And you did such an awesome job on it too... Honestly, anyone in their right mind thinking a ...

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

    BlackShark - And you did such an awesome job on it too... Honestly, anyone in their right mind thinking a custom firmware had been written in Lua, let alone written by a novice (shown in your sig by homebrew releases), is NOT in their right mind... And quit being so conceited, you didnt even answer his question... (hopefully you can for htat matter)

    xtreme - Your looking to use a timer... In this code below, itll do as you say, and add a '.' every 1 second, after 3 periods have been added, itll reset:
    Code:
    timer = Timer.new()
    timer:start()
    
    red = Color.new(255,0,0)
    
    while true do
         screen:clear()
    
         screen:print(208,131,"Bricking",red)
    
         if timer:time() >= 1000 and timer:time() < 2000 then
           screen:print(272,131,".",red)
         elseif timer:time() >= 2000 and timer:time() < 3000 then
           screen:print(272,131,"..",red)
         elseif timer:time() >= 3000 and timer:time() < 4000 then
           screen:print(272,131,"...",red)
         elseif timer:time() >= 4000 then
           timer:reset()
           timer:start()
         end
         screen.waitVblankStart()
         screen.flip()
    end



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


  2. #5402
    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 xtreme0915
    yeah, but i just want to code simple text for now. i have

    blue = Color.new(0, 0, 255)

    screenrint(200, 130, "Bricking", blue)
    screen.flip()

    while true do
    screen.waitVblankStart(60 )

    screenrint(200, 130, "Bricking.", blue)
    screen.flip()

    while true do
    screen.waitVblankStart(60 )

    screenrint(200, 130, "Bricking..", blue)
    screen.flip()

    while true do
    screen.waitVblankStart(60 )

    screenrint(200, 130, "Bricking...", blue)
    screen.flip()

    end

    but it doesnt work, any advice?
    just remove all the while true do's, since your are not looping.

    actually, since you wanted it to repeat you could just do one big 'while true do' loop around all the code, with and 'end' at the end.

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

    Code:
    blue = Color.new(0, 0, 255)
    dots = {".","..","..."}
    i=1
    while true do
    if i <= 3 then
    screen:print(200,130,"bricking" .. dots[i], blue)
    i=i+1
    screen.flip()
    screen.waitVblankStart(60)
    else
    --' code to run after message
    end
    end
    edit: damn this forum RTE sucks.
    Geändert von eyece (01-29-2007 um 04:12 PM Uhr) Grund: Automerged Doublepost

  4. #5404
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    thx, where do you guys learn all this stuff? ive seen the two tuts but other than that nothing

  5. #5405
    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 SG57
    BlackShark - And you did such an awesome job on it too... Honestly, anyone in their right mind thinking a custom firmware had been written in Lua, let alone written by a novice (shown in your sig by homebrew releases), is NOT in their right mind... And quit being so conceited, you didn't even answer his question... (hopefully you can for that matter)
    Golly G wiz!

    release one prank bricker and the world is out to get you! :/, Plus it wasn't for QJ readers, it was to be USED by qj readers on a friend or something :/, I wasn't being conceited was I?

    Well Xtreme, SG answered your Question pretty well, so give it a try,
    good luck
    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. #5406
    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 eldiablov
    looks like i need to get learning. Links ? i thought gu was only for 3d ?
    Stick a texture on a quad and volia, we have a sprite.

    Links: http://wiki.ps2dev.org/psp:lua_playe...#3d_gu_mapping
    Look at the GDI tutorial which will help you get going but not understand what you are actually doing or calling.

    Also look at other source code such as yoursam's Wedge Racer.

    If you really want to start getting serious in programming, I recommend looking at learning vector and matrix math which you really start to use for various tasks.

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

    How would I access a file in "ms0:/seplugins/"?

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

    Code:
    yourFile = io.open("ms0:/seplugins/whateverFile.extension","r")
    You have read-only permission, meaning you cant write to a file through this file stream.

    eyece - I would have done it that way, but it's inefficient to use for loops when you can easily unwrap yourself.... Plus, it's a tad unneeded to store incremental '.'s in an array.. Just use the 'i' var to determine how many periodsyou want, no need to make an array for them...

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


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

    System.listDirectory("ms0 :/seplugins/")

    give that a try no guarrenties but this should work.
    NVM, SG beat me to the punch!
    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.

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

    if I use "w" as the second arguement will I be able to write?

    and on another note, what's up with people capitalizing words in their function and variable names? Just an extra keystroke to me

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

    LUA Player is case-sensitive
    Yes, You will be able to write

  12. #5412
    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

    another question: can someone explain to me how to use

    table System.listDirectory( [path] )

    because I
    m clueless how a "table of tables" works. The ps2dev wiki doesnt say how to access each element, like if I wanted the name of the first file in the directory, how would I get that? the example they gave didn;t work wit the error "attempt to call a table value"

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

    I would have done it that way, but it's inefficient to use for loops when you can easily unwrap yourself.... Plus, it's a tad unneeded to store incremental '.'s in an array.. Just use the 'i' var to determine how many periodsyou want, no need to make an array for them...
    as far as i know there is no way to repeat a string based on the value of a variable.
    , unless you make your own function.

  14. #5414
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    ok, thx you guys, one more thing, how can i make one timer end and lead into another

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

    PSPhackor -
    Code:
    files = System.listDirectory("ms0:/")
    			
    for i=1, table.getn(files) do
    	screen:print(0,i*20,files[i].name,Color.new(255,255,255))
    	screen:print(300,i*20, "Size: " .. files[i].size,Color.new(255,0,126))
    	if files[i].directory then screen:print(200,i*20, "Directory",Color.new(0,255,0)) else screen:print(200,i*20, "File",Color.new(255,255,255)) end
    end
    
    screen.flip()
    
    while true do
    	screen.waitVblankStart()
    end
    That should print out whatever is on the root of your PSP, its size, and whether or not its a directory.

    xtreme - Im not sure waht you mean... But..
    Code:
    timer = {Timer.new(),Timer.new()}
    
    timer[1].start()
    
    while true do
         if timer[1]:time() >=1000 then
              timer[2]:reset(timer[1]:time())
              timer[2]:start()
              timer[1]:stop()
         end
    end
    eyece - This is what i meant, but having only 3 values to check doesnt really have one single way to do something
    Code:
    green = Color.new(0, 255, 0)
    i=0
    while true do
    	screen:print(208,131,"Bricking" , green)
    	if i>=1 then screen:print(272,131,".",green) end
    	if i>=2 then screen:print(282,131,".",green) end
    	if i>=3 then screen:print(292,131,".",green) end
    	screen.flip()
    	screen.waitVblankStart(60)
    	if i<=3 then i = i + 1 else break end
    end
    while true do end -- code to run after message
    Geändert von SG57 (01-29-2007 um 06:47 PM Uhr)

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


  16. #5416
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    how can i make

    timer = Timer.new()
    timer:start()

    while true do
    screen:clear()

    screenrint(153,131,"Preparing flash0",red)

    if timer:time() >= 1000 and timer:time() < 2000 then
    screenrint(280,131,".",red)
    elseif timer:time() >= 2000 and timer:time() < 3000 then
    screenrint(280,131,"..",red)
    elseif timer:time() >= 3000 and timer:time() < 4000 then
    screenrint(280,131,"...",red)
    elseif timer:time() >= 4000 then
    end
    screen.waitVblankStart()
    screen.flip()

    lead into a new timer

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

    sg57, thank you very much. That cleared things up.
    xtreme, what you need is probably to use the same timer but change

    timer:time() < 2000

    to math.floor(timer:time()/1000)==2

    and change the others accordingly.

    Maybe you should give that a try but if it doesn't work, then get someone who actually knows what they're doing (I'm a pretty new coder)

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

    PSPhakkor - yup.

    xtreme - If you want to use seconds, rather than miliseconds, divide timer:time() by 1000, and round up (ceiling) or down (floor). For the example i posted, i compared in miliseconds, to compare in seconds, youd do:
    Code:
    timer = Timer.new()
    timer:start()
    
    while true do
    screen:clear()
    
    screenrint(153,131,"Pre paring flash0",red)
    
    if math.floor(timer:time()/1000) >= 1 and math.floor(timer:time()/1000) < 2 then
    screenrint(280,131,".", red)
    elseif math.floor(timer:time()/1000) >= 2 and math.floor(timer:time()/1000) < 3 then
    screenrint(280,131,".." ,red)
    elseif math.floor(timer:time()/1000) >= 3 and math.floor(timer:time()/1000) < 4 then
    screenrint(280,131,"... ",red)
    elseif math.floor(timer:time()/1000) >= 4 then
    end
    screen.waitVblankStart()
    screen.flip()

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


  19. #5419
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    ok, after a few hours of learning and work here is what ii have tp produce

    http://files.filefront.com//;6644819;;/

    i still have a few alignment issues but im gonna work on it, what you think for my first time?

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

    LOLz, Good code!
    But instead of doing this

    Code:
    screen:clear()
    screen:print(150,131,"Preparing flash0",blue)
    screen:flip()
    
    screen.waitVblankStart(60)
      
    screen:clear()
    screen:print(150,131,"Preparing flash0.",blue)
    screen:flip()
    
    screen.waitVblankStart(60)
    
    
    screen:clear()
    screen:print(150,131,"Preparing flash0..",blue)
    screen:flip()
    
    screen.waitVblankStart(60)
    
    
    screen:clear()
    screen:print(150,131,"Preparing flash0...",blue)
    screen:flip()
    Why not use a timer?

  21. #5421
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    because i just started today and timers confuse the sh17 out of me lol

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

    xtreme - I posted an example that uses a timer, and does just waht you want. Timers arent confusing either, just think logically...

    blah = Timer.new()

    now... blah is a timer, and is not running right now. I want it to run... so...

    blah:start()

    Now... my timer is running.... I want to display the time in seconds, and if[] is pressed, stop it, if X is pressed, resume it, and finally, if O is pressed, reset it back to 0 and continue running
    Code:
    white = Color.new(255,255,255)
    
    blah = Timer.new()
    blah:start()
    
    while true do
         screen:clear(white)
         pad = Controls.read()
         if pad:cross() then blah:start() end
         if pad:square() then blah:stop() end
         if pad:circle() then
              blah:reset() -- 0 by default
              blah:start() -- doesnt continue running once reset, so this is needed
         end
    
         screen:print(0,0,blah:time())
         screen.waitVblankStart()
         screen.flip()
    end
    -= Double Post =-
    Hey guys... I need a guiene (sorry spelling) pig. Ive made a particle demo in LUA, and i need someone to test it for me.

    Rather than sending you the file, jsut someone copy and paste this into a file, save itas a lua script and run it...
    Code:
    MAX_PARTICLES = 199 -- # of particles
    
    particle = {} -- Particle Array (Room For Particle Info)
    for i=0,MAX_PARTICLES do
        particle[i] = {
    		life,				-- Particle Life
    		fade,				-- Fade Speed
    		x,					-- X Position
    		y,					-- Y Position
    		z,					-- Z Position
    		xi,					-- X Direction
    		yi,					-- Y Direction
    		zi					-- Z Direction
        }
    end
    
    V, Angle = 0, 0
    
    function Init()		-- All Setup Goes Here
        for loop=0,MAX_PARTICLES do			-- Initializes All Particles
          particle[loop].life=255 -- Give All The Particles Full Life
          particle[loop].fade=255/(math.random(0,100)/1000+0.05) -- Random Fade Speed
    
          V = math.random(0,25)  -- Speed of the particle
          Angle = math.random(0,360)  -- Angle of the particle
    
          particle[loop].x = 240   -- Set X position
          particle[loop].y = 136   -- Set Y position
          particle[loop].z = 0   -- Set Z position
    
          particle[loop].xi = math.sin(Angle) * V   -- Set X velocity
          particle[loop].yi = math.cos(Angle) * V   -- Set Y velocity
          particle[loop].zi = ((math.random(0,10)-5)/10) * V   -- Set Z velocity
        end
    end
    
       
    function DrawScene()	-- Here's Where We Do All The Drawing
      screen:clear()
      for loop=0,MAX_PARTICLES do -- Loop Through All The Particles
        x=particle[loop].x  -- Grab Our Particle X Position
        y=particle[loop].y  -- Grab Our Particle Y Position
        z=particle[loop].z  -- Grab Our Particle Z Position
    
        x = 480 / 2 + x * z
        y = 272 / 2 + y * z
    
        -- Draw The Particle Using Our RGB Values, Fade The Particle Based On It's Life
        screen:fillRect(x,y,4,4,Color.new(126,126,255,particle[loop].life))
    
        particle[loop].x=particle[loop].x+particle[loop].xi   -- Move On The X Axis By X Speed
        particle[loop].y=particle[loop].y+particle[loop].yi   -- Move On The Y Axis By Y Speed
        particle[loop].z=particle[loop].z+particle[loop].zi   -- Move On The Z Axis By Z Speed
    
        -- Slow down the particles
        particle[loop].xi=particle[loop].xi*2
        particle[loop].yi=particle[loop].yi*2
        particle[loop].zi=particle[loop].zi*2
    
        particle[loop].life=particle[loop].life-particle[loop].fade  -- Reduce Particles Life By 'Fade'
    
        if (particle[loop].life<255/0.05) then -- If Particle Is Burned Out
          particle[loop].life=255  -- Give It New Life
          particle[loop].fade=255/((math.random(100))/10000 + 0.005)  -- Random Fade Value
          particle[loop].x= 240  -- Center On X Axis
          particle[loop].y= 136  -- Center On Y Axis
          particle[loop].z= 0  -- Center On Z Axis
          V = (math.random(9)+1)
          Angle = math.random(360)
    
          particle[loop].xi = math.sin(Angle) * V
          particle[loop].yi = math.cos(Angle) * V
          particle[loop].zi = (math.random(10)-5)
        end
      end
      screen.waitVblankStart()
      screen.flip()
    end
    
    Init()
    
    while true do DrawScene() end
    Tell me what happens - please and thank you.
    Geändert von SG57 (01-30-2007 um 12:57 AM Uhr) Grund: Automerged Doublepost

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


  23. #5423
    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

    it just displayed allot of 4x4 rectangles at 240x136, but after i changed
    Code:
        x=particle[loop].x  -- Grab Our Particle X Position
        y=particle[loop].y  -- Grab Our Particle Y Position
        z=particle[loop].z  -- Grab Our Particle Z Position
    to
    Code:
        x=particle[loop].xi  -- Grab Our Particle X Position
        y=particle[loop].yi  -- Grab Our Particle Y Position
        z=particle[loop].zi  -- Grab Our Particle Z Position
    it made a mess in the middle of my screen:
    http://img408.imageshack.us/img408/3...mation1dh3.gif
    Geändert von eyece (01-30-2007 um 03:34 AM Uhr) Grund: Automerged Doublepost

  24. #5424
    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

    SG57, Lua arrays start from 1 not 0.

    Code:
    for i=0,MAX_PARTICLES do

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

    SG57, Lua arrays start from 1 not 0.
    shouldnt matter becuase he created the table in the same way (0-199), but true.

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

    How are you slowing down the particles?
    Code:
    -- Slow down the particles
        particle[loop].xi=particle[loop].xi*2
        particle[loop].yi=particle[loop].yi*2
        particle[loop].zi=particle[loop].zi*2
    This doubles the speed, not slow it down.

    Code:
    particle[loop].fade=255/(math.random(0,100)/1000+0.05) -- Random Fade Speed
    Why something so complicated, just have fade a random number between 50 and 150 and you will still get the ssame effect.

    Code:
    if (particle[loop].life<255/0.05) then -- If Particle Is Burned Out
    Just check if life is below 0.
    Code:
    if ( particle[loop].life < 0 ) then

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

    yaustar - I ported this from it's original OpenGL C++ form, and since the OpenGL API uses colors from 0.0 - 1.0, I needed the same % of intensity, in a 255-base form. So, 255/original_color would result in the smae effect. Now that I think about it, it SHOULD be multiply 255 by the original color... hmm... As for the comments, totally disregard them. I know it speeds it up, 2x actually, and since my PC runs the original particle demo flawlessly at 50% of the x,y, and z vector speeds (times them by .5), I could only assume the PSP would have a slower framerate. So, just to start it out, I doubled the vector speeds. The comments dont mean to much now, as Ive had to adopt quite alot of changes for this to work wthout a 3D API... And yes, I know Lua, on default, sets the first element of an array as the '1' element. So I worked around it, as eyece pointed out...

    eyece - The squares should have of faded out as they moved outward. Did they just seem to move from inside to the out?

    Here - change all '255/' to '255/*' and it should fade out properly... Ill work on it more after school.

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


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

    My question is whether particle[0] exists. I don't understand why you are making the the life part of the particle so complicated. Start at 255 (full colour) and count down by a fixed amount each frame by the .fade (which is a random number between 15 and 50). Once life is below 0 (ie can't be seen), then reset the particle.
    Geändert von yaustar (01-30-2007 um 08:57 AM Uhr)

  29. #5429
    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 xtreme0915
    thx, where do you guys learn all this stuff? ive seen the two tuts but other than that nothing
    like anything else my friend, we watch others (look at scripts), and practice. i've been at this...for as long as i've been a member here, (well, its a hobby really) and i have a long ways to go. at least, in my defense, i have had no prior programming history.
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  30. #5430
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    x = 255
    
    timer = Timer.new(0)
    timer:stop()
    
    function colorText()
    
    pad = Controls.read()
    
    if pad:cross() then
    timer:start()
    screen:print(100,100, "text meni farbu!", Color.new(x,x,x))
    end
    if timer:time() > 0 < 1000 then
    x = x - 1
    end
    if timer:time() > 1000 < 2000 then
    x = x - 1
    end
    if timer:time() > 2000 < 3000 then
    x = x - 1
    end
    if timer:time() > 3000 < 4000 then
    x = x - 1
    end
    if timer:time() > 4000 < 5000 then
    x = x - 1
    end
    end
    
    while true do
    
    screen:clear()
    
    colorText()
    
    screen.waitVblankStart()
    screen.flip()
    end
    whats wrong with this? it should change colours...

    error:15: cannot compare boolean with number

    edit. maybe this could be better??

    Code:
    x = 255
    
    timer = Timer.new(0)
    timer:stop()
    
    function colorText()
    
    pad = Controls.read()
    
    if pad:cross() then
    timer:start()
    end
    if timer:time() > 0 < 1000 then
    x = x - 1
    screen:print(100,100, "text meni farbu!", Color.new(x,x,x))
    end
    if timer:time() > 1000 < 2000 then
    x = x - 1
    screen:print(100,100, "text meni farbu!", Color.new(x,x,x))
    end
    if timer:time() > 2000 < 3000 then
    x = x - 1
    screen:print(100,100, "text meni farbu!", Color.new(x,x,x))
    end
    if timer:time() > 3000 < 4000 then
    x = x - 1
    screen:print(100,100, "text meni farbu!", Color.new(x,x,x))
    end
    if timer:time() > 4000 < 5000 then
    x = x - 1
    screen:print(100,100, "text meni farbu!", Color.new(x,x,x))
    end
    end
    
    while true do
    
    screen:clear()
    
    colorText()
    
    screen.waitVblankStart()
    screen.flip()
    end
    but still same error on line 13
    Geändert von myschoo (01-30-2007 um 11:44 AM Uhr)


 

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 .