Seite 170 von 342 ErsteErste ... 70 120 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 220 270 ... LetzteLetzte
Zeige Ergebnis 5.071 bis 5.100 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 awsome...

  
  1. #5071
    Points: 3.536, Level: 37
    Level completed: 24%, Points required for next Level: 114
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    14
    Points
    3.536
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    alright awsome



  2. #5072
    QJ Gamer Bronze
    Points: 9.316, Level: 64
    Level completed: 89%, Points required for next Level: 34
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Denmark
    Beiträge
    664
    Points
    9.316
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    Allright, BlackShark helped me before, but im afraid it didn't work.
    I need this:

    if pad:cross() and (collosion with my cursor, and my button here) then
    (blit my new image, as a new menu will pop-up)
    end

    But i don't have good memories with collosion... (My crappy Ping Pong game...)

    So can anyone help me here? I need from Start to End instructions, because i just don't get it sometimes.
    My PSP Projects:
    ___________________
    None.

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

    Here's a simple click function I made for a shell a while back:

    function click(ob)
    if pad:cross() and (cursor.x > ob.x) and (cursor.x < ob.x + ob.w) and (cursor.y > ob.y) and (cursor.y < ob.y + ob.h) then
    return true
    else
    return false
    end
    end

    You'll just have to add w and h variables to the items that are clickable. Then you can use it like this:

    if click(nameofobjectyou'red etectingaclickfor) then
    *stuffthathappenswhenitis clicked*
    end

  4. #5074
    QJ Gamer Bronze
    Points: 9.316, Level: 64
    Level completed: 89%, Points required for next Level: 34
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Denmark
    Beiträge
    664
    Points
    9.316
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    Allright, it'll go like this properbly, and ill show what i didn't understand:

    function click(menu) -- which is my button

    if pad:cross() and (cursor.x > menu.x) and (cursor.x < menu.x + menu.w --? is the the width or something?) and (cursor.y > menu.y) and (cursor.y < menu.y + menu.h -- ?, is that the height or something?) then
    return true -- return is not supposed to be there, is it?
    else
    return false -- Look up.
    end
    end

    And then:

    if click(menu) then
    screen:blit(where it is, where it is, start, false)
    end
    My PSP Projects:
    ___________________
    None.

  5. #5075
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Are there any tutorials in Lua for reading entire text files and printing them to the screen or can someone help me out on pg 505?
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

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

    Code:
    y = 10					
    file = io.open("testRead.txt","r")					
    for line in file:lines() do
    y = y + 10
    screen:print(100,y,line,white)
    end					
    file:close()
    http://evilmana.com/tutorials/lua_tutorial_09.php

  7. #5077
    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 gameo
    Allright, it'll go like this properbly, and ill show what i didn't understand:

    function click(menu) -- which is my button

    if pad:cross() and (cursor.x > menu.x) and (cursor.x < menu.x + menu.w --? is the the width or something?) and (cursor.y > menu.y) and (cursor.y < menu.y + menu.h -- ?, is that the height or something?) then
    return true -- return is not supposed to be there, is it?
    else
    return false -- Look up.
    end
    end

    And then:

    if click(menu) then
    screen:blit(where it is, where it is, start, false)
    end
    the return true IS suppost to be there, thats how you know if the cursor is in the button, in there, you make an if statement like "if pad:cross() and click(menu) == true (not sure if click(menu) is supposed to be like that but hey, im not so hot in collision niether) then
    do your if statement functions, here like load this or do that
    end

    give that a try, but again, no make sure's it will work (said "make sure's cuz i cant spell garrentie!)
    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.

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

    The return true/return false is used for telling whether the conditions are true or not AKA whether its been clicked.

    w and h are width and height

    So use it like this:

    menu = {x = something,y = something, w = widthofmenuimage, h = heightofmenuimage}

    function click(ob)
    if pad:cross() and (cursor.x > ob.x) and (cursor.x < ob.x + ob.w) and (cursor.y > ob.y) and (cursor.y < ob.y + ob.h) then
    return true
    else
    return false
    end
    end


    while true do
    pad = controls.read()
    screen:clear()
    screen:blit(menu.x,menu.y ,menuimg)
    screen:blit(cursor.x,curs or.y,cursorimg)
    *otherstuffofrcursormovem ent*
    if click(menu) then
    *stuff you wanna do when menu is clicked*
    end
    screen.waitVblankStart()
    screen.flip
    end

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

    Does anyone know if it's possible to rotate an image being displayed on the screen? Thanks. Hopeing to get a reply...:Punk:

  10. #5080
    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 PSPhakkor
    Does anyone know if it's possible to rotate an image being displayed on the screen? Thanks. Hopeing to get a reply...:Punk:
    i think i saw something like that on evilmana or something, but i have no time to look right now... sorry
    -= Double Post =-
    Zitat Zitat von emericaska8r
    ok i have two questions,

    Zitat Zitat von TacticalPinguin
    Ill give you an example to scan a single directory:

    files = System.listDirectory()
    for i = 3, table.getn(files) do
    if not files[i].directory then
    if files[i].name == "somefilename.someext ensi on" then
    *whatever you wanna do when it finds it*
    end
    end
    end
    1 - why did you start the for loop at 3?
    2 - what does (if not file[i].directory) do?

    thanks for any answers
    can someone give me information about this? thanks
    Geändert von emericaska8r (01-16-2007 um 02:02 PM Uhr) Grund: Automerged Doublepost

  11. #5081
    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 PSPhakkor
    Does anyone know if it's possible to rotate an image being displayed on the screen? Thanks. Hopeing to get a reply...:Punk:
    there is, but its buggy, and will drop your framerate below 30. so, look for better means to do it.
    --------------------------------------------------------------------------------------

  12. #5082
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Anti-QJ
    Code:
    y = 10					
    file = io.open("testRead.txt","r")					
    for line in file:lines() do
    y = y + 10
    screen:print(100,y,line,white)
    end					
    file:close()
    http://evilmana.com/tutorials/lua_tutorial_09.php
    pspsgamer... I'm pretty sure you had 1,100 posts only last month. It says you post an average of 18 a day... Are you ok?

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

    Grimfate - One way would be to use the GU and rotate a textured quad, the texture being the image you want to rotate.

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


  14. #5084
    QJ Gamer Silver
    Points: 7.371, Level: 57
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    貴方
    Beiträge
    1.159
    Points
    7.371
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    i keep getting the error:
    wrong number of arguments
    here is the code
    Zitat Zitat von code
    System.usbDiskModeActivat e()

    white = Color.new(255,255,255)
    red = Color.new(255,0,0)

    current = 1
    oldpad = Controls.read()
    while true do
    pad = Controls.read()
    screen:clear()

    screenrint(10,10,"Quick Japanese",white)
    screenrint(10,20,"by Cheese the Psp, from the QJ forums",white)
    screenrint(192,95,"Categories", white)
    screenrint(192,105,"Alphabet",w hite)
    screenrint(192,115,"Usefull Phrases",white)
    screenrint(192,125,"Dictionary" ,white)

    if current == 1 then
    screenrint("Alphabet",red)
    end
    if current == 2 then
    screenrint("Usefull Phrases",red)
    end
    if current == 3 then
    screenrint("Dictionary",red)
    end

    if pad:cross() then
    if current == 1 then
    dofile("alphabet.lua")
    elseif current == 2 then
    dofile("usefullphrases.lu a")
    elseif current == 3 then
    dofile("dictionary.lua")
    end
    end

    if pad:up() and oldpad:up() ~=pad:down() then
    current = current - 1
    end

    if pad:down() and oldpad:down() ~=pad:down() then
    current = current + 1
    end

    if current == 0 then
    current = 3
    end
    if current == 4 then
    current = 1
    end

    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end

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

    if current == 1 then
    screenrint("Alphabet",r ed)
    end
    if current == 2 then
    screenrint("Usefull Phrases",red)
    end
    if current == 3 then
    screenrint("Dictionary" ,red)
    end

    No xy coordinates.

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

    Itd help immensly if you gave us a line number...

    Until then, try adding some X and Y coordinate values to lines 20,23 and 26.

    EDIT

    Weird, my thing didnt show someone already answered...

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


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

    can someone answer my post at the top please?

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

    Anyone know some good AI tuts?
    Also, can anyone help me with using netlib? I REALLY need both these things :)
    Thanks to anyone who can help me out ;)

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

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

    I havent written any games with netlib but I do know how to use it if you need help.

  20. #5090
    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 Yongobongo
    Anyone know some good AI tuts?
    Here is a start. Look around Gamedev for more or get a good book: http://www.gamedev.net/reference/art...article784.asp

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

    Zitat Zitat von TacticalPinguin
    I havent written any games with netlib but I do know how to use it if you need help.
    You do? Great :) I'll PM you when i need you :)
    Thanks Tactical!

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

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

    Hey yoyobongo try this site: (it shows you how to make a infastructure game with netlib.)
    http://www.cools.biaklan.com/Tutorial/netlibtut.html

  23. #5093
    .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, ill have a look at it :)

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

  24. #5094
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Is there a limit in Lua on how many images you can load? In my index.lua I can only load 13 images... Any more and i'll get an error that it can't load it. They're all 480x272.

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

    The limit is the amount of memory you have available for LuaPlayer, the large the image, the more memory you take up.

  26. #5096
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Well maybe i dont need an image anymore? How do I delete it from RAM or wherever it goes when I preload it.

  27. #5097
    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 Cheez Pirate
    Well maybe i dont need an image anymore? How do I delete it from RAM or wherever it goes when I preload it.
    Code:
    name_of_image = nil
    that will free the memory.

    and, 13 480x272 images is WAYYY too much. you wont even be able to load 6 detailed ones.
    --------------------------------------------------------------------------------------

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

    nameofimage = nil will clear it from ur ram. same goes for anything else
    -= Double Post =-
    whoa thats odd i didnt see grimfates post
    Geändert von TacticalPinguin (01-17-2007 um 05:14 PM Uhr) Grund: Automerged Doublepost

  29. #5099
    QJ Gamer Blue
    Points: 6.041, Level: 50
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Missouri
    Beiträge
    451
    Points
    6.041
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Hey thanks TacticalPenguin

  30. #5100
    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

    this is more of a general programing question, but how do you get the angle and distance between 2 points, (x1,y1,x2,y2).


 

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 07:53 AM Uhr.

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