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 Grimfate126 if the name is somethin like blah.txt then just simply rename it to blah.lua windows may ask ...
-
04-03-2006, 06:46 PM #1291
Zitat von Grimfate126
Thats what I did but its still a text document.
-
04-03-2006, 07:02 PM #1292
Zitat von Grimfate126
ooo sorry change
screen
rint(130, 100, money_value[1], b)
screen
rint(130, 150, money_value[2], b)
to
screen
rint(130, 100, money_value[a], b)
screen
rint(130, 150, money_value[n], b)
that should be giving you two different random money values. what is it you're trying to accomplish?
i think to get rid of scientific notation you would just use
string.format("%d", moneyvalue[a])
insteadGeändert von califrag (04-03-2006 um 07:04 PM Uhr)
-
04-03-2006, 07:48 PM #1293Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
me along with 2 other pepps are workin on a deal or no deal trye game. so this functions is supposed to assign each case a money value. i put the print thing just to check it. but the math.random thing for variable "a" keeps its value, so every time it starts, each case has the same money. basically, i need it like this:
Zitat von califrag
1. a is a random number from 1 to 26.
2. when n is increased by one, "a" now equals ANOTHER number from 1 to 26, and so on, besides the number that has already been chosen.
sry if i sound confusingGeändert von Grimfate126 (04-03-2006 um 07:50 PM Uhr)
--------------------------------------------------------------------------------------
-
04-03-2006, 08:11 PM #1294
Never mind I fixed it. My mistake
Geändert von MrBoots (04-03-2006 um 10:42 PM Uhr)
-
04-03-2006, 11:13 PM #1295QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Ok, so my problem IS my source code then, here:
Code:blue = Color.new(0,0,255) screen:print(200, 130, "My name is Code-Zero!", blue) screen.flip() while true do screen.waitVblankstart() end
-
04-03-2006, 11:31 PM #129611th Squad Captain
- Registriert seit
- Jun 2005
- Ort
- You are here -----> 名前: アダム | 飲むコー
- Beiträge
- 2.562
- Points
- 26.490
- Level
- 97
- Downloads
- 0
- Uploads
- 0
Just a quick guess before i start coding, try this:
Zitat von code-zero
Code:blue = Color.new(0,0,255) while true do screen:print(200, 130, "My name is Code-Zero!", blue) screen.waitVblankstart() screen.flip() end
FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
-
04-03-2006, 11:54 PM #1297
Zitat von Grimfate126
dude.. well.. i couldn't figure out how to do it from your code.. so I just wrote the code myself.. i understood what you meant.. just look at the attached script file... basically it builds a table of case numbers, sets a default case, removes it from the table, then each time "x" is pressed it selects a random case from the ones which are left, and then sets a new value for it... just download the script file and the eboot and test it out... pretty it up with some images and let me know how it works out for you!Geändert von califrag (04-04-2006 um 12:51 AM Uhr)
-
04-03-2006, 11:59 PM #129811th Squad Captain
- Registriert seit
- Jun 2005
- Ort
- You are here -----> 名前: アダム | 飲むコー
- Beiträge
- 2.562
- Points
- 26.490
- Level
- 97
- Downloads
- 0
- Uploads
- 0
Wow you took the liberty to go
Zitat von califrag
code a version yourself to help someone out :razz: .
You good man deserve an award and maybe 1000 Points?
If you want to claim your Award PM me saying so :icon_wink .
Dont worry, this aint no scam. c5cha7 is looking for good
people in the scene to donate my points to
.
FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
-
04-04-2006, 12:03 AM #1299
I appreciate the offer but really I did it because I think it's a neat idea and it was a good ten minute exercise for me to learn how to remove and add to a table ;D I honestly would probably not use the points even if you gave them to me, but thanks anyways! Did you test out that script? did it work for you like it needs to?
Zitat von c5cha7
-
04-04-2006, 12:03 AM #1300QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Nope, didn't work, it just says error: no script file found
-
04-04-2006, 12:07 AM #1301
well i'm at least able to get it running.. what firmware version are you on?
-
04-04-2006, 12:08 AM #130211th Squad Captain
- Registriert seit
- Jun 2005
- Ort
- You are here -----> 名前: アダム | 飲むコー
- Beiträge
- 2.562
- Points
- 26.490
- Level
- 97
- Downloads
- 0
- Uploads
- 0
lol okay then,
Zitat von califrag
also code-zero i think you may need to change your lua cmd file.
Right click on the index.cmd and edit it to this:
--
luaplayer index.lua
PAUSE.
--
Note that your file has to be called index.lua if you name it that
in the cmd :icon_wink .
Edit: Unless your on PSP lol
.
(I Always try the emulator)FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
-
04-04-2006, 12:11 AM #1303QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Edit:
-
04-04-2006, 12:15 AM #1304
it has a wierd problem when resetting the case numbers and starting a new game but the idea is there.. i'll play with it some more and update the attachment before i go to bed
EDIT: I fixed it and it now works fine and even tells you which cases are left to choose from. i updated the attachment on the previous post.Geändert von califrag (04-04-2006 um 12:52 AM Uhr)
-
04-04-2006, 12:17 AM #1305QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
error: something about vblankstart nil value
-
04-04-2006, 12:20 AM #1306QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Ok, so I managed to get 1 script working on the psp (wasn't mine) and for some reason this is the only downloaded script that has worked on my psp. It was a pickup line generator,
-
04-04-2006, 02:41 AM #1307
what version of luaplayer do you have?
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-04-2006, 02:42 AM #1308QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
0.14 for fimware 1.00 (I'm using bock eloader)
-
04-04-2006, 02:45 AM #1309
hmm k, i dont really know how eBock and stuff works. So do you need to have the 1.00 version with eBock? Because maybe thats the problem. Also Can you use higher versions of luaplayer, like 0.16? Thats the one have, and everything works and i know there's a 1.00 version of that aswell.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-04-2006, 02:47 AM #1310QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
I'll try version 0.16 and report in then, it's wierd though, that only certain scripts are playing correctly.
-
04-04-2006, 02:54 AM #1311
yeah thats what got me thinking about the version you have. Maybe the others use commands 0.14 doesnt support.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-04-2006, 03:08 AM #1312QJ Gamer Blue
- Registriert seit
- Apr 2006
- Ort
- Northampton, England
- Beiträge
- 59
- Points
- 4.272
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Nope, didn't fixit, I'll try using the tutorial to change it to a stand alone eboot
-
04-04-2006, 06:09 AM #1313is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
hmmmm, what i've done which absolutely rocks is i got the eloader on my 32mb and my 1gb card and luaplayer v0.17DK2 on my 32 mb and luaplayer v0.16 on my 1gb - its great!
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-04-2006, 07:00 AM #1314
I'm having an odd graphical problem with my Lua script.... this
is showing up like this:
ingame. Anyone know whats wrong?
-
04-04-2006, 07:04 AM #1315QJ Gamer Bronze
- Registriert seit
- Jan 2006
- Ort
- Western Australia
- Beiträge
- 1.046
- Points
- 8.803
- Level
- 63
- Downloads
- 0
- Uploads
- 0
Uhm sometimes it could just be what format the image it is in, but otherwise I have no idea.
-
04-04-2006, 07:06 AM #1316
.PNG, which has been working for me for a while.
Zitat von PopcOrn DeVil
-
04-04-2006, 07:48 AM #1317
Ok i haven't done anything to it and suddenly LUAplayer doesn't work anymore. First i got an error saying something is nil and press start to restart (the usual), but this happens on startup of LUAplayer itself. Tried to reinstall and still to game. Now it just crashes and tells me its not able to run it? This sucks bigtime since i cannot play my own game to test it.
Did anybody else have this? If so what did you do, or else any ideas on this?
Edit:
Never mind, it works again. I have no clue about what happened, i just kept on reinstalling and rebooting till it worked again, jey!Geändert von Altair (04-04-2006 um 07:58 AM 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]
-
04-04-2006, 11:06 AM #1318QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Ok, I've got some major image problems in LUA. The first problem is when I run the following script on the PSP, it runs fine, but when loading it using windowsluaplayer I get myself the following error:
Script
Error:Code:System.usbDiskModeActivate() green = Color.new(0, 255, 0) time = 0 pi = math.atan(1) * 4 background = Image.load("images/background.jpg") smiley = Image.load("images/smiley.png") while true do screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false) x = math.sin(pi * 2 / 250 * time) * 200 + 220.5 y = 172 - math.abs(math.sin(pi * 2 / 125 * time) * 150) screen:blit(x, y, smiley) time = time + 1 if time >= 500 then time = 0 end screen.waitVblankStart() screen.flip() pad = Controls.read() if pad:start() then break end end
Next, as soon as I replace the background.jpg by the same file in png, it doesn't load at all, no matter on the PSP as on Windows. Though my tutorial used a .png file that loaded just fine.error: index.lua:5: Image.load: Error loading image.
Thanks in advance
-
04-04-2006, 11:11 AM #1319Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
You sure you havent used any capital letters or anything on the ACTUAL image name?
-
04-04-2006, 11:12 AM #1320Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
Make it a png file. might fix it. I never thought lua could read jpg?


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