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; Zitat von youresam netlib isnt running right now though...want me to turn it on..? And SG57- lua is different from ...
-
05-06-2007, 06:20 PM #7261QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Zitat von youresam
Eh. I'm not going to create a networked game yet. If I did it would me some massive game and I just started LUA so I should probably try and understand the language first.
-
05-06-2007, 06:20 PM #7262
thanks.you put a r in there by the way:)
-
05-06-2007, 06:30 PM #7263
Ever thought of looking at luaplayer.org where it fully documents every Lua Player function?
Zitat von Bob Hoil
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-06-2007, 06:33 PM #7264QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Random question: In the future if I ever become as '1337' as some of the people around here and decided to make something online on my own server, what would I need, and is it possible to get a free server. I am an incredible cheap person. I don't like to use money, mainly because I don't have a job and paying for a server would be hard for me.
Offtopic: Wow, my username sucks.
-
05-06-2007, 06:38 PM #7265
Um... http://youresam.com/netlib
Thats all you need to easily make an online game. And I am hosting the netlib server, so its all set up.牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-06-2007, 06:50 PM #7266QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Kay. I'll try and set it up and see if I can...not fail at this ^_^
Thanks for the help.
(woo. Last time you will hear from me for another 16 hours =D)
-
05-06-2007, 06:54 PM #7267
Theres literally nothing to set up.. just incluide the file and put dofile("netlib.lua") and youre done.
But the server I have is still offline so it wont work.牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-06-2007, 07:06 PM #7268QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I'll work on a server later. If I actually make this game well then I might put some online into it and try and get a small server for it. Something within my price range....5 dollars to free. (Any idea on where I can find a cheap server? If not then I'll just actually work this summer and get money.)
-
05-06-2007, 07:11 PM #7269QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
1337? That was a joke right?
Zitat von yumCOOKIEZZ
-
05-06-2007, 07:12 PM #7270QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Yes.
-
05-06-2007, 07:26 PM #7271
I'm sitting here telling you that I HAVE CREATED A SERVER and anyone is FREE TO USE IT and it has a FULLY FEATURED API...and you keep ignoring me.
Zitat von yumCOOKIEZZ
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-06-2007, 07:39 PM #7272QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Yes I understand but all the cool kids host their own servers.
New question: How do I make the pictures animate, so when I am moving left a new picture will come up. The person just kinda sliding around to move is lame.
Annnd now I really leave for 16 hours.
-
05-06-2007, 07:45 PM #7273
:Argh:
Zitat von yumCOOKIEZZ
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-06-2007, 07:49 PM #7274QJ Gamer Gold
- Registriert seit
- Nov 2006
- Ort
- ...
- Beiträge
- 2.080
- Points
- 11.942
- Level
- 71
- Downloads
- 0
- Uploads
- 0
youresam, just take it easy
-
05-06-2007, 07:50 PM #7275
lolz... :) cool kids..
own severs...:ROFL:
-
05-06-2007, 11:18 PM #7276QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
client != server
Zitat von yumCOOKIEZZ
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
05-07-2007, 06:55 AM #7277Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
lol cool kidzz ,
better thank youresame and use it
-
05-07-2007, 09:09 AM #7278Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
you have trouble spelling cookie. i doubt you'll be able to make/host a server. listen to what youresam says.
Zitat von yumCOOKIEZZ
--------------------------------------------------------------------------------------
-
05-07-2007, 11:32 AM #7279QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
>.< I was kidding about the cool kids. And how do I have spelling issues o.O. I checked and...nothing seems to be spelled wrong there.
So...Anyone wanna info me up on the animation thing.
>.> Didn't mean to cause head banging against a brick wall. I just kinda ask questions. Thank you youresam.
-
05-07-2007, 12:36 PM #7280
hi there people... im having some trubles whit table.remove()... somthing weird hapen... letme explain: im working whit oop, and in this case the objects are bulets, soo i have this code:
soo to create a new bullet and put it on a array i use:Code:bullets = {} bullet = {} metabullet = {} function bullet:New(x1,y1,speed1,angle1,box) x = x1 y = y1 angle = angle1 speed = speed1 life = 1 radius = -1*box[3][4] return(setmetatable({X = x, Y = y, Radius = radius, Angle = angle, Speed = speed,Life = life}, metabullet)) end function bullet:updt(Index) died = false if self.Life > 0 then oldx = self.X oldy = self.Y if self.Y < self.Radius or self.Y > 272 - self.Radius or self.X < self.Radius or self.X > 480 - self.Radius then self.Life = 0 Angle = self.Angle *200 Angle = math.random(Angle-100,Angle+100) Angle = Angle /200 for i = 1, 2 do particles[table.getn(particles)+1] = particle:New(self.X,self.Y,math.random(4,self.Speed),Angle,Plane4x4,255,220,0,1) end table.remove(bullets,Index) end self.X = self.X-math.sin(self.Angle)*self.Speed self.Y = self.Y-math.cos(self.Angle)*self.Speed screen:fillRect(self.X-self.Radius,self.Y-self.Radius,self.Radius*2,self.Radius*2,blue) else table.remove(bullets,Index) end end metabullet.__index = bullet
soo each time i do this a new item in bullets is creates and it holds a bullet object.Code:bullets[table.getn(bullets)+1] = bullet:New(hero.X,hero.Y,20,hero.bulletangle+.02,Plane10x20)
soo to update the bullets i do:
where x is the index bullet to update, and if the bullet die then use the same x to remove....whit this line table.remove(bullets,Inde x) in the bullets:updt function...Code:--------------- -- bullets -- --------------- x = 1 while x <= table.getn(bullets) do bullets[x]:updt(x) x = x + 1 end
the thing is that when i shut some bullets.. tey work good, but when all of them die, i cant shot one more time... this is when im roning the code directli on psp.... when i run it on lua windows, it letme create asmany bullets as i want but when i shut left... and the bullet die in the wall, i got a nil index value.... wyyyy ???... is there somthing im missing on the table.remove thing... i read that this function remove an array item and corp the other one.. so if i remove index 1 the one that uses tu be 2 is now 1 and soo whit the others... im veryy worried about this,, coss is the way i wanted to optimise som code... but got this trouble.... pleaseeee some bodyy help...
-
05-07-2007, 01:08 PM #7281
I had a similar problem, it's caused by a bug in the table.remove function. This was fixed in the latest lua source, however some versions of the Lua Player that are floating around still used the older version of the lua sources.
-
05-07-2007, 02:00 PM #7282
Yeah sorry... I was gonna change it after I posted it because it seemed a bit rude...but I couldnt see my post so I thought it didnt post...bleh?
Zitat von yumCOOKIEZZ
-= Double Post =-
You mean lua 5.0.2?...everything below Lua Player .19?
Zitat von Merick
Geändert von youresam (05-07-2007 um 02:01 PM Uhr) Grund: Automerged Doublepost
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-07-2007, 02:05 PM #7283
I get the following error: Error: game.lua:64: attempt to index local 'object' (a nil value)Code:green = Color.new(0,255,0) white = Color.new(255,255,255) grass = Image.load("grass.png") tree = Image.load("tree.png") no = Image.load("no.png") collision=false bgimg = Image.createEmpty(480,272) for a = 0, 14 do for b = 0,8 do bgimg:blit(a*32, b*32, grass) end end bgimg:blit(312,228,tree) bgimg:blit(400,200,tree) bgimg:blit(150,150,no) bgimg:blit(300,28,tree) bgimg:blit(30,80,no) bgimg:blit(255,100,no) bulletimg = Image.createEmpty(4,4) bulletimg:clear(Color.new(0,255,0)) bulletimgwidth = bulletimg:width() bulletimgheight = bulletimg:height() blockimg = Image.load("deer.png") blocks = {} blocks[1] = {x = 10, y = 100, height = blockimg:height(), width = blockimg:width()} player = {x = 200, y = 50, w = 32, h = 32, oldx = 200, oldy = 50, img = Image.load("player.png"), health = 100, s = 4} playerHeight = 32 playerWidth = 32 score = 0 radius = 25 speed = 5 degree = 0 bullet = {} function runbullets() numbullets = table.getn(bullet) for i = 1,numbullets do bullet[i].x = bullet[i].x + bullet[i].xs bullet[i].y = bullet[i].y + bullet[i].ys screen:blit(bullet[i].x,bullet[i].y,bulletimg) if bullet[1].x > 480 or bullet[1].x < 0 or bullet[1].y > 272 or bullet[1].y < 0 then table.remove(bullet,1) break end end end function firebullet(_xs,_ys) table.insert(bullet, {x = player.x, y = player.y, w = bulletimgwidth, h = bulletimgheight, xs = _xs, ys = _ys}) end function collisionCheck(object) if (player.x + playerWidth > object.x) and (player.x < object.x + object.width) and (player.y + playerHeight > object.y) and (player.y < object.y + object.height) then return true end end function runblocks() degree = degree + speed radian = (degree/180)*math.pi for i = 1, table.getn(blocks) do blocks[i].x = 240+math.cos(radian)*radius blocks[i].y = 136-math.sin(radian)*radius screen:blit(blocks[i].x,blocks[i].y,blockimg) if collisionCheck(blocks[1]) then player.health = player.health - 5 if collisionCheck(bullet[1]) then blocks[1]=false end end end end function newblock(x,y) table.insert(blocks,{x = _x, y = _y, w = blockimgwidth, h = blockimgheight}) end while true do pad = Controls.read() player.oldx = player.x player.oldy = player.y screen:clear() screen:blit(0,0,bgimg) screen:print(150,10, "Score:" .. score,white) screen:print(10,10, "Health:" .. player.health,white) screen:blit(player.x,player.y,player.img) runbullets() collisionCheck(bullet[1]) collisionCheck(blocks[1]) runblocks() if pad:left() then player.x = player.x - player.s if player.x < 0 then player.x = 0 end elseif pad:right() then player.x = player.x + player.s if player.x > 480 - player.w then player.x = 480 - player.w end elseif pad:up() then player.y = player.y - player.s if player.y < 0 then player.y = 0 end elseif pad:down() then player.y = player.y + player.s if player.y > 272 - player.h then player.y = 272 - player.h end end if pad:cross() and not oldpad:cross() then firebullet(0,10) elseif pad:triangle() and not oldpad:triangle() then firebullet(0,-10) elseif pad:circle() and not oldpad:circle() then firebullet(10,0) elseif pad:square() and not oldpad:square() then firebullet(-10,0) end screen.waitVblankStart() screen.flip() oldpad = pad if pad:start() then break end end
I have changed a few things but i still get the error. This is the first time i have gotten this error.
-
05-07-2007, 02:06 PM #7284
hooo my... soo in new vercion of lua. its fiexd... but is there a new lua vercion that uses gu.lookat funcion?--- cince im using this in my code.. please,, if someone know about one tellme.. or... can some one make a mod.. that holds the bug fix and gu.lookat ?... :Cry: pleaaseeee..
Zitat von Merick
-
05-07-2007, 02:13 PM #7285
theres lots
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-07-2007, 02:18 PM #7286QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Bob-You're trying to do a collision with something that doesn't exist.
-
05-07-2007, 02:19 PM #7287
how can i get lua games if i have 3.11????
-
05-07-2007, 02:36 PM #7288
Ask Robin-Beyond
Zitat von Batman-Beyond
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
05-07-2007, 02:43 PM #7289
im serious i dont no nothin about nothin i never even got an homebrew game on my psp in my life!!!!!!!!!
-
05-07-2007, 02:46 PM #7290
OK thanks tactical i will fix it.
-= Double Post =-
Ok if i changed bullet[1] to bullet(that is the table name) i get attempt to compare nil with number. I am not sure how to do the collision for the bullet. I got everything else like the health and everything. This one is giving me problems though.Geändert von Bob Hoil (05-07-2007 um 03:02 PM Uhr) Grund: Automerged Doublepost


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