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 the undead Wrong, their was a post a while back but i dont know were it is now....and ...
-
11-07-2006, 03:40 PM #3961QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
No, there isn't, or Lua Player couldn't read them.
Zitat von the undead
[I fail @ life]
-
11-07-2006, 04:13 PM #3962QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- Missouri
- Beiträge
- 451
- Points
- 6.041
- Level
- 50
- Downloads
- 0
- Uploads
- 0
I still need to know how to load and use a font on the text you print to the screen.
-
11-07-2006, 04:58 PM #3963QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Yes there is. You just compile the Lua scripts using Luac.exe in the Lua Binary repository. I tried this a while back.
Zitat von FreePlay
-
11-07-2006, 05:21 PM #3964QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- Missouri
- Beiträge
- 451
- Points
- 6.041
- Level
- 50
- Downloads
- 0
- Uploads
- 0
nvm. figured it out... now how do you reset your game. not going to lowser, but just reloading your game...like the reset button on an n64.
-
11-07-2006, 05:39 PM #3965QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Umm, only way I can think is somethin like this: Have index.lua be nothing but: dofile("game.lua")
And then in game.lua make something do break and thatll restart. Then how do you exit all the way out though.....
-
11-07-2006, 05:44 PM #3966lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
I need the code for exiting to the XMB from a pause menu
-
11-07-2006, 05:49 PM #3967QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
os.exit() doesnt work so i dont think theres a way.
-
11-07-2006, 05:53 PM #3968QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- Missouri
- Beiträge
- 451
- Points
- 6.041
- Level
- 50
- Downloads
- 0
- Uploads
- 0
i think its loading usb and turning it off and on so fast that it will never say off or shutoff. how do i fix it?Code:white = Color.new(255,255,255) menuBackground = Image.load("menuBackground.png") usb = 0 while true do screen:clear() screen:blit(0,0,menuBackground) pad = Controls.read() if usb == 0 then screen:print(0,0,"Off",white) end if pad:r() and usb == 1 then System.usbDiskModeDeactivate() usb = 0 end if pad:r() and usb == 0 then System.usbDiskModeActivate() usb = 1 end if usb == 1 then screen:print(0,0,"On",white) end screen.waitVblankStart() screen.flip() endGeändert von Cheez Pirate (11-07-2006 um 05:53 PM Uhr) Grund: Automerged Doublepost
-
11-07-2006, 05:55 PM #3969lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
So theres no way of exiting to XMB? O well....
-
11-07-2006, 05:56 PM #3970QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
... and then can you still run them in the PSP Lua Player?
Zitat von head_54us
Besides... you can always decompile them.[I fail @ life]
-
11-07-2006, 05:57 PM #3971QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Zitat von -TacticalPaper-
This is from the psplua game pack and it works perfectly. It does exit to the XMB.Code:if pad:start() then os.exit() end
-
11-07-2006, 06:03 PM #3972lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Yes, It still runs in LUA Player, It just make sure no one steals your code.
-
11-07-2006, 06:21 PM #3973I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
*Slaps forehead in disbelief of some people's inability to take a hint*
Zitat von pspgamer81

-
11-07-2006, 06:22 PM #3974lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Sorry, Jeez
-
11-07-2006, 06:34 PM #3975QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Code:white = Color.new(255,255,255) menuBackground = Image.load("menuBackground.png") usb = 0 while true do screen:clear() screen:blit(0,0,menuBackground) pad = Controls.read() if usb == 0 then screen:print(0,0,"Off",white) end if pad:r() and usb == 1 then System.usbDiskModeDeactivate() usb = 0 screen.waitVblankStart(4) end if pad:r() and usb == 0 then System.usbDiskModeActivate() usb = 1 screen.waitVblankStart(4) end if usb == 1 then screen:print(0,0,"On",white) end screen.waitVblankStart() screen.flip() end
-
11-07-2006, 06:48 PM #3976QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- Missouri
- Beiträge
- 451
- Points
- 6.041
- Level
- 50
- Downloads
- 0
- Uploads
- 0
it doesn't change anything.
-= Double Post =-
it still does the quick of on and never shows "off"Geändert von Cheez Pirate (11-07-2006 um 06:48 PM Uhr) Grund: Automerged Doublepost
-
11-07-2006, 07:01 PM #3977
How do i use luac.exe to encrypt the lua files.
Geändert von Dr.Gringo (11-07-2006 um 07:21 PM Uhr)
-
11-07-2006, 07:01 PM #3978QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Try that, it makes different buttons to switch it.Code:white = Color.new(255,255,255) menuBackground = Image.load("menuBackground.png") usb = 0 while true do screen:clear() screen:blit(0,0,menuBackground) pad = Controls.read() if usb == 0 then screen:print(0,0,"Off",white) end if pad:r() and usb == 1 then System.usbDiskModeDeactivate() usb = 0 screen.waitVblankStart(4) end if pad:l() and usb == 0 then System.usbDiskModeActivate() usb = 1 screen.waitVblankStart(4) end if usb == 1 then screen:print(0,0,"On",white) end screen.waitVblankStart() screen.flip() end
-
11-07-2006, 07:15 PM #3979QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
So, i was working on one of my projects and i had a question. If i move an image (cursor) and if i land on a specific part on a screen and press X, how do i make a new image splash on the whole screen?
-
11-07-2006, 07:16 PM #3980I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
What do you mean, "splash"?

-
11-07-2006, 07:20 PM #3981QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Like make something happen; make a whole new image appear on the whole screen or something happen. I obviously know how to move a cursor, but i don't know how to make something happen if X is pressed in a specific part of a screen (given by X and Y). Like in your periodic table (which is encoded so its hard to learn new things), if you press X on an element it shows the details. I am not using your periodic table in order to make my own (since your is encoded). Yes, i am working on a periodic table, but a totally different code, gfx, more scientific facts about each element.
-
11-07-2006, 07:24 PM #3982I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
I can show you the code for my periodic table. I don't even know why I encrypted that part. I just encrypted the other part because it took me like three hours to plot all the data, and I didn't want anyone to steal it.
Anyway, I think I know what you want to do. Like say you've selected Oxygen, and you press X, you want a list of properties for Oxygen to come up, correct?
-
11-07-2006, 07:26 PM #3983QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
yes, exactly. But i am not copying your code, i just need some basic ideas about how to make this happen (pressing X on something). Thank you for you help.
edit:
by the way, just curious but have you heard of my game pack? you are welcome to get any ideas from there...
-
11-07-2006, 07:32 PM #3984I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
It's quite simple really. First you need a table with your elements.
Zitat von superbatxs
So you have all 118 elements on the table. Now you need a variable for your cursor.Code:element = {} element[1] = {name = "Hydrogen", number = 1} element[2] = {name = "Helium", number = 2}
Now you can do something like this:Code:current_element = 1
I hope you understand. This is what I did in my code, but since there were blank spots, I had to make table entries like:Code:screen:print(0,0,element[current_element].name,white) screen:print(0,10,element[current_element].number,white)
I can show you my code if you want to. Just ask.Code:element[7] = {name = " ", number = " "}
-
11-07-2006, 09:01 PM #3985lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
How do i use luaC to encrypt my script?
-
11-07-2006, 09:14 PM #3986QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
if pad:cross() and cursor.x > lowestxpointofclickableit em and cursor.x < highestxpointofclickablei tem and cursor.y > lowestypointofclickableit em and cursor.y < highestypointofclickableo bject then
whatshorldhappenthenthing isclicked
end
-
11-07-2006, 11:02 PM #3987
Yeah!! I wanna know too.....
Zitat von pspgamer81
-
11-08-2006, 12:50 AM #3988.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
No their isn't!
Zitat von the undead

But there is a way to encrypt your lua code.....And yes, it does work
-
11-08-2006, 05:52 AM #3989QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
http://forums.evilmana.com/index.php?topic=273.0
Thats a thread on compiling lua files. My last post is how you could make the mouse do something when x is pressed and its at a certain point.
-
11-08-2006, 07:12 AM #3990QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Yes you can run them in LuaPlayer and although you can decompile them, it won't be in a readable format as it is compiled into byte code.
Zitat von FreePlay


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