QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

LUA Help

This is a discussion on LUA Help within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; ok, i am trying to get the battery percentage into a variable, so i have this: batlev = System.powerGetBatteryLif ePercent() ...

Reply
 
LinkBack Thread Tools
Old 09-28-2005, 03:03 PM   #1

Developer
 
Koba's Avatar
 
Join Date: Jul 2005
Location: Canada
Posts: 362
Trader Feedback: 0
Default LUA Help

ok, i am trying to get the battery percentage into a variable, so i have this:
batlev = System.powerGetBatteryLif ePercent()
but when i try to run my program it says its not a proper command... anybody have a better way of getting the battery percentage (i just want a plain number in the variable)
__________________
Windows: A thirty-two bit extension and GUI shell to a sixteen bit patch to an eight bit operating system originally coded for a four bit microprocessor and sold by a two-bit company that can't stand one bit of competition...

Personal Development Blog:
http://keepitreal-dev.blogspot.com/
Koba is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Best prices available for:
Price Range:
$13.00 - $25.00
at 10 Stores

Price Range:
$17.00 - $48.00
at 10 Stores

Old 09-28-2005, 03:12 PM   #2
 
Jenay's Avatar
 
Join Date: Jun 2005
Posts: 52
Trader Feedback: 0
Default

System.powerGetBatteryLif ePercent() is a number you need to convert it to a string to print it, something like

screen:print(425, 254, string.format("%d", battlvl), white)

Last edited by Jenay; 09-28-2005 at 03:15 PM..
Jenay is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 03:16 PM   #3

Developer
 
Koba's Avatar
 
Join Date: Jul 2005
Location: Canada
Posts: 362
Trader Feedback: 0
Default

okay, but i can't even get THAT far, it stops me right when it sees System.powerGetBatteryLif ePower() it says its a nil value... so maybe i am not using the right command or somthing, kuz lua just isn't wanting to execute that command... and yes i have the latest version of lua.

EDIT: here is the error i get:
error: index.lua:46: attempt to call field 'powerGetBatteryLifePerce nt' (a nil value)

Last edited by Koba; 09-28-2005 at 03:20 PM..
Koba is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 03:25 PM   #4
 
Jenay's Avatar
 
Join Date: Jun 2005
Posts: 52
Trader Feedback: 0
Default

what's the error message exactly, and what's on the line number above it, it, and below it
Jenay is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 03:29 PM   #5

Developer
 
Koba's Avatar
 
Join Date: Jul 2005
Location: Canada
Posts: 362
Trader Feedback: 0
Default

read up ^ i gave the exact error, and here is whats above it:
-- battery power
and heres what is below it:
screenrint(11, 2, string.format("%d", blvl), white)
Koba is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 03:58 PM   #6
 
Jenay's Avatar
 
Join Date: Jun 2005
Posts: 52
Trader Feedback: 0
Default

Okay, I'm looking through all the luaplayer examples I know of to try to find how they implement it.

I'm not finding anything though
Jenay is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 04:50 PM   #7

Developer
 
Koba's Avatar
 
Join Date: Jul 2005
Location: Canada
Posts: 362
Trader Feedback: 0
Default

i wonder if lua has a official forum... i am sure someone there is a lua pro.
Koba is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 05:36 PM   #8
 
Jenay's Avatar
 
Join Date: Jun 2005
Posts: 52
Trader Feedback: 0
Default

http://forums.ps2dev.org/viewtopic.p...d70922aed4fe88

You found my topic in that form.
Jenay is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 05:42 PM   #9

Developer
 
Koba's Avatar
 
Join Date: Jul 2005
Location: Canada
Posts: 362
Trader Feedback: 0
Default

lol thats you??? ok well i fixed it, now when i try to go screenrint(11, 2, string.format("%d", batlev), white) it says bad arguement 'format' (number expected, got nil)
Koba is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 05:49 PM   #10
 
Jenay's Avatar
 
Join Date: Jun 2005
Posts: 52
Trader Feedback: 0
Default

did you spell batlev the same each time?
Jenay is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 09-28-2005, 07:47 PM   #11

Developer
 
Koba's Avatar
 
Join Date: Jul 2005
Location: Canada
Posts: 362
Trader Feedback: 0
Default

heh, never mind, i fixed it, i just had to declare the variable as an integer before i told it what to contain, string.format so i'm ok now. i just need to know how to make a png keep its transparency, like, gradient transparencies, i dunno how to tell LUA to keep the transparency on a PNG image.
Koba is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-20-2005, 03:37 PM   #12
 
Join Date: Aug 2005
Location: NC, USA & India
Posts: 11
Trader Feedback: 0
Default

Quote:
Originally Posted by Koba
heh, never mind, i fixed it, i just had to declare the variable as an integer before i told it what to contain, string.format so i'm ok now. i just need to know how to make a png keep its transparency, like, gradient transparencies, i dunno how to tell LUA to keep the transparency on a PNG image.
I have the same question...
des4ij is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
lua

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 10:30 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2010, QJ.NET. All Rights Reserved.
Contact Us | Free Flash Games