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; jw but is their a not symbol? edit: also what does the following error mean? lua:14240: control structure too long ...
-
06-19-2006, 07:51 AM #2701QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
jw but is their a not symbol?
edit: also what does the following error mean?
lua:14240: control structure too long neas ','
?
here is the line it is talking about:
for i = 1,42 do
Geändert von slicer4ever (06-19-2006 um 08:03 AM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-19-2006, 08:41 AM #2702
does solitaire work on 2.6
ive tried both v1 and v2 of the lua solitaire and they both load but freeze when i click any button, can you tell me what im doing wrong? :Cry:
-
06-19-2006, 08:43 AM #2703QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
they may call kernal commands are they lua files? (sorry not looking for them but if they are i could take a look)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-19-2006, 08:53 AM #2704QJ Gamer Bronze
- Registriert seit
- Feb 2006
- Ort
- Earth, UK
- Beiträge
- 457
- Points
- 5.924
- Level
- 49
- Downloads
- 0
- Uploads
- 0
hi,
how do you call certain images from a sprite set?
eg how would i select the bottom middle one from the sheet below?
Edit: the image size is 144x256Geändert von JoeDaStudd (06-19-2006 um 09:02 AM Uhr)
<<Put A message Here>>
<<Just made another rubbish website visit it here.>>
-
06-19-2006, 09:12 AM #2705QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
just make independent pics of each on:
like if you want the bottom left one you copy his pic onto a new image (just him use paint if you don't have anything that can modify pics)
then load his pic and call him in your program when need him1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-19-2006, 09:14 AM #2706QJ Gamer Bronze
- Registriert seit
- Feb 2006
- Ort
- Earth, UK
- Beiträge
- 457
- Points
- 5.924
- Level
- 49
- Downloads
- 0
- Uploads
- 0
ok thanks i thought i would be the easiest way but wanted to make sure it couldnt be done without using paint. Thanks again
<<Put A message Here>>
<<Just made another rubbish website visit it here.>>
-
06-19-2006, 09:17 AM #2707sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
anyone good with artificial intelligence? if so pm me cuz i need some quick help! thanks
-
06-19-2006, 09:41 AM #2708QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Try to just think logical, with several steps if to take action or not.
But it really depends on what type of game you are creating.[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
06-19-2006, 09:43 AM #2709QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
so anyways how about my question?
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-19-2006, 09:50 AM #2710
Slice you got and error lua.14240 that means there somthing wrong on that line i just dont hope you have that much lines.Post a part of you code.
Free Prizes at Prizerebel Join us!
I already got 11 Gifts. Ask me for details or proof.
-
06-19-2006, 10:00 AM #2711QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
ok :
well 1. that's only half way down my code i really have: 34139 lines of code
2. it's worked untill i put the line beforehand so thus i ask what is the not symbol?1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-19-2006, 01:43 PM #2712sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
Anyone?!?!
Zitat von Bronx
-
06-19-2006, 01:46 PM #2713
@Slicer:The not symbol is "~"
@Bronx: Have you tried the tuts by Vaza? If so, I dont have any better advice. I have to get started with AI myself.
You can "grab" a smaller image from a bigger one. You dont have to have them as seperate files. Altough that might be easier, but I believe this way the total image filesize is smaller. What you have to do for the bottom middle is this:
Zitat von JoeDaStudd
where newImage becomes your bottom middle image.Code:newImage:blit(0,0,sprite,49,193,48,192)
(I assumed one smaller piece is 144/3=48 wide and 256/4=64 high)Geändert von Altair (06-19-2006 um 01:54 PM Uhr)
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
06-19-2006, 02:06 PM #2714
Woops! doublepost...
For the error, check here: http://www.lua.org/source/4.0.1/src_lcode.c.html
Zitat von slicer4ever
Unfortunately I dont know C so someone else will have to explain this to you. Maybe the for loop is to big? As in 42 is to big? Cant imagine why though.LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
06-19-2006, 02:47 PM #2715words 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
slice4ever - I need to see the line before that for loop and the line after the for loop...
By the looks of it, you have a structure above the for loop, and you have set too large of a value/data type in it... im just guessing though, so...
...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
-
06-19-2006, 04:52 PM #2716sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
yeah, i have used vaza's tut. but the cars only go one direction
-
06-19-2006, 07:12 PM #2717QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
ok well then since when the games finished it well be open-source anyways i'll post my code just give me about 5 min to transfer it from my laptop(reason why i didn't post it before)
edit: o and i thought the ~ was congruent not the not symbol do to in math you
use:
~
=
to represent congruency but whatever that well allow me to optimize my code a lot more
wait then i'm stupid cause == is congruency and i've neven even notice so well someone give me my sign i guess...
edit2: k here we go: dl a working version and a non working version (the line for non-working is on 14240 and search for -- in the working to figure out where the code is that's surpose to be there
note i know this is a highly un-optimized codeing but that well be improved upon in the future
here:
http://slicer4ever.50megs.com/lua%20risk.rarGeändert von slicer4ever (06-19-2006 um 07:35 PM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-19-2006, 07:28 PM #2718words 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
Well.... in C the 'not equal to' operator is the !...
if ( true != 1 )
break;
}
...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
-
06-19-2006, 07:30 PM #2719QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
yea same for flash so why i tried that i kept thinking ~= ment congruent not,not
edit: since the new copyright thing has came out i have all my own pic's(thanks to deanaw22) i'm just using the idea and name would i need to change the name and if so i'll change it to:
the world domination game
edit: also you forgot your opening bracket also isn't 1 another way for saying true where's 1 is true and 0 is false or is that only on calculators?Geändert von slicer4ever (06-19-2006 um 07:39 PM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-20-2006, 03:41 AM #2720
boolean is: true and false
1 and 0 are just numbers. They could just as easily been 9 and 374 for that matter. It depends on what you associate them with.
BTW I can't download the file, or is it already gone or something? It says Forbidden!LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
06-20-2006, 04:26 AM #2721Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
i have a question: in the lus snippet "firing multiple bullets" by pspmillionaire, the bullets shot, but they only shot half the time you pressed "X". like you had to press it a couple of times to get a bullet to shoot. i know that this is becuase of the oldpad satements. is there a better way to make the bullets shoot, so that EVERY time you press "X', a bullet shoots??? thx.
--------------------------------------------------------------------------------------
-
06-20-2006, 06:49 AM #2722Developer

- Registriert seit
- Oct 2005
- Ort
- Boston, MA
- Beiträge
- 1.389
- Points
- 14.378
- Level
- 77
- Downloads
- 0
- Uploads
- 0
You can add 4 major operators for it then.
Zitat von Bronx
--VazaCode:math.randomseed(os.time()) --This determines the direction the AI will go. PositionAI = math.random(1, 50) if PositionAI == 1 then Char.Direction = "Left" elseif PositionAI == 2 then Char.Direction = "Right" elseif PositionAI == 3 then Char.Direction = "Up" elseif PositionAI == 4 then Char.Direction = "Down" end --[[ This means if math.random chooses 1, 2, 3 or 4, the direction of the Character will change This is just sample code, you may want to make it more complicated]]-- CharacterAI = math.random(1, 100) --[[ If math.random Chooses 1 or 2, the Characters action will change to the action associated with that number. if it doesnt choose 1 or 2 then the action that was active previously will continue being executed until it is changed.]]-- --Action 1 and 2 can be whatever you want, you can add more, by duplicating some code and changing variables if CharacterAI == 1 then CharAction = "Action1" elseif CharacterAI == 2 then CharAction = "Action2" end if CharAction == "Action1" then if Char.Direction == "Left" then --Action1 code moving left here end if Char.Direction == "Right" then --Action1 code moving Right here end if Char.Direction == "Up" then --Action1 code moving up here end if Char.Direction == "Down" then --Action1 code moving down here end end if CharAction == "Action2" then if Char.Direction == "Left" then --Action2 code moving left here end if Char.Direction == "Right" then --Action2 code moving Right here end if Char.Direction == "Up" then --Action2 code moving up here end if Char.Direction == "Down" then --Action2 code moving down here end end
-
06-20-2006, 06:52 AM #2723sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
thanks. i did actually set enemy.direction = math.random(1, 50) but it didnt work. ill try to do u posted here
Zitat von Vaza
-
06-20-2006, 07:41 AM #2724QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
damit ok 1 min i'll re-upload them somewheres else
edit: here we go:
http://www.geocities.com/slicer4ever06/lua_risk.zipGeändert von slicer4ever (06-20-2006 um 08:02 AM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-20-2006, 10:45 AM #2725
Wow thats way too much code and not very clear (to me that is, I dont code to clear myself, but its completely clear to me).
You do the same thing alot of times, only for different table entries, why dont you use a for loop for that, instead of everything beneath eachother?
I counted the amount of lines for one thing that you do for all the countries and its 11607!!! I think this could be reduced to like 250?
Anyway Its to much for me to help you Im sorry. Its also pretty hard without being able to run it, since I dont have the pics. I hope SG57 can help you. Atleast he knows C so he'll probably can tell you how to handle that error.LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
06-20-2006, 11:29 AM #2726QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
yes well as of which at the time i did most of the codeing i didn't know how to incorporate the number into the name if you notice i uselike:
countries1
countries2
etc
now i know i could have done sometin like:
for i = 1,42 do
countries..i
end
at the time i didn't know how to add the current i to the end of the name and i didn't relize ~ was the not symbol although i have an idea for now of how i may be able to bypass my currentsituation
edit: i did manage to bypass the section i was haveing the problem with but now a new one has come:
i use:
for i = 1,maxplayers do
then i do:
player..i..circle
although that's the line i get the error on should that when lua reads it make it as:
player1circle
player2circle
etcGeändert von slicer4ever (06-20-2006 um 12:18 PM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-20-2006, 03:27 PM #2727
Could you rephrase that, as I dont understand.
Zitat von slicer4ever
You could also use an array:
for i = 1,maxplayers do
player[i]circle
endLUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
06-20-2006, 04:00 PM #2728QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
what i was asking is when i do the following:
for i = 1,maxplayers do
player..i..circle
end
when luaplayer goes and reads that line(player..i..circle) shouldn't it output it as:
player1circle
player2circle
player3circle
player4circle
player5circle
etc
but either way i'm around that now and about to release to my beta testers in 5-10 min1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
06-20-2006, 04:05 PM #2729
That's great news! Lol evrytime you ask something you solve it yourself before I even understand your quesion. How long do you think untill official release?
Also is everything functional? I mean the game works as it would in real life?LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
06-20-2006, 04:12 PM #2730QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
no i still need cards and alot of other things but i have a big battle system i need to ensure is working properly so this is why i'm giving it to my beta's as soon as i get my laptop to read my flash drive
edit: the not symbol(~) is just what i needed to cut down my code just enough to get it working=-)Geändert von slicer4ever (06-20-2006 um 04:15 PM Uhr)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been


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