Seite 339 von 342 ErsteErste ... 239 289 329 330 331 332 333 334 335 336 337 338 339 340 341 342 LetzteLetzte
Zeige Ergebnis 10.141 bis 10.170 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; alright that's what i thought, thank you for your help...

  
  1. #10141
    QJ Gamer Green
    Points: 2.236, Level: 28
    Level completed: 58%, Points required for next Level: 64
    Overall activity: 0%

    Registriert seit
    Nov 2008
    Beiträge
    35
    Points
    2.236
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    alright that's what i thought, thank you for your help



  2. #10142
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    No problem ;)

  3. #10143
    QJ Gamer Blue
    Points: 1.880, Level: 25
    Level completed: 80%, Points required for next Level: 20
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2009
    Beiträge
    10
    Points
    1.880
    Level
    25
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    To have it check for a pressed state in HM you do:
    Code:
    oldpad = Controls.read()
    
    --in while loop 
    pad = Controls.read() 
    
    if pad:cross() and oldpad:cross() ~= pad:cross() then
        --play sound 
    end
    
    --near end of script 
    oldpad = pad;
    screen.flip() --or flipscreen() depending on your version. 
    screen.waitVblankStart()
    end
    Thank you but maybe you didnt completely understand what i said.
    play sound when i am [pressing] a button
    and stop when i [release] the button

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

    sly_spy - We tend to ignore dan ;)

    Here ya go...
    Code:
    bPlaying = false;
    
    ...
    
    while true do
      ...
    
      pad = Controls.read();
    
      if pad:cross() then
        if not bPlaying then
          bPlaying = true;
    
          sound:play();
        end
      else
        if bPlaying then
          bPlaying = false;
    
          sound:stop();
        end
      end
    
      ...
    
    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


  5. #10145
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    @sg57 - i'll take that as a joke. It would take very minor adjustment to make my code work, instead of giving it to him on a plate, you should of let him work it out for himself.

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

    in retrospect we always used to help you though so i see no harm in helping him, his question was quite a bit different than the code provided seen as he is a new coder
    ------ 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).

  7. #10147
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von FaT3oYCG Beitrag anzeigen
    in retrospect we always used to help you though so i see no harm in helping him, his question was quite a bit different than the code provided seen as he is a new coder
    What advice did everyone used to always give me? I'm not going to word for word every quote but it went like this:
    "Do stuff yourself, you learn more".

    I provided a link to the evilmana tut, it explains all about playing sounds, stopping sounds etc.
    If he looked through the tuts then he would see usage & explain else, elseif etc.
    Now, i know that i'm not one to judge, a year ago i was like him, asking for code, not really looking doing stuff myself. But i regret that, & that stage is well gone. I'm just trying to get the 'do it yourself' habit plugged into his head like many of you did with me.

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

    We are all conspiring against you dan, watch out ;)

    ...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. #10149
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von SG57 Beitrag anzeigen
    We are all conspiring against you dan, watch out ;)
    shh!, ur not suppose to tell him!!=-)
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  10. #10150
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    ok.....

  11. #10151
    QJ Gamer Blue
    Points: 1.880, Level: 25
    Level completed: 80%, Points required for next Level: 20
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2009
    Beiträge
    10
    Points
    1.880
    Level
    25
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57 Beitrag anzeigen
    sly_spy - We tend to ignore dan ;)

    Here ya go...
    Code:
    bPlaying = false;
    
    ...
    
    while true do
      ...
    
      pad = Controls.read();
    
      if pad:cross() then
        if not bPlaying then
          bPlaying = true;
    
          sound:play();
        end
      else
        if bPlaying then
          bPlaying = false;
    
          sound:stop();
        end
      end
    
      ...
    
    end
    Thank you for leading me to a right way
    but the code makes "loop in gettable",so i correct it to:
    Code:
    bPlaying = false;
    
    ...
    
    while true do
      ...
    
      pad = Controls.read();
    
      if pad:cross() then
        if not bPlaying then
          bPlaying = true;
          music=sound:play();
        end
      elseif music then
          bPlaying = false;
          music:stop();
       end
    
      ...
    
    end

  12. #10152
    QJ Gamer Blue
    Points: 1.880, Level: 25
    Level completed: 80%, Points required for next Level: 20
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2009
    Beiträge
    10
    Points
    1.880
    Level
    25
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    What advice did everyone used to always give me? I'm not going to word for word every quote but it went like this:
    "Do stuff yourself, you learn more".

    I provided a link to the evilmana tut, it explains all about playing sounds, stopping sounds etc.
    If he looked through the tuts then he would see usage & explain else, elseif etc.
    Now, i know that i'm not one to judge, a year ago i was like him, asking for code, not really looking doing stuff myself. But i regret that, & that stage is well gone. I'm just trying to get the 'do it yourself' habit plugged into his head like many of you did with me.
    Dear Dan,sorry but you didnt know that,firstly,English is not my mother tongue,so i have many difficulties in reading the tutorial;secondly,DIY is a permanent credendum in my mind so that i work out codes of thousands of lines,can you put up with the samall codeblock i've asked for?thirdly,there is No one tells me how to figure it out in my home country,i have no choice but turning to you masters of lua.

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

    Zitat Zitat von dan369 Beitrag anzeigen
    ok.....
    haha, well I always used to help you and you cant say that I didn't, if you do I will cry :Cry:
    ------ 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).

  14. #10154
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von FaT3oYCG Beitrag anzeigen
    haha, well I always used to help you and you cant say that I didn't, if you do I will cry :Cry:
    but not anymore ;).
    @sly - i guess it is hard for you, afaik theres only decent tuts in french & english.
    Anyone starting from other countries is at a lose. What country you from btw?

  15. #10155
    QJ Gamer Blue
    Points: 1.880, Level: 25
    Level completed: 80%, Points required for next Level: 20
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2009
    Beiträge
    10
    Points
    1.880
    Level
    25
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    @sly - i guess it is hard for you, afaik theres only decent tuts in french & english.
    Anyone starting from other countries is at a lose. What country you from btw?
    China

  16. #10156
    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

    Zitat Zitat von dan369 Beitrag anzeigen
    but not anymore ;).
    I know... I gave up on you, lol jk. but yeah mainly because now u usually solve your own problems but you are directly comparable to sly and myself, or anyone else that tries to learn a programming language for that matter.
    ------ 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).

  17. #10157
    Points: 1.768, Level: 24
    Level completed: 68%, Points required for next Level: 32
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    26
    Points
    1.768
    Level
    24
    Downloads
    0
    Uploads
    0

    Standard

    HELP!!!
    how to show a picture and make it disappear a few secend later???

  18. #10158
    Points: 1.768, Level: 24
    Level completed: 68%, Points required for next Level: 32
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    26
    Points
    1.768
    Level
    24
    Downloads
    0
    Uploads
    0

    Standard

    and how to make the picture move,how to control its speed?

  19. #10159
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    hupengwei, it's called if statements, variables, and logic, learn the basics of programming than come back=-)
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  20. #10160
    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 hupengwei Beitrag anzeigen
    and how to make the picture move,how to control its speed?
    Focus on one thing at a time. First step, making an image move with the d-pad. Can you do that?

  21. #10161
    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 yaustar Beitrag anzeigen
    Focus on one thing at a time. First step, making an image move with the d-pad. Can you do that?
    From hupengwei:
    glad to see your reply.i didn't know much basic knowledge,what i did before is just copying different programs together.i think i need learn more, could you recommend some books for lua?
    i could move the picture with the d-pad,but i want to make it move without pressing any button.i mean it moves itself.
    Starting with the easiest type of movement, let's get the image moving from left to right. Look at the logic you use to make the image move using the d-pad, how would you use the same concept to have the image move without input from the player?

    As for books on Lua: Programming in Lua : contents

  22. #10162
    Points: 1.768, Level: 24
    Level completed: 68%, Points required for next Level: 32
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    26
    Points
    1.768
    Level
    24
    Downloads
    0
    Uploads
    0

    Standard

    i think i should use a timer and set a proper time,change the position of the picture,
    but how to set a timer? SetTimer()???
    forgive me for asking so many easy questions.i didn`t know much English and there were not any books on lua in Chinese.
    By the way,how to show a picture and make it disappear a few secends later?
    Change the value of its alpha??

  23. #10163
    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 hupengwei Beitrag anzeigen
    i think i should use a timer and set a proper time,change the position of the picture,
    but how to set a timer? SetTimer()???
    You don't need a timer, all I am asking is for you to simply write some code to move an image from the left of the screen to the right.

    forgive me for asking so many easy questions.i didn`t know much English and there were not any books on lua in Chinese.
    Oh really?

  24. #10164
    QJ Gamer Blue
    Points: 1.880, Level: 25
    Level completed: 80%, Points required for next Level: 20
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Aug 2009
    Beiträge
    10
    Points
    1.880
    Level
    25
    Downloads
    0
    Uploads
    0

    Standard

    does LP HM has a limit for wav?
    as i tried,it can load 700kbps but 1400kbps
    Well,how many kbps is its upper limit?

  25. #10165
    Points: 1.768, Level: 24
    Level completed: 68%, Points required for next Level: 32
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    26
    Points
    1.768
    Level
    24
    Downloads
    0
    Uploads
    0

    Standard

    yes,this is the code i use to make picure move
    x=0
    y=100
    img= Image.load("Logo.png")
    while x<480 do
    screen:clear()
    screen:blit(x,y,img)
    screen.flip
    screen:waitVblankstart
    x=x+1
    end
    forgive me for asking so many easy questions.i didn`t know much English and there were not any books on lua in Chinese.
    it`s true.i`ve already bought the book 2 weeks ago,the last 70pages are still in english

  26. #10166
    Points: 1.768, Level: 24
    Level completed: 68%, Points required for next Level: 32
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    26
    Points
    1.768
    Level
    24
    Downloads
    0
    Uploads
    0

    Standard

    em...as i tried,the upper limit seems to be about 1200

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

    you need to set a flag to make the image stop or move left again.
    ------ 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).

  28. #10168
    Points: 1.768, Level: 24
    Level completed: 68%, Points required for next Level: 32
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    26
    Points
    1.768
    Level
    24
    Downloads
    0
    Uploads
    0

    Standard

    you need to set a flag to make the image stop or move left again.
    i konw but i don`t konw how to....this is what i am asking for......
    Maybe i didn`t express very clear,just because of my poor english

  29. #10169
    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

    Code:
    local logo = {
    x = 0,
    y = 100,
    img = Image.load("Logo.png"),
    directionFlag = 1
    }
    
    local function moveLeftRight(_minX, _maxX, _speed, _itemTable)
    	if _itemTable.directionFlag == 1 then
    		_itemTable.x = _itemTable.x + _speed
    		if _itemTable.x > _maxX then
    			_itemTable.x = _maxX
    			_itemTable.directionFlag = -1
    		end
    	elseif _itemTable.directionFlag == -1 then
    		_itemTable.x = _itemTable.x - _speed
    		if _itemTable.x < _minX then
    			_itemTable.x = _minX
    			_itemTable.directionFlag = 1
    		end
    	end
    end
    
    while true do
    	screen:clear()
    
    	moveLeftRight(0, 100, 1, logo)
    	screen:blit(logo.x, logo.y, logo.img)
    
    	screen.flip()
    	screen.waitVblankstart()
    end
    ?
    ------ 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).

  30. #10170
    Points: 1.768, Level: 24
    Level completed: 68%, Points required for next Level: 32
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Jul 2009
    Beiträge
    26
    Points
    1.768
    Level
    24
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    function MovePicture(PathAndFile,MType,speed)
        if MType == 1 then
        logo = Image.load("./Pictures/"..PathAndFile)
    	x=-480
    	 while x<480 do
    	  screen:clear()
    	  screen:blit(x,0,logo)
    	  screen.flip()
          screen.waitVblankStart()
    	  x=x+speed
    	 end
    	end
    	if MType == 2 then
        logo = Image.load("./Pictures/"..PathAndFile)
    	x=480
    	 while x>-480 do
    	  screen:clear()
    	  screen:blit(x,0,logo)
    	  screen.flip()
          screen.waitVblankStart()
    	  x=x-speed
    	 end
    	end
        if MType == 3 then
        logo = Image.load("./Pictures/"..PathAndFile)
    	y=-272
    	 while y<272 do
    	  screen:clear()
    	  screen:blit(0,y,logo)
    	  screen.flip()
          screen.waitVblankStart()
    	  y=y+speed
    	 end
    	end
        if MType == 4 then
        logo = Image.load("./Pictures/"..PathAndFile)
    	y=272
    	 while y>-272 do
    	  screen:clear()
    	  screen:blit(0,y,logo)
    	  screen.flip()
          screen.waitVblankStart()
    	  y=y-speed
    	 end
    	end
    end
    this is mine.i firmly know how to Move,But i want to {STOP},how to stop is the question .if you can,how to change the alpha value of apicture?i want to fadein and fadeout some pictures
    Ps this code moves two fast,and how to slow it down??
    Geändert von hupengwei (08-12-2009 um 03:40 AM Uhr) Grund: forget one important thing


 

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 .