Seite 214 von 342 ErsteErste ... 114 164 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 264 314 ... LetzteLetzte
Zeige Ergebnis 6.391 bis 6.420 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; yeah, I stuck at typing:Argh:...

  
  1. #6391
    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, I stuck at typing:Argh:



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

    Ohhh makes sense. Thanks.

    That method isn't exactly what I was looking to do...I want it to run independant to the other events that are still moving/displaying things.
    Geändert von ClearTranquil (03-26-2007 um 05:04 PM Uhr)

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

    create a state - player_hit, and a counter. When the player gets hit, set the state to true. Then set all your player actions inside an if statement. If player_hit == false then you run the normal player controls and stuff. If player hit == true then you block the normal player stuff, and add 1 to the counter variable. when the counter reaches a certain number, you do the + 25 to the position and set the counter to 0, when you've done the + 25 3 times, you set player_hit to false in addition to reseting the counter

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

    It seems everytime I try and create a "count = count +1" it does it infinately high right from the start. As if "count = count + 1000000000" wouldn't make it any different.

  5. #6395
    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

    how are you doing it?

    here's a simple counter, it adds 1 the the count each program cycle then displays the count:

    Code:
    white = Color.new(255,255,255)
    count = 0
    
    while true do
    	count = count +1
    	screen:clear()
    	screen:print(10,10,count, white)
    	screen:flip()
    	pad = Controls.read()
    	if pad:cross() then break end
    	if pad:square() then count =0 end
    end

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

    That explains alot for me. I was putting count within an if statement. (noob)

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

    well actually, you do want the count inside an if statement, I.E. if player hit == true then count = count + 1, and then inside that same if statement do if count = (60/3) then +25 to player pos and have another statement - if count >= 60 then count = 0 , player_hit = false

  8. #6398
    QJ Gamer Blue
    Points: 5.303, Level: 46
    Level completed: 77%, Points required for next Level: 47
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Beiträge
    219
    Points
    5.303
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    haha, well, this is the lua help thread, and i need lua help.

    I want to use a "player" move kind've script but implement it into an image that kind've slides up and down when i press pad up and pad down, i've been going through some ideas and i've had some luck. However, i cannot seem to stop the image at pixels 0 and 512 (in other words, stop the picture from rolling off screen whilst holding up or down. I've had some some luck, but whenever it seems to work i get errors like "loop ungettable".

    Any help would be appreciated.

  9. #6399
    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:
    if pad:up() and player.y > 0 then player.y = player.y - someSpeed end
    if pad:down() and player.y+player.height < 512 then player.y = player.y + someSpeed 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


  10. #6400
    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'm sure this my codes aren't efficient at all but I'm having some problems with collision. I'm thinking of just redoing it and making each map a separate file because this is just starting to get long and ridiculous.

    Basically my problems are:
    -When multiple buttons are pressed against a wall it gets REALLY screwed and the character flies in diagonal directions
    -When the monster pushes the character against the wall she still goes right through it.
    -When you push the monster back into some walls it applies both the X and Y displacement for some reason.

    It's really frustrating...I can understand how to do collision based on objects but what I need is outer walls. The code I posted is for this map:



    What I wish I could do is make an image the goes over top of the background and make it the only walkable/unwalkable area...


    Code:
    --MAP 1----------------------------------------------------------------------------
    
    if map == 0 then
    if CleoY >= 216 then 
    	map = 1
    	CleoY = 0
    	MobX = 350
    	MobY = 70
    end
    if CleoY <= 12 then
    	dontmoveoff = false
    	CleoY = 12
    end
    if CleoX <= -18 then
    	map = 3
    	CleoX = 440
    	MobX = 200
    	MobY = 150
    end
    if CleoX >= 441 then
    	map = 5
    	CleoX = 0
    	MobX = 150
    	MobY = 70
    end
    if CleoX <= 49 and CleoY <=133 then
    	dontmoveoff = false
    	if pad:left() then
    	CleoX = 49
    	elseif pad:left() and pad:up() then
    	CleoX = CleoX + 3
    	CleoY = CleoY + 3
    	else
    	CleoY = 133
    	end
    end
    if CleoX >= 219 and CleoY <=48 then
    	dontmoveoff = false
    	if pad:right() and cleoright then
    	CleoX = 219
    	elseif pad:up() and pad:right() then
    	CleoY = CleoY + 3
    	CleoX = CleoX + 3
    	elseif pad:up() and pad:left() then
    	CleoY = CleoY + 3
    	CleoX = CleoX - 3
    	else
    	CleoY = 48
    	end
    end
    if CleoX >= 414 and CleoY <=180 then
    	dontmoveoff = false
    	if pad:right( ) then
    	CleoX = CleoX - 3
    	else
    	CleoY = CleoY - 3
    	end
    end
    -------------------------------------------------------------
    if MobY >= 216 then 
    	MobY = 216
    end
    if MobY <= 12 then
    	dontmoveoff = false
    	MobY = 12
    end
    if MobX <= -18 then
    	MobX = -18
    end
    if MobX >= 441 then
    	MobX = 441
    end
    if MobX <= 49 and MobY <=133 then
    	dontmoveoff = false
    	if mobwalkleft then
    	MobX = 49
    	else
    	MobY = 133
    	end
    end
    if MobX >= 219 and MobY <=48 then
    	dontmoveoff = false
    	if mobwalkright then	
    	MobX = 219
    	elseif mobwalkup then
    	MobY = 48
    	end
    end
    if MobX >= 414 and MobY <=180 then
    	dontmoveoff = false
    	if mobwalkright then
    	MobX = 414
    	else
    	MobY = 180
    	end
    end
    end --MAP 1 END

    ALSO!!!

    When I pin a monster against the wall if I hold down X (attack) it keeps doing it....

    Code:
    --ATTACKING---------------------------------------------------------------------------
    if not quitting then
    if not pad:cross() then
    	Voicefx.Voicesound = false
    end
    if pad:cross() and not pad:triangle() and not pad:square() and not pad:circle() then
    	if pad:cross( ) then
    		if not Voicefx.Voicesound then
    			Voice:play( )
               		Voicefx.Voicesound = true
           		end
        	else Voicefx.Voicesound = false
    	end
    	buttonpress = 1
    	screen:blit(340,0,menu[buttonpress])
              	if cleodown then direction = 5 end
    	if cleoleft then direction = 6 end
    	if cleoright then direction = 7 end
    	if cleoup then direction = 8 end
    	screen:blit(CleoX,CleoY,cleo[direction])
    
    --ATTACKDAMAGE-----------------------------------------------------------------
    
    if MobX - 40 <= CleoX and CleoX <= MobX + 40 and MobY - 50 <= CleoY and CleoY <= MobY + 40 then
    	Stab:play( )
    	if cleoup then	
    		MobY = MobY - 20
    	elseif cleoleft then
    		MobX = MobX - 20
    	elseif cleoright then
    		MobX = MobX + 20
    	elseif cleodown then
    		MobY = MobY + 20
    	end
    end
    end
    end

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

    thats a cool game..
    but i dont know collision sryy...

  12. #6402
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Does anyone know how i can return a table of the RGBA values of a color?

    http://www.yongobongo.com
    PSN - yongobongo

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

    a = color:colors()
    then you have a.r a.g a.b and a.a (red, greeb, blue, alpha)
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  14. #6404
    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 Yongobongo
    Does anyone know how i can return a table of the RGBA values of a color?
    i dont know if there are bit operations in lua. if there are, then icould write a function for you. its not hard with bits shifting.
    -= Double Post =-
    Zitat Zitat von youresam
    a = color:colors()
    then you have a.r a.g a.b and a.a (red, greeb, blue, alpha)
    heh, that was easier ;)
    Geändert von Grimfate126 (03-27-2007 um 06:54 PM Uhr) Grund: Automerged Doublepost
    --------------------------------------------------------------------------------------

  15. #6405
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    for instance:

    blah = Color.new(37,198,255,100)
    blahcolors = blah:colors()
    blahcolors.r returns 198
    blahcolors.a returns 100
    etc

  16. #6406
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Thanks, can i use these values to tell one of the values?
    Say

    Code:
     fff = Color.new(111,234,983,255)
    colorz = fff:colors()
    colorz.a = alphavalue

    http://www.yongobongo.com
    PSN - yongobongo

  17. #6407
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Yep, colorz.a right there would be the alpha value, 255.

  18. #6408
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Alright thanks now to go try it out

    http://www.yongobongo.com
    PSN - yongobongo

  19. #6409
    QJ Gamer Blue
    Points: 3.642, Level: 37
    Level completed: 95%, Points required for next Level: 8
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    99
    Points
    3.642
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Sorry for asking this, but how do you display an image for only a few seconds in C (not in lua)? None of the C developers were online, so i thought maybe both in lua and C, the function was the same.

  20. #6410
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Make a timer and blit it while the timer is under 3000 or however long you want it there
    -= Double Post =-
    Why isn't this working??
    Code:
    color2= Color.new(110,132,255,100);
    
    if menuOnFocus == 3 then
    if pad:left() then
    if sliderLocation2 > 1 then
    sliderLocation2 = sliderLocation2 - 1
    end
    end
    
    if pad:right() then
    if sliderLocation2 < 99 then
    sliderLocation2 = sliderLocation2 + 1
    end
    
    colorz = color2:colors()
    color2 = Color.new(colorz.r, colorz.g, colorz.b, sliderLocation2*2.55
    Geändert von Yongobongo (03-27-2007 um 10:36 PM Uhr) Grund: Automerged Doublepost

    http://www.yongobongo.com
    PSN - yongobongo

  21. #6411
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    You didn't close the parenthesis on the last color.new and you didnt close all your ifthens.

  22. #6412
    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 Yongobongo
    Make a timer and blit it while the timer is under 3000 or however long you want it there
    -= Double Post =-
    Why isn't this working??
    Code:
    color2= Color.new(110,132,255,100);
    
    if menuOnFocus == 3 then
    if pad:left() then
    if sliderLocation2 > 1 then
    sliderLocation2 = sliderLocation2 - 1
    end
    end
    
    if pad:right() then
    if sliderLocation2 < 99 then
    sliderLocation2 = sliderLocation2 + 1
    end
    
    colorz = color2:colors()
    color2 = Color.new(colorz.r, colorz.g, colorz.b, sliderLocation2*2.55
    you have a semicolon beside your first color.

    wow, come on. those are the easiest things to spot. cant miss stuff like that. and also, you need to start indenting. a somple tab is all it takes, and it makes the code SO much easier to read. for example, ill indent your code:

    Code:
    color2= Color.new(110,132,255,100)
    
    if menuOnFocus == 3 then
    	if pad:left() then
    		if sliderLocation2 > 1 then
    			sliderLocation2 = sliderLocation2 - 1
    		end
    	end
    end
    
    if pad:right() then
    	if sliderLocation2 < 99 then
    		sliderLocation2 = sliderLocation2 + 1
    	end
    end
    
    colorz = color2:colors()
    color2 = Color.new(colorz.r, colorz.g, colorz.b, sliderLocation2*2.55)
    --------------------------------------------------------------------------------------

  23. #6413
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Yeah you really shouldn't post especially even after luaplayer tells you what and where the error is...

  24. #6414
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Luaplayer didn't give an error :|
    It just doesnt seem to change the Alpha Value

    http://www.yongobongo.com
    PSN - yongobongo

  25. #6415
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Yeah but someone with your history of releases I'd of thought things like this would come easy to you.

  26. #6416
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    I've just posted the snippet, the actual script runs fine and i've checked over it numerous times and there doesn't seem to be an error oh well forget alpha

    http://www.yongobongo.com
    PSN - yongobongo

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

    Zitat Zitat von Grimfate126
    you have a semicolon beside your first color.
    Lua supports semicolons.
    Code:
    a = 5
    b = 6
    is the same as
    Code:
    a = 5;
    b = 6;
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  28. #6418
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    I have a question. For shooting i tryed using the example at Evilmana( i changed some things but still didn't like it i am still learnig lua jsut started up again) But when you shoot you can only shoot five on the screen at a time. I was wondereing how you do shooting bullets like in ATOM. My game is kind of like it but it will end up being a lot different.

    Thanks Bob Hoil:)

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

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

  30. #6420
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    And table.getn. And table.insert. And that's all anybody will probably tell you because they want you to figure it out.


 

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 .