Zeige Ergebnis 8.341 bis 8.370 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; any more ideas FaT3oYCG?...
-
01-28-2008, 03:34 PM #8341Banned from QJ for LIFE
- Registriert seit
- Jul 2006
- Beiträge
- 1.557
- Points
- 10.957
- Level
- 69
- Downloads
- 0
- Uploads
- 0
any more ideas FaT3oYCG?
-
01-28-2008, 03:41 PM #8342QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Well, for every one of your "screen
rint()" calls, you didn't include a 4th argument. I'm pretty sure you need to supply one, not sure.
-
01-28-2008, 06:39 PM #8343QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
A fourth argument is not needed for screen
rint, it will default to black.
-
01-29-2008, 04:17 AM #8344Banned from QJ for LIFE
- Registriert seit
- Jul 2006
- Beiträge
- 1.557
- Points
- 10.957
- Level
- 69
- Downloads
- 0
- Uploads
- 0
it isn't needed but if you tell me what to change i can try it just to see.
-
01-29-2008, 12:16 PM #8345QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Thanks, TurtlesPwn.
-
01-29-2008, 12:30 PM #8346Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Code:menuBackground=Image.load("fl.png") screen:blit(0,0,menuBackground) screen:print(30,30,"What Does Ds mean?") screen:print(80,130,"Dualshock") screen:print(300,130,"Duel screen") screen:print(200,220,"Dual screens") oldpad=Controls.read() while true do pad=Controls.read() --------------------------- if pad:square() then dofile("ni/wrong.lua") end if pad:circle() then dofile("ni/wrong.lua") end if pad:triangle() then dofile("ni/right.lua") end --------------------------- screen.flip() screen.waitVblankStart() oldpad = pad 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).
-
01-29-2008, 02:02 PM #8347Banned from QJ for LIFE
- Registriert seit
- Jul 2006
- Beiträge
- 1.557
- Points
- 10.957
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Bol**ks still didn't work, it doesn't seem to even be trying to load the 1.lua file anyway so it must be a kat.lua or its got something else elsewhere relating to it i haven't seen.
-
01-30-2008, 04:08 PM #8348
- Registriert seit
- Jan 2008
- Beiträge
- 10
- Points
- 2.792
- Level
- 32
- Downloads
- 0
- Uploads
- 0
Lua player for 3.71 M33 + System.usbDiskModeActivat e
Hello,
I'm just learning Lua, and I'm trying to get System.usbDiskModeActivat e() to work on my PSP-2000 slim cfw3.80M33-5.
I have LuaPlayer for cfw3.71M33 installed in my /game folder.
In the Lowser/index.lua if you hit the L trigger, its supposed to trigger USB mode, but all it does is freeze up the LuaPlayer, so I have to hit [home] to quit out of it.
The memory stick LED flickers a second after I hit L trigger, but just freezes.
I've tried this on a completely clean memory stick with no plugins installed and only LuaPlayer installed, and connected to two different PC's.
I've also tried this with the PSPhud 1.3 installed to see if it was hitting the cpu when it locked, but it didn't appear to be.
I suspect cfw3.80M33-5 has something to do with it.
I've been searching a while for something about this, but can't seem to find anything.
Is there a better LuaPlayer for the Slim cfw3.80M33-5 anywhere?
I'm a complete noob at this, so sorry if theres something obvious I've missed.
Any help or insight would be greatly appreciated.
Thanks.
-
01-30-2008, 04:23 PM #8349Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
it just shows up as corrupted data on mine so you are further than me
Zitat von IMIX
and it probably wont work seen as in 3.80 there were some nid changes which mean that when it was made for 3.71 the nids are now different so do not relate to the same things
basically i cant get it to work at all and even if it does work like on yours i dbout any of the main functions will work - until a 3.80 version is made if there ever is------ 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).
-
01-30-2008, 05:00 PM #8350
- Registriert seit
- Jan 2008
- Beiträge
- 10
- Points
- 2.792
- Level
- 32
- Downloads
- 0
- Uploads
- 0
That makes sense, I didn't think about the nid changes.
I guess i could try to contact Emeric0101 over at XtreamLua.com to see if there's any chance of a new LuaPlayer release for the new cfw..
I wish I knew enough to mess with that stuff myself.
are you saying that the 3.71 luaplayer wont even run for you?
I formatted and reset my flash1 in recovery after this last update,
dunno if that would make a difference for you or not.
Thanks for the quick reply!
-
01-30-2008, 06:14 PM #8351QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
I just use Cool's Mod 4 built for 1.50. I use it in 3.80 M33-5 and the System.usbDiskModeActivat e() works perfectly.
-
01-30-2008, 06:40 PM #8352
- Registriert seit
- Jan 2008
- Beiträge
- 10
- Points
- 2.792
- Level
- 32
- Downloads
- 0
- Uploads
- 0
I just ran the 3.71-M33 LuaPlayer on eLoader 1.0, and System.usbDiskModeActivat e() works now!!!
I've tried running every other LuaPlayer I could find normally, even through eLoader, with no luck.
how'd you get Mod 4 for 1.50 running on your slim?Geändert von IMIX (01-30-2008 um 07:31 PM Uhr)
-
01-30-2008, 06:48 PM #8353QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Oh no, not on a slim, sorry. I misunderstood. My bad.
-
01-30-2008, 07:30 PM #8354
- Registriert seit
- Jan 2008
- Beiträge
- 10
- Points
- 2.792
- Level
- 32
- Downloads
- 0
- Uploads
- 0
ah, no problem.
got it working (or worked around).
thanks all!
:Jump:
-
01-31-2008, 06:09 PM #8355QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Good job! :)
-
02-10-2008, 12:47 PM #8356
hi,
i wanted to create a tile engine, but i get "loop in gettable" in line 27, which is
the whole code:Code:screen:blit(x*picture:width()+1-picture:width(),y*picture:height()+1-picture:heigt(),picture)
i hope you can help me.....im still a noob and it took quite some time to come up with this oOCode:white = Color.new(255,255,255) green = Color.new(255,255,255) tiles = {} tiles[1] = Image.createEmpty(30,30) tiles[1]:clear(white) coord = {} coord[1] = {} coord[1].x1 = 1 coord[1].x2 = 6 coord[1].y1 = 3 coord[1].y2 = 7 coord[2] = {} coord[2].x1 = 8 coord[2].x2 = 11 coord[2].y1 = 2 coord[2].y2 = 8 function tile(x1,x2,y1,y2,picture) for x = x1,x2 do for y = y1,y2 do screen:blit(x*picture:width()+1-picture:width(),y*picture:height()+1-picture:heigt(),picture) end end end while true do screen:clear() tile(coord[1].x1,coord[1].x2,coord[1].y1,coord[1].y2,tiles[1]) tile(coord[2].x1,coord[2].x2,coord[2].y1,coord[2].y2,tiles[1]) screen.flip() screen.waitVblankStart() end
-
02-10-2008, 12:54 PM #8357QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
You misspelled height:
screen:blit(x*picture:wid th()+1-picture:width(),y*picture :height()+1-picture:heigt(),picture)
-
02-10-2008, 12:58 PM #8358
damn, i spent an hour just changing things in my script..
-
02-10-2008, 03:18 PM #8359words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Not to be rude, but that's hilarious lol
this too --------------->

...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
-
02-10-2008, 11:19 PM #8360
yea, i know ;(...... and the tile engine sucks anyway,im going to make a new one today..... are there any lua tutorials "more advanced" than the ones on evilmana?
-
02-11-2008, 06:20 AM #8361QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Don't make a tile engine more complex than it is - it's just a table with a bunch of tables inside it and each entry (tile) has some properties.
-
02-11-2008, 06:53 AM #8362Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i need i tiny bit of help!!!
I have a variable like this
enemy.health = 100
and another one for the player
i would like to know where to put this if statement
if enemy.health = 0 then
dofile("Story2.lua)
end
do i put it in the main loop or outside of it and also is that the correct if statement to use :?
-
02-11-2008, 11:04 AM #8363Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
requires tables
Zitat von dan369
my code was messed up although right i just edited it to give it popper line formattingCode:player = { health = 100 } enemy = { health = 100 } while true do -- game stuff for shooting or whatever if enemy.health == 0 then dofile("story2.lua") end end -- end of while loopGeändert von FaT3oYCG (02-14-2008 um 02:44 AM Uhr)
------ 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).
-
02-12-2008, 10:10 AM #8364QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Dang it. I had a great post all typed up and I lost it. Oh well; I'll try again.
Where you put the if statement depends on the complexity of your script and what you need the if statement to do. If the script is not very complex or the if statement is a big part of the game or application you are making, you can put it in the main loop. However, if you might need to only do the if statement under certain conditions, or if you would need to be able to have more control over the if statement, I would put it in a function outside of the main loop. Then, if need be, you can put that function inside of the main loop; you'll have more control over the if statement and all of your code.
Secondly, the if statement script you provided is incorrect.
It should be:Code:if enemy.health = 0 then dofile("Story2.lua) end
Here's why:Code:if enemy.health == 0 then dofile("Story2.lua) end
In lua, "=" and "==" have completely different meanings and uses. "=" is used to set a variable equal to something, such as in "red = Color.new(255,0,0)", or in "gamestate = 1". The symbol "==", however, is used to compare a variable to something, such as in your code, "if enemy.health == 0 then", or "if gamestate == 1 then".
I remember this difference in the way I say (or rather think) the names of the symbols. For "=" I think "equals", and for "==" I think "is equal to". This helps me keep them separated in my mind.
As for comparison symbols, there are others besides "==". In lua there are "<, >, <=, >=, and ~=. In order, these are "less than", "greater than", "less than or equal to", "greater than or equal to", and "not equal to". You can use these to compare variables to other variables or to numbers. For instance, "if enemy.health <= 0 then" would allow you to do the action even if the enemy has less than 0 health, as if he was "overkilled". Another example, "if gamestate ~= 1 then", would execute the code only if the variable gamestate is not equal to 1. For a final example, you can use these when using timers, such as in "if timer < 0 then", where timer is the variable connected to the timer in the script. The code would then only execute if the the timer has run below 0.
I hope this has helped you and others! I know you aren't the only one who didn't understand this concept; I see it being used incorrectly fairly often.
-
02-12-2008, 10:13 AM #8365Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
thanks i get it know
-
02-12-2008, 10:14 AM #8366QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
No problem. :)
-
02-13-2008, 05:50 PM #8367QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
And there was no second quote in the dofile.
You wrote:
when it should be:Code:dofile("Story2.lua)
Code:dofile("Story2.lua")
-
02-13-2008, 07:09 PM #8368QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Ah, nice catch. Didn't see that.
-
03-05-2008, 07:47 PM #8369QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 251
- Points
- 4.872
- Level
- 44
- Downloads
- 0
- Uploads
- 0
This may be a dumb question, but is there an easy way to restart my script? (Eg. Game Over! Press O to play a new game").
Or is the best thing to do just reset all the variables and things in a function.
-
03-05-2008, 07:58 PM #8370words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
littlevish - A typical 'restructure program flow or screw good practice' scenario.
Bad practice would be unloading all used resources then dofile("thisscript.lua"). One method of good practice would be creating a program that flows via 'game state's so restarting your script would be as easy as settingthe game state to the initial game state and initialize it. ('main menu' or 'intro' typically).
...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


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum