Seite 213 von 342 ErsteErste ... 113 163 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 263 313 ... LetzteLetzte
Zeige Ergebnis 6.361 bis 6.390 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von Urameshi i already have a chasePlayer function though, do i make another? Well I dont see it whats ...

  
  1. #6361
    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 Urameshi
    i already have a chasePlayer function though, do i make another?
    Well I dont see it whats your error or prob anyways?



  2. #6362
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    well the game runs, but when Urameshi chases the player, he shows no animation what so ever, but i want him to show animation

  3. #6363
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    Code:
    red = Color.new(255, 0, 0)
    Blue = Color.new(0,0,200)
    
    function PrintCentered(y,string,color)
    screen:print( 240 - (string.len(string)*8) / 2 ,y,string,color);
    end
    
    Background = Image.load("background1.png")
    
    System.Unassign("flash0:" )
    
    System.Assign("flash0:", "lflash0:0,0", "flashfat0:")
    
    
    current = 1
    oldpad = Controls.read()
    
    while true do
    
    pad = Controls.read()
    
    screen:blit(0,0,Background)
    PrintCentered(3,"Lua Theme Flasher", Blue)
    PrintCentered(18,"By ai3gtmc", Blue)
    screen:print(137, 96, "=> 01-12.bmp background", Blue)
    screen:print(137, 106, "=> TopMenu_Plugin", Blue)
    screen:print(137, 116, "=> Opening_Plugin", Blue)
    screen:print(137, 126, "=> Gameboot.PMF", Blue)
    screen:print(137, 136, "=> System_Plugin_bg", Blue)
    screen:print(137, 146, "=> System_Plugin_fg", Blue)
    screen:print(137, 156, "=> System_Plugin", Blue)
    screen:print(137, 166, "=> Game_Plugin", Blue)
    screen:print(137, 176, "=> photo_plugin", Blue)
    screen:print(137, 186, "=> impose_plugin", Blue)
    screen:print(137, 196, "=> ltn0.pgf", Blue)
    screen:print(137, 210, "=> Enable USB", Blue)
    screen:print(137, 220, "=> Disable USB",Blue)
    screen:print(137, 240, "=> EXIT", Blue)
    
    
    
    
    if current == 1 then
    screen:print(137, 96, "=> 01-12.bmp background", red)
    end
    
    if current == 2 then
    screen:print(137, 106, "=> TopMenu_Plugin.rco", red)
    end
    
    if current == 3 then
    screen:print(137, 116, "=> Opening_Plugin.rco", red)
    end
    
    if current == 4 then
    screen:print(137, 126, "=> Gameboot.PMF", red)
    end
    
    
    if current == 5 then
    screen:print(137, 136, "=> System_Plugin_bg.rco", red)
    end
    
    if current == 6 then
    screen:print(137, 146, "=> System_Plugin_fg.rco", red)
    end
    
    if current == 7 then
    screen:print(137, 156, "=> System_Plugin.rco", red)
    end
    
    if current == 8 then
    screen:print(137, 166, "=> Game_Plugin.rco", red)
    end
    
    if current == 9 then
    screen:print(137, 176, "=> photo_plugin.rco", red)
    end
    
    if current == 10 then
    screen:print(137, 186, "=> impose_plugin.rco", red)
    end
    
    if current == 11 then
    screen:print(137, 196, "=> ltn0.pgf", red)
    end
    
    if current == 12 then
    screen:print(137,210, "=> Enable USB!", red)
    end
    
    if current == 13 then
    screen:print(137,220, "=> Disable USB!", red)
    end
    
    
    if current == 14 then
    screen:print(137, 240, "=> EXIT", red)
    end
    
    
    
    if pad:up() and oldpad:up() ~= pad:up() then
    current = current-1
    end
    
    if pad:down() and oldpad:down() ~= pad:down() then
    current = current+1
    end
    
    if current == 15 then
    current = 1
    end
    
    if current == 0 then
    current = 14
    end
    
    
    
    if pad:cross() and current == 1 then
    System.writeFile("ms0:/theme/01-12.bmp","flash0:/vsh/resource/01-12.bmp","yes")
    end
    
    if pad:cross() and current == 2 then
    System.writeFile("ms0:/theme/topmenu_plugin.rco","flash0:/vsh/resource/topmenu_plugin.rco","yes")
    end
    
    if pad:cross() and current == 3 then
    System.writeFile("ms0:/theme/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco","yes")
    end
    
    
    if pad:cross() and current == 4 then
    System.writeFile("ms0:/theme/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf","yes")
    end
    
    
    if pad:cross() and current == 5 then
    System.writeFile("ms0:/theme/system_plugin_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco","yes")
    end
    
    if pad:cross() and current == 6 then
    System.writeFile("ms0:/theme/system_plugin_fg.rco","flash0:/vsh/resource/system_plugin_fg.rco","yes")
    end
    
    if pad:cross() and current == 7 then
    System.writeFile("ms0:/theme/system_plugin.rco","flash0:/vsh/resource/system_plugin.rco","yes")
    end
    
    if pad:cross() and current == 8 then
    System.writeFile("ms0:/theme/game_plugin.rco","flash0:/vsh/resource/game_plugin.rco","yes")
    end
    
    if pad:cross() and current == 9 then
    System.writeFile("ms0:/theme/photo_plugin.rco","flash0:/vsh/resource/photo_plugin.rco","yes")
    end
    
    if pad:cross() and current == 10 then
    System.writeFile("ms0:/theme/impose_plugin.rco","flash0:/vsh/resource/impose_plugin.rco","yes")
    end
    
    if pad:cross() and current == 11 then
    System.writeFile("ms0:/theme/ltn0.pgf","flash0:/font/ltn0.pgf","yes")
    end
    
    if pad:cross() and current == 12 then
    System.usbDiskModeActivate()
    end
    
    if pad:cross() and current == 13 then
    System.usbDiskModeDeactivate()
    end
    
    if pad:cross() and current == 14 then
    System.Quit()
    end
    
    
    ---ScreenShot---
    if pad:select() then
    Image:save("screenshot.png")
    end
    
    if pad:start() then
    System.Quit()
    end
    
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    
    end
    this works for me, repaired some errors... try it

    hmm can u tell me what did u repair?...

    i dont have a psp right now

    i gave my psp to my bro as a graduation gift:)

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

    only 2 things:


    sometimes you used Red and sometimes red in your menu so i changed it all to "red" and then you were flashing font to flash0:/vsh/font/ and thats not right

  5. #6365
    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 Urameshi
    well the game runs, but when Urameshi chases the player, he shows no animation what so ever, but i want him to show animation
    try either using animLib, or do something like:
    Code:
    function animateweirdnamedguy()
    	movingstate = movingstate + 1
    	if movingstate>= 48 or movingstate<=0  then
    		movingstate = 0
    	elseif movingstate < 12 then
    		player.image = right1
    	elseif movingstate < 24 then
    		player.image = right2
    	elseif movingstate < 36 then
    		player.image = right3
    	elseif movingstate < 48 then
    		player.image = right4
    	end
    end

  6. #6366
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    only 2 things:


    sometimes you used Red and sometimes red in your menu so i changed it all to "red" and then you were flashing font to flash0:/vsh/font/ and thats not right

    u mean i can't flash fonts?

    whats wrong with the font script?

  7. #6367
    Points: 3.542, Level: 37
    Level completed: 28%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    18
    Points
    3.542
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Hey, hope someone can help me out on this. I started to learn lua 2 days ago. After going through some tutorials, i thought id start with a pong game.
    so i coded everything, did some graphics and now i have one problem:

    My game has a menu with 4 choices. 2 player mode, survival mode, credits and quit. (not everything is finished yet).
    everytime i start one of the modes, get out of it and try another one, get out of that one and try to start another one the third time, the psp freezes. :Argh:
    Why is it doing that? hope someone knows a solution.
    Geändert von Cynical (03-26-2007 um 05:18 PM Uhr)

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

    Cynical - I havanet looked at your code, but my guessis your not managing your resources correctly. You need to make sure you set ALL variables used in your source to 'nil', without hte quotes, before 'dofile'ing to another script (in your case that is). Than you need to call collectgarbage() to erase all traces of you varaibles from RAM.

    ex:
    Code:
    image = Image.load("bg.png")
    
    function Cleanup()
         image = nil
         collectgarbage()
    end
    
    while true do
         screen:blit(0,0,image)
    
         pad = Controls.read()
         if pad:cross() then
             Cleanup()
             dofile("game.lua")
         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


  9. #6369
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Yeah, its definately a memory issue, whats happening is you're loading the same images over and over without releasing them. What I usually like to do is set all my loads into a function, i.e.

    function loadmultiplayergfx()
    (load all your images)
    end

    and the immediately create an unload function, i.e.

    function unloadmultiplayergfx()
    (set all your images to null and collect garbage)
    end

    This way its as easy as calling the load at the beginning of the mode, and unloading as you leave the mode. Plus in your loading function you can blit a loading screen, making your app that much more presentable. Also remember that if you store images into an array of any type, you have to null the array before you collect garbage or lua actually won't free the memory.

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

    Oh - good point. Make sure you free any references to any variable. By this, i mean:
    Code:
    bg1 = Image.load("bg.png")
    -- why waste time reloading the same image?  just feed the same image data into a new image variable
    bg2 = bg1
    
    ...
    
    function Cleanup()
        bg1 = nil
        -- collectgarbage() <- BOO BOO!  bg2 still is referencing to bg1, and freeing bg1 will have bg2 reference to nothing (nothing as in, not an 'Image' type)
        bg2 = nil
        collectgarbage()
    end
    Klepto - I did the same as well in my Call of Duty 2 - PSP Edition. My unload function was quite long asthe Lua doesnt support the multiple variable setting (var1 = var2 = var3 = nil doesnt work). I didnt know about the collectgarbage function until i read the Lua manual. Good thing too *sigh of relief*

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


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

    Zitat Zitat von ai3gtmc
    u mean i can't flash fonts?

    whats wrong with the font script?
    font is located in flash0:/font/ not flash0:/vsh/font/ ;)
    -= Double Post =-
    Zitat Zitat von SG57
    Cynical - I havanet looked at your code, but my guessis your not managing your resources correctly. You need to make sure you set ALL variables used in your source to 'nil', without hte quotes, before 'dofile'ing to another script (in your case that is). Than you need to call collectgarbage() to erase all traces of you varaibles from RAM.

    ex:
    Code:
    image = Image.load("bg.png")
    
    function Cleanup()
         image = nil
         collectgarbage()
    end
    
    while true do
         screen:blit(0,0,image)
    
         pad = Controls.read()
         if pad:cross() then
             Cleanup()
             dofile("game.lua")
         end
    
         screen.waitVblankStart()
         screen.flip()
    end
    that collectgarbage() function is inside lua player or you have to create it??
    Geändert von myschoo (03-25-2007 um 04:54 AM Uhr) Grund: Automerged Doublepost

  12. #6372
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    font is located in flash0:/font/ not flash0:/vsh/font/ ;)
    -= Double Post =-


    that collectgarbage() function is inside lua player or you have to create it??

    oh man thx:) u rock:Punk:

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

    but still does it work?

  14. #6374
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    but still does it work?

    hmm i still dont have a psp

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

    ok , tell me then

  16. #6376
    Points: 3.542, Level: 37
    Level completed: 28%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    18
    Points
    3.542
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Cynical - I havanet looked at your code, but my guessis your not managing your resources correctly. You need to make sure you set ALL variables used in your source to 'nil', without hte quotes, before 'dofile'ing to another script (in your case that is). Than you need to call collectgarbage() to erase all traces of you varaibles from RAM.

    ex:
    Code:
    image = Image.load("bg.png")
    
    function Cleanup()
         image = nil
         collectgarbage()
    end
    
    while true do
         screen:blit(0,0,image)
    
         pad = Controls.read()
         if pad:cross() then
             Cleanup()
             dofile("game.lua")
         end
    
         screen.waitVblankStart()
         screen.flip()
    end

    Oh ok, I kinda suspected it had something to do with the the memory. (at one point I got a "mikmod critical error, out of memory"). Anyways,
    should i also do the garbage collecting for variables that contain for examples just integers or strings? or is it only necessary for variables containing images?
    I will try some garbage collection right now, thanks for the answers :)
    @ Klepto - do you mean it like this:

    function loadgfx()
    image = Image.load("image.png")
    end

    function unloadgfx()
    image = nil
    collectgarbage()
    end

    loadgfx()

    while true do
    ...
    unloadgfx
    dofile "..."
    end

    EDIT:
    Now, the problem, that the psp freezes the third time trying to load a mode, is solved. but now i have the problem, that after a few times i try to load a mode, i get the following error:

    LuaPlayer's mikmod has a critical error:
    _mm_critical 0
    _mm_errno 5
    Sample load failed - Out of memoy

    ???
    Geändert von Cynical (03-25-2007 um 10:13 AM Uhr)

  17. #6377
    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've been looking into coroutines, can someone tell my why this isn't working?

    Code:
    chain = {}
    chain.img = {}
    chain.img[1] = Image.load("./gfx/tiles/1.png")
    chain.img[2] = Image.load("./gfx/tiles/2.png")
    chain.img[3] = Image.load("./gfx/tiles/3.png")
    chain.head = {x = 30, y = 30}
    chain.anchor = {x = 240, y = 136}
    chain.segment = {}
    chain.segment[1] = coroutine.create(function (head, anchor)
    	local newX = ((head.x + anchor.x)/2)+ math.random(-3, 3)
    	local newY = ((head.y + anchor.y)/2) + math.random(-3, 3)
    	screen:blit(newX, newY, chain.img[2])
    	coroutine.yield()
    	end)
    
    loop = true
    while loop do
    	pad = Controls.read()
    	
    	if pad:left() and chain.head.x > 10 then chain.head.x = chain.head.x -1 end
    	if pad:right() and chain.head.x < 470 - chain.img[1]:width() then chain.head.x = chain.head.x +1 end
    	if pad:up() and chain.head.y > 10 then chain.head.x = chain.head.x -1 end
    	if pad:down() and chain.head.y < 262 - chain.img[1]:height() then chain.head.x = chain.head.x +1 end
    
    	screen:clear()
    	coroutine.resume(chain.segment[1](chain.head, chain.anchor))
    	screen:blit(chain.head.x, chain.head.y, chain.img[1])
    	screen:blit(chain.anchor.x, chain.anchor.y, chain.img[3])
    	screen:waitVblankStart()
    	screen:flip()
    	
    	if pad:start() then loop = false end
    end
    when the program gets to the coroutine.resume it exits with the error:

    attempt to call field '?' (a thread value)

  18. #6378
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    From what I read, the benefit of coroutines is that it allows you to stop a function, and resume it at a later time. Concerning your code, when you call the resume, you cannot pass new variables, you simply must pass the thread name, ie.

    coroutine.resume(chain.se gment[1])

    another problem with your code is that your yield is at the end of your coroutine, so basically once its resumed, it runs through completely and is then killed. You will have to create a new thread if you want to have it run again, so in a sense you have just created a standard function.

    Does anyone know how lua handles dead thread by the way?

  19. #6379
    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

    Actually, according the "Programming in Lua" you can pass arguments. And looking at that page again, I see what I did wrong. I was trying to pass the arguments inside brackets like you would with a normal function, but when resuming coroutines you're already inside a set of brackets so you just use commas, like this:

    Code:
    coroutine.resume(chain.segment[1](chain.head, chain.anchor)) -- bad
    
    coroutine.resume(chain.segment[1], chain.head, chain.anchor) -- good
    And as for putting yield at the end, the simple solution too keep the thread from dying is to put the whole code block into a loop.

    According to what I've read, resuming a coroutine takes up less processor time than calling a regular function so I was thinking that they would be perfect for keeping track of enemy ai

  20. #6380
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    gotcha, the loop makes a lot of sense. I'll have to read up some more on this, any idea as to how much of a performance gain you would achieve by using this method?

  21. #6381
    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

    No idea really, and in fact it might be possible that I mis-read something.

  22. #6382
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    If I receive data from the ir port, how can I print it to the screen and how do I save it to a file?

  23. #6383
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Well, I've never used the IR port, but I assume that it's stored in a variable. So, to print it, do something like this:
    Code:
    foo = IR.read() --not actual function, just used as example
    screen:print(10,10,foo,black)
    To write it to a file:
    Code:
    file = io.open("file.txt","w")
    file:write(foo)
    file:close()

  24. #6384
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Page 598, IR was discussed a little bit. Heres the link:

    Link

  25. #6385
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Thanks!
    -= Double Post =-
    OK, but how can I read from a saved file and send the content of this file over ir?
    Geändert von sony psp player (03-26-2007 um 11:36 AM Uhr) Grund: Automerged Doublepost

  26. #6386
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    file = io.open("file.txt","r")
    System.irdaSend(file:read ("*a"))
    file:close()

    I forgot the IR function.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  27. #6387
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    I've been struggling with this since yesterday...

    What I want to do is have the Move 25 pixels event happen 3 times over a period of 1 second...not have the character move 75 pixels instantly...

    I've tried timers and counters and the animation script but I only started coding 4 days ago and still don't know how to get this to work. I wish Lua worked like RPG Maker where you could just go "Wait(100)" for it to wait a second before proceeding...

    Code:
    --MOB COLLISION--
    
    if MobX - 15 <= CleoX and CleoX <= MobX + 10 and MobY - 35 <= CleoY and CleoY <= MobY + 15 then
    	Kill:play( )
    	if cleodown then CleoY = CleoY -25 end
    	if cleoleft then CleoX = CleoX +25  end
    	if cleoright then CleoX = CleoX -25  end
    	if cleoup then CleoY = CleoY +25 end
    	screen:blit(CleoX,CleoY,cleo[direction])
    	HP = HP - 1
    end

  28. #6388
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ClearTranquil
    I've been struggling with this since yesterday...

    What I want to do is have the Move 25 pixels event happen 3 times over a period of 1 second...not have the character move 75 pixels instantly...

    I've tried timers and counters and the animation script but I only started coding 4 days ago and still don't know how to get this to work. I wish Lua worked like RPG Maker where you could just go "Wait(100)" for it to wait a second before proceeding...

    Code:
    --MOB COLLISION--
    
    if MobX - 15 <= CleoX and CleoX <= MobX + 10 and MobY - 35 <= CleoY and CleoY <= MobY + 15 then
    	Kill:play( )
    	if cleodown then CleoY = CleoY -25 end
    	if cleoleft then CleoX = CleoX +25  end
    	if cleoright then CleoX = CleoX -25  end
    	if cleoup then CleoY = CleoY +25 end
    	screen:blit(CleoX,CleoY,cleo[direction])
    	HP = HP - 1
    end
    screen:waitVblankStart(60 ) will pause the screen for 1 second. just make sure you slip the screen in between each call.

  29. #6389
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    What do you mean slip the screen?

  30. #6390
    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 think he meant flip


 

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

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