Seite 176 von 342 ErsteErste ... 76 126 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 226 276 ... LetzteLetzte
Zeige Ergebnis 5.251 bis 5.280 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; as i said, there is no exact error message or line.....luaplayer just does not detect when the user presses start. ...

  
  1. #5251
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    as i said, there is no exact error message or line.....luaplayer just does not detect when the user presses start.

    I.E. You're at the main menu and you press start to start the app. however, the script does not do anything, just as if you had not pressed start or the controls detection was not there. i think that this could be the placement of my code.



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

    edit. oops my bad
    Geändert von myschoo (01-25-2007 um 11:10 AM Uhr)

  3. #5253
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von parm289
    there is no official error message returned by luaplayer, but at the main menu, the start button doesnt work.
    heres the code that the error is located in:
    Code:
    while true do
      local pad = Controls.read()
      if pad:select() then
        faq()
      end
    if Controls.read():start() then
    screen:clear( )
    countForm( )
    screen:fontPrint(comic,0,0,a,white)
    screen.flip( )
    screen.waitVblankStart(300)
    end
      screen:blit(0, 0, bg2)
      screen:fontPrint(comic,115,20,"Welcome to Parm's Card Counting app.",white)
      screen:fontPrint(comic,130,40,"For help and FAQs, press Select.",white)
      screen:fontPrint(comic,138,60,"To start counting, press Start.",white)
      screen.flip()
    end
    It works fine for me on Luaplayer Windows, so the problem is most likely in your function countForm() since I had to take that out to run the code. Also, why do you always read the controls again to check for the start button? You could have done the same thing that you do when you check for the select button. You should also realize that since you don't clear the screen in this loop except when start is pressed, anything you blit when you press start will stay there (it will probably be flashing).

  4. #5254
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von parm289
    Code:
    function countForm()
    a = 0
    if pad:r( ) then
    a = a+1
    end
    if pad:l( ) then
    a = a-1
    end
    while true do
    screen:print(a) -- i see a problem right here
    screen.flip( )
    screen.waitVblankStart(300)
    end
    end
    you only put "a" in the parantheses for screenrint(). you forgot coordinates and text color
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  5. #5255
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    http://www.sendspace.com/file/e16i9e
    That is the link to the full package/app that i have so far. It's a preview of whats coming next, but mainly its for people to help and look at the code.
    Eminent: i changed that a while ago, it was just one of my tests.

    If you guys dont wanna d/l the whole package and just want to take a look at the countForm(), here it is:

    Code:
    function countForm()
    if pad:r( ) then
    a = a+1
    end
    if pad:l( ) then
    a = a-1
    end
    screen:fontPrint(comic,0,0,a,white)
    screen.flip( )
    screen.waitVblankStart(300)
    end
    a has already been declared as a = 0.

    again, thanks for your help.

  6. #5256
    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 Dr.Gringo
    @: parm289
    I had the same problem with my lua app. and the only solution i found to be the easiest and fastest was to make a transparent png and write your text in a program like gimp or photoshop. Save it and then load it and then blitted to the screen if u want an example or any further help i would be glad to help you just send me a pm.

    @: emericaska8r
    Read Your PMs'
    yea sorry i hadn't been on the computer in a while. i am going to try the PSpbrew first, and then if i don't get it i'll do that. thanks

  7. #5257
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    My WIP's - Egyptian Ratscrew
    Great card game....
    just had to say that lol good luck with it
    Geändert von parm289 (01-25-2007 um 02:07 PM Uhr)

  8. #5258
    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 parm289
    Great card game....
    just had to say that lol god luck with it
    lol thanks. it hasn't been getting very much attention because of the super mario brothers game, but its coming along

    oh, and @ Dr.Gringo, i got it working using the PSPbrew, but thanks anyway!

  9. #5259
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    no problem, i'm looking forward to it (*cough*beta test*cough* lol)!

    anyway, i finally got the start button to be detected. it was the placement of the actual function countForm() declaration....
    However, i still need to find out how to obtain a variable's contents as a string. For example, if a = 0, and i want to print the value of a to the screen, i don't know how to get the "0" value. I'm guessing from xml, javascript, and html experience that its an escape function, but I could be wrong. Either way, i have no clue if escape functions are even present in lua. I googled for help on this, but couldnt find any.

    Again, thanks for your help and sorry for so many questions...I just have to get this ironed out before i can move on to the rest of my app.

    EDIT: Looking around a little more, i found this:

    Zitat Zitat von evilmana.com forums
    tostring(VAR) accepts any type of variable and converts it into a string
    I tried this as:

    Code:
    aString = tostring(a)
    screen:print(0,0,aString,white)
    screen:flip()
    screen.waitVblankStart(300)
    ...but i still got the same result: a blank screen. I'm pretty sure this is how to turn the variable into a string, and i think this is the way to use it. I'm going to try it like this:

    Code:
    tostring(a)
    screen:print(0,0,aS,white)
    screen:flip()
    screen.waitVblankStart(300)
    and i'll report back.

    EDIT2: Nope, the second way still returns a blank screen....I'll look around to see if i can find some info on it.
    EDIT3: Well, i finally got it to work, and sorry for the epic post. This is the code i used:

    Code:
    function countForm()
    local a = 0
    if pad:r( ) then
    a = a+1
    end
    if pad:l( ) then
    a = a-1
    end
    aString = tostring(a)
    screen:fontPrint(comic,20,20,aString,white)
    screen.flip( )
    screen.waitVblankStart(300)
    end
    Just so people can see how it works....now im gonna try to pull this app off tonight....
    Geändert von parm289 (01-25-2007 um 02:37 PM Uhr)

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

    yes! i am releasing my game today! the download link is below.
    any criticisms and suggestions will be appreciated.

    http://www.sendspace.com/file/csasz4

  11. #5261
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    hmmmm.....i've been trying to get triangle to exit, and i've looked around the net and found that on the newer luaplayers, the only way to exit to the xmb is by loading an invalid .png. if anyone has the link to it or knows where i can find it, can you please post it? thanks!

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

    I need the same thing, so I used a mod of luaplayer released by cools:
    http://forums.ps2dev.org/viewtopic.php?t=6858

    the command is System.Quit()

    (note the capitals,, as always)

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

    Zitat Zitat von code
    bg = Image.load("space.png")
    ufo = Image.load("ufo.png")
    s1 = Image.load("satelite1.png ")
    s2 = Image.load("satelite2.png ")
    s3 = Image.load("satelite3.png ")
    s4 = Image.load("satelite4.png ")

    black = Color.new(0,0,0)
    green = Color.new(0,255,0)
    white = Color.new(255,255,255)

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

    screen:blit(0,0,bg)
    screen:blit(0,0,ufo)
    screenrint(120,140,"press x",white)

    if pad:cross() then
    break
    end

    if pad:left() then
    screen:blit(180,128,s1)
    screen.flip()
    end


    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end
    i dont get it
    when i press left
    it doesnt display the pic

  14. #5264
    QJ Gamer Blue
    Points: 5.056, Level: 45
    Level completed: 53%, Points required for next Level: 94
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    347
    Points
    5.056
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    psphakkor: i saw that in my searches, but i figured that most people would not have the luaplayer .20 mod, so i would need to something else.
    wait - if i compile my game using pspbrew with the System:Quit() command, will it work? I.E. if my game is in eboot form and i call System.Quit(), will it exit to the xmb, or does the script have to be running under the luaplayer mod?

  15. #5265
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HeaD_ShOt
    i dont get it
    when i press left
    it doesnt display the pic
    take out the screen.flip(), you already have one at the bottom. you dont need another. lol
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  16. #5266
    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 parm289
    psphakkor: i saw that in my searches, but i figured that most people would not have the luaplayer .20 mod, so i would need to something else.
    wait - if i compile my game using pspbrew with the System:Quit() command, will it work? I.E. if my game is in eboot form and i call System.Quit(), will it exit to the xmb, or does the script have to be running under the luaplayer mod?
    i think if you edited the eboot.pbp given from the luaplayer mod that it might work, i'm not sure
    -= Double Post =-
    anybody ever tried that?
    Geändert von emericaska8r (01-25-2007 um 05:32 PM Uhr) Grund: Automerged Doublepost

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

    System:Quit will need the LUA Player .20 Mod
    I think only users who have this mod can use this function properly.

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

    Head_shoT - AS suggested, remove the screen.flip(). That will display the picture, and right after that, it reaches another screen.flip, and basically 'turns off' what you just drew to the screen (the image). The reason it doesnt even flash is because the screen hasnt met a vertical sync to start displaying it...

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  19. #5269
    QJ Gamer Green
    Points: 5.923, Level: 49
    Level completed: 87%, Points required for next Level: 27
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Melb, Aus
    Beiträge
    530
    Points
    5.923
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    i made this thread: http://forums.qj.net/f-psp-developme...ken-91010.html but it doesn't seem to be getting a whole lot of attention. could someone from here take a look at it. i tried the first lua tutorial and i can't get it working... :Cry:

    i just wanna create...

    All help apreciated!

  20. #5270
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    i made this thread: http://forums.qj.net/f-psp-developme...ken-91010.html but it doesn't seem to be getting a whole lot of attention. could someone from here take a look at it. i tried the first lua tutorial and i can't get it working...

    i just wanna create...

    All help apreciated!
    theres a problem with your player, are you suing version 20? if so, redownload it and try the script again.

  21. #5271
    QJ Gamer Green
    Points: 5.923, Level: 49
    Level completed: 87%, Points required for next Level: 27
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Melb, Aus
    Beiträge
    530
    Points
    5.923
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eyece
    theres a problem with your player, are you suing version 20? if so, redownload it and try the script again.

    k will do and report back

    Success! i can't believe it was that simple! thanks!
    Geändert von *Ollie* (01-26-2007 um 04:18 AM Uhr)

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

    okay i have another question
    when i am writing the path of a bullet
    here is my attempt
    Zitat Zitat von code
    Bullet = { x = 180, y = 128, img = bullet}

    function moveBullet()
    Bullet.x = Bullet.x - 5
    end
    i jsut want the bullet to move to the left side
    with this i never get the bullet to show

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

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

    Standard

    Code:
    bullet = Image.load("bullet.png")
    
    Bullet = { x = 180, y = 128, image = bullet }
    
    function moveBullet()
    Bullet.x = Bullet.x - 5 
    end
    try this

  24. #5274
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HeaD_ShOt
    okay i have another question
    when i am writing the path of a bullet
    here is my attempt

    i jsut want the bullet to move to the left side
    with this i never get the bullet to show
    you merely forgot to blit it (or post that you did, if you did)

    Code:
    screen:blit(Bullet.x, Bullet.y, Bullet.image)
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

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

    eminent:

    he can do that in while true do part cant he

  26. #5276
    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 myschoo
    eminent:

    he can do that in while true do part cant he
    he just doesn't know if he does have that in his code or not. if he does already than not loading the image is the problem since both of those things aren't shown

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

    that was it
    how did i not notice that
    thanks

    <edit>
    dumb errors
    now i am having trouble wtih my AI
    Zitat Zitat von code
    math.randomseed(os.time() )

    Player = { x = 205, y = 120, img = earth}

    Enemy = { x = 0, y = 120, img = ufo }

    function chasePlayer()
    stallchase = math.random(2)
    if stallchase == 1 then
    if Enemy.x > 205 then
    Enemy.x = Enemy.x - 2
    elseif Enemy.x < 205 then
    Enemy.x = Enemy.x + 2
    end
    end
    stallchase = math.random(2)
    if stallchase == 1 then
    if Enemy.y > 120 then
    Enemy.y = Enemy.y - 2
    elseif Enemy.y < Player.y then
    Enemy.y = Enemy.y + 2
    end
    end
    end
    with teh error...
    Zitat Zitat von error message
    attempt to compare number with nil
    Geändert von HeaD_ShOt (01-26-2007 um 02:20 PM Uhr)

  28. #5278
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HeaD_ShOt
    Code:
    math.randomseed(os.time() )
    
    Player = { x = 205, y = 120, img = earth}
    
    Enemy = { x = 0, y = 120, img = ufo }
    
    function chasePlayer()
    stallchase = math.random(2)
    if stallchase == 1 then
    if Enemy.x > 205 then
    Enemy.x = Enemy.x - 2
    elseif Enemy.x < 205 then
    Enemy.x = Enemy.x + 2
    end
    end
    stallchase = math.random(2)
    if stallchase == 1 then
    if Enemy.y > 120 then
    Enemy.y = Enemy.y - 2
    elseif Enemy.y < Player.y then
    Enemy.y = Enemy.y + 2
    end
    end
    end
    well for one, i believe math.random() requires two numbers. (a minimum and a maximum). also, you have two "if stallchase == 1"s, which is redundant.
    Code:
    math.randomseed(os.time() )
    
    Player = { x = 205, y = 120, img = earth}
    
    Enemy = { x = 0, y = 120, img = ufo }
    
    function chasePlayer()
    	stallchase = math.random(1,2)
    	if stallchase == 1 then
    		if Enemy.x > 205 then
    			Enemy.x = Enemy.x - 2
    		elseif Enemy.x < 205 then
    			Enemy.x = Enemy.x + 2
    		end
    
    		if Enemy.y > 120 then
    			Enemy.y = Enemy.y - 2
    		elseif Enemy.y < Player.y then
    			Enemy.y = Enemy.y + 2
    		end
    	end
    end
    ...though it would be much more helpful if you said what line the error was, and pointed that line out. you might find the problem yourself...lol
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

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

    without a line number, i can only assume the error occurred at the first:
    if stallchase == 1 then

    witch would mean your random() is a dud.

    edit:
    to slow :P
    Geändert von eyece (01-26-2007 um 03:38 PM Uhr)

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

    there is no line number for this error...


 

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 .