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; if i post my source can u guys look at it because i have a lot of problems in it ...
-
11-18-2006, 05:27 AM #4171Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
if i post my source can u guys look at it because i have a lot of problems in it and i cant just post them all.
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!
-
11-18-2006, 12:50 PM #4172
sure
yea just post it, and we can all look over it.
Zitat von GuitarGod1134
-
11-18-2006, 01:22 PM #4173QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
hey who knows the command to return the current fps? i looked though several commands list but coudn't find it
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
-
11-18-2006, 01:43 PM #4174QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
You have to use a combination of stuff, ive seen it somewhere before.....
-
11-18-2006, 01:47 PM #4175QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
You have to work it out yourself. The FPS is 1 / TheTimeTakenToCompleteOne Frame.
-
11-18-2006, 01:50 PM #4176QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i know that but i was just wondering if there was a command for it i guess i'll figure it out
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
-
11-18-2006, 01:55 PM #4177QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Theres a combination of 2-3 functions that can do it for you. Ive seen it before on evilmana or psp-programming IIRC, look around and you oughta find it.
-
11-18-2006, 02:03 PM #4178Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
There are so many bugs in my game and it would be appreciated if anyone could give any help at all thanks.
Ok here is my menu code
Spoiler for Menu Code:
This is the single player code
Spoiler for Single Player Code:
This is the Multiplayer code involving two people holding one psp
Spoiler for Multiplayer Code:
And here are the pics if you wanna run it and bug test it. (which i encourage because that would be a great help)
--single player problem
And also the problem with the single player when i hold r it keeps making random numbers and changing the picture or it doesnt work at all. i want it so that when i hold r it selects and random number and sticks with it. if u run the code you will see my problem.
--multiplayer problem
nothing is wrong with this but bug testing it would still be appreciated
--menu
just doesnt work at all. even though its the index.lua file it starts multilplayer.lua instead.
--to install
put them all in one folder name the menu
index.lua and multiplayer multiplayer.lua and singleplayer singleplayer.lua and the pics go in the folder with the scripts.
thanks for your help.Geändert von GuitarGod1134 (12-02-2006 um 04:16 PM Uhr)
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!
-
11-18-2006, 02:22 PM #4179The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
isn't the multi player a little stupid ????? doesn't the program have to wait for player 2 then show the pictures ???????
coz you blit the pic when player 1 selects then player2 selects !!!!!
and I'm finding that LUA is really ****ing easy!!!!Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
11-18-2006, 02:30 PM #4180Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
cover the screen. lol
ill fix that in version 3
EDIT: NO actually in a true rock paper scissors game ur supposed to pick at the same time remember. ROCK PAPER SCISSORS and pick. in version 3 ill add a timer or something that activates when l is pressed.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!
-
11-18-2006, 02:36 PM #4181The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
ahhh
lol ok here some ascii graphics ... I don't like your pics :
Code:.--. .----. `-._`-._ ( ) `-._`-._ _.-\__.-' `-._`--' _.-' .-' _(/)(_ _.-'_.-' `.`------.__ _.-'_.-' \ \ `--' `-.____.-' _ / | / \ | | /\ \ \| |/ / \ Y | /___ .-.) '. `__/ (.-. / / | ' | |___| [_____] | | or .'` __/_______ ---' -'` ______) _______) _______) -----..___________) or all these Rock _______ ---' ____) (_____) (_____) (____) ---.__(___) Paper _______ ---' ____)____ ______) _______) _______) ---.__________) Scissors _______ ---' ____)____ ______) __________) (____) ---.__(___)Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
11-20-2006, 04:45 PM #4182
hey how do i get the lua player for windows to work ://www.freewebs.com/blackbelttyler/luaplayer%20windowsa%2Dla rge.png"]srry this is it
-= Double Post =-
the first one was right
-= Double Post =-
srry guys how do i get this to workGeändert von Blackbelttcon (11-20-2006 um 04:45 PM Uhr) Grund: Automerged Doublepost
-
11-20-2006, 04:50 PM #4183lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Get your lua files and place them in that folder(Where LUA Windows Player is) then delete the "test.lua" file then rename you index file "test" then run the test program, If it doesn't load the script, then you file is wrong.
-
11-20-2006, 05:44 PM #4184
lol
ur smily pic in your sig is tight unique warrior. and yes your pics would be better even with those ascii graphics.
-
11-20-2006, 06:00 PM #4185The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
yeah!!!!!!!!!!
Zitat von emericaska8r
I love ascii
Best,Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
11-21-2006, 08:31 AM #4186Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
hmm somebody should help this guy
Zitat von GuitarGod1134
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!
-
11-21-2006, 01:08 PM #4187The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
here is some help from a C coder

Code:-- *******Lua Rock Paper Scissors*********** -- Script written by GuitarGod1241 or GuitarGod1134 or GuitarGod1124 -- DUE TO POPULAR DEMAND WE NOW HAVE SINGLE PLAYER!!! --variables rock = Image.load("rock.png") scissors = Image.load("scissors.png" ) paper = Image.load("paper.png") battlefield = Image.load("field.png") green = Color.new(0, 255, 0) --delcare old pad to prevent hold down button bug oldpad = Controls.read() -- main loop starts here while true do pad = Controls.read() for a = 0, 14 do for b = 0,8 do screen:blit(32 * a, 32 * b, battlefield) -- variable that decides the win player1 = 0 computer = 0 -- variable added < TUW: if random nr was used randomnr = 0 --prevents the same random numbers on each program run math.randomseed(os.time() ) --x=width y=height -- this is player 1 screenrint(140, 0, "Let the Battle Begin!", green) screenrint(0,20, "Player 1 Select your Weapon" ,green) if pad:left() then screen:blit(0, 40, rock) player1 = player1 + 3 end if pad:up() then screen:blit(0, 40, paper) player1 = player1 + 4 end if pad:down() then screen:blit(0, 40, scissors) player1 = player1 + 5 end -- now the psp's turn screenrint(250, 20, "PSP Select your Weapon" ,green) if pad:r() then if randomnr == 0 then computer = math.random(3,5) randomnr = 1 end end if computer == 3 then screen:blit(390, 40, rock) end if computer == 4 then screen:blit(390, 40, paper) end if computer == 5 then screen:blit(390, 40, scissors) end --now time to compare if player1 == 3 and computer == 3 then screenrint(150, 150, "YOU BOTH LOST OMG" ,green) randomnr = 0 end if player1 == 4 and computer == 4 then screenrint(150, 150, "YOU BOTH LOST OMG", green) randomnr = 0 end if player1 == 5 and computer == 5 then screenrint(150, 150, "YOU BOTH LOST OMG", green) randomnr = 0 end -- these are if player1 wins if player1 == 4 and computer == 3 then screenrint(150, 150, "Player 1 is the winner!", green) randomnr = 0 end if player1 == 5 and computer == 4 then screenrint(150, 150, "Player 1 is the winner!", green) randomnr = 0 end if player1 == 3 and computer == 5 then screenrint(150, 150, "Player 1 is the winner!", green) randomnr = 0 end -- these are if psp wins if player1 == 3 and computer == 4 then screenrint(150, 150, "PSP is the winner!", green) randomnr = 0 end if player1 == 4 and computer == 5 then screenrint(150, 150, "PSP is the winner!", green) randomnr = 0 end if player1 == 5 and computer == 3 then screenrint(150, 150, "PSP is the winner!", green) randomnr = 0 end end end screen.waitVblankStart() screen.flip() oldpad = pad endMalloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
11-21-2006, 01:28 PM #4188QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
In that case, here is some feedback from a 'C coder'.:
Zitat von the unique warrior
1. You haven't tested it, screenrint should be screen:print (guessing smiley problem)
2. Naming conventions are non-existant
3. No code formating
4. Magic numbers used all over the place
5. Duplicated code
6. oldpad not used. Redundent variable
-
11-21-2006, 05:58 PM #4189The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
meh I just added this :
the others where his ownCode:-- variable added < TUW: if random nr was used randomnr = 0 if randomnr == 0 then computer = math.random(3,5) randomnr = 1 end
Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
11-22-2006, 07:49 AM #4190Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
haha thanks i was going to make a table or something but didnt.
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!
-
11-22-2006, 01:57 PM #4191QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- London, United Kingdom
- Beiträge
- 131
- Points
- 4.812
- Level
- 44
- Downloads
- 0
- Uploads
- 0
Its easy if there was always a fixed amount of text, but there isnt. So i attempted to apply a varible amount of padding but that didnt work either.
Zitat von pspgamer81
To recap, I want to be able to right justify text. My methods didnt work, so if someone would lend a helping hand..
-
11-22-2006, 05:11 PM #4192Designs

- Registriert seit
- Jul 2006
- Ort
- Canada
- Beiträge
- 1.395
- Points
- 14.040
- Level
- 76
- Downloads
- 0
- Uploads
- 0
what is the input for the right and left trigger for controls?

-
11-22-2006, 05:37 PM #4193Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von yoyomacy
Code:while true do pad = Controls.read() if pad:l() then blah end if pad:r() blah end
--------------------------------------------------------------------------------------
-
11-22-2006, 05:41 PM #4194The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
lol now you did ;)
Zitat von GuitarGod1134
Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
11-22-2006, 05:42 PM #4195QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
hey, does anyone know how to install LuaPlayerMod3? it didnt come with instructions for installation.
its the mod that adds mp3 and ogg support by cools.
...or maybe...
edit - yep, nevermind, i got it working. odd though that the mod's own "mp3 test" gets an error..Geändert von EminentJonFrost (11-23-2006 um 07:28 AM Uhr)
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
11-23-2006, 02:14 AM #4196Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Alright well Lua RPS is really being annoying now and every response or fix I have gotten on my code still doesnt work. Unique Warrior everytime I hold down R the psp doesnt stick with ONE option ie (rock paper or scissors) instead it just keeps changeing and pressing r one only blits the pic for a second and the variable probally only has that value for a second as well so im just gonna drop this project and get back to work on maze of doom. Also does anyone know any other tutorials besides the ones on evilmana? and on some websites they just copy the ones on evilmana lol.
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!
-
11-23-2006, 03:03 AM #4197QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
how about this, GG?
http://www.lua.org/map.html[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
11-23-2006, 05:38 AM #4198The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Changed
sorry about that

here this one should work :)
Best,Code:-- *******Lua Rock Paper Scissors*********** -- Script written by GuitarGod1241 or GuitarGod1134 or GuitarGod1124 -- DUE TO POPULAR DEMAND WE NOW HAVE SINGLE PLAYER!!! --variables rock = Image.load("rock.png") scissors = Image.load("scissors.png" ) paper = Image.load("paper.png") battlefield = Image.load("field.png") green = Color.new(0, 255, 0) --delcare old pad to prevent hold down button bug oldpad = Controls.read() -- main loop starts here while true do pad = Controls.read() for a = 0, 14 do for b = 0,8 do screen:blit(32 * a, 32 * b, battlefield) -- variable that decides the win player1 = 0 computer = 0 -- variable added < TUW: if random nr was used randomnr = 0 --prevents the same random numbers on each program run math.randomseed(os.time() ) --x=width y=height -- this is player 1 screenrint(140, 0, "Let the Battle Begin!", green) screenrint(0,20, "Player 1 Select your Weapon" ,green) if pad:left() then screen:blit(0, 40, rock) player1 = player1 + 3 end if pad:up() then screen:blit(0, 40, paper) player1 = player1 + 4 end if pad:down() then screen:blit(0, 40, scissors) player1 = player1 + 5 end -- now the psp's turn screenrint(250, 20, "PSP Select your Weapon" ,green) if pad:r() then if randomnr == 0 then computer = math.random(3,5) end end if computer == 3 then screen:blit(390, 40, rock) randomnr = 1 end if computer == 4 then screen:blit(390, 40, paper) randomnr = 1 end if computer == 5 then screen:blit(390, 40, scissors) randomnr = 1 end --now time to compare if player1 == 3 and computer == 3 then screenrint(150, 150, "YOU BOTH LOST OMG" ,green) randomnr = 0 end if player1 == 4 and computer == 4 then screenrint(150, 150, "YOU BOTH LOST OMG", green) randomnr = 0 end if player1 == 5 and computer == 5 then screenrint(150, 150, "YOU BOTH LOST OMG", green) randomnr = 0 end -- these are if player1 wins if player1 == 4 and computer == 3 then screenrint(150, 150, "Player 1 is the winner!", green) randomnr = 0 end if player1 == 5 and computer == 4 then screenrint(150, 150, "Player 1 is the winner!", green) randomnr = 0 end if player1 == 3 and computer == 5 then screenrint(150, 150, "Player 1 is the winner!", green) randomnr = 0 end -- these are if psp wins if player1 == 3 and computer == 4 then screenrint(150, 150, "PSP is the winner!", green) randomnr = 0 end if player1 == 4 and computer == 5 then screenrint(150, 150, "PSP is the winner!", green) randomnr = 0 end if player1 == 5 and computer == 3 then screenrint(150, 150, "PSP is the winner!", green) randomnr = 0 end end end screen.waitVblankStart() screen.flip() oldpad = pad endMalloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
11-23-2006, 07:47 AM #4199Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Ill run it and check it out and thanks EminentJon ill take a look at that site too.
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!
-
11-23-2006, 12:55 PM #4200The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
tell me the results
I know this is not professional LUA coding but I like to learn (I know what is going on in all of this
)
Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.


LinkBack URL
About LinkBacks
Mit Zitat antworten
rint(0,0, " The Following Controls Are...", green)

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