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!

Help with this code...

This is a discussion on Help with this code... within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Hey! when I try to load this code in luaplayer I get this error: script.lua:43: '=' expected near 'if' Could ...

Reply
 
LinkBack Thread Tools
Old 10-23-2005, 11:51 AM   #1
i <3 fluffy rainbows
 
pspmachine's Avatar
 
Join Date: Jul 2005
Location: United Kingdom
Posts: 862
Trader Feedback: 0
Default Help with this code...

Hey!

when I try to load this code in luaplayer I get this error: script.lua:43: '=' expected near 'if'
Could someone please try and find whats wrong?

Heres the code:
Quote:
pad = Controls.read()
loadcross = dofile("index.lua")
loadsquare = dofile("index2.lua")
loadtriangle = dofile("index3.lua")
loadcircle = dofile("index4.lua")
loadrtrig = dofile("index5.lua")
loadltrig = dofile("index6.lua")
blue = Color.new(0, 0, 255)
font = Image.load("bmf02_007.png ")
LetterPixelsWide = 8
LetterPixelsTall = 8
InputString = [[ !"#$%&'()* ,-./0123456789:;<=>?@ABCDEFGH IJKLMNOPQRSTUVW XYZ]]

function char2font(char_input)

IndexNumber = 0
for i = 1, string.len(InputString) do
if string.sub(InputString, i,i) == char_input then
return IndexNumber
end -- end if
IndexNumber = IndexNumber + LetterPixelsWide
end -- end if
return 0
end
function blitChar(target, char, posx, posy)
target:blit(posx,posy, font,char2font(char),0,Le tterPixelsWide,LetterPixe lsTall,true)
end
function blitString(myTarget, possx, possy, thestring)
incX = 0
for w = 1, string.len(thestring) do
blitChar(myTarget, string.upper(string.sub(t hestring, w,w)), possx + incX, possy)
incX = incX + LetterPixelsWide
end -- end for
end

blitString(screen, 200, 110, "Hey its PSPMachine and this is my LuaLoader")
blitString(screen, 200, 120, "Press keys to load apps!")

if pad:cross() then
loadcross

if pad:triangle() then
loadtriangle

if pad:circle()then
loadcircle

if pad:square()
loadsquare

if pad:select() then screen:save("screenshot.t ga")

end
The forum sometimes messes up the code so attached is the real script.lua

Thanks in advance

--pspmachine

Last edited by pspmachine; 10-23-2005 at 11:53 AM..
pspmachine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-23-2005, 12:09 PM   #2

OMFG
 
Slasher's Avatar
 
Join Date: Jul 2005
Location: Toronto
Posts: 2,816
Trader Feedback: 0
Default

then ~ end

plus I don't think this script will run with just the error fixes...there's no loop or anything. You should make the loadtriangle, etc a function instead of however you are doing it.

Last edited by Slasher; 10-23-2005 at 12:47 PM..
Slasher is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-25-2005, 05:28 PM   #3
 
sumpaintballer41's Avatar
 
Join Date: Jul 2005
Location: Ware, MA
Posts: 868
Trader Feedback: 0
Default

Well its expecting an '=' near the IF statement...I dont know what your trying to accomplish here..haha I dont know much about coding, maybe this is too advanced for me or sumthing

I see it now..Well you have a return function but no integer set...
__________________
Cover your eyes and run...
gmansixfo= STEPMANIA LEGEND!!
Halo2 Gamertag~PSPH4X0R

7/17/06
~The Day My PSP Almost Died~
Thank you
GrandTheftAutoJunkie
sumpaintballer41 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-25-2005, 10:25 PM   #4

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

u might also either add an 'end' at the end of the ifs at the end or just rename all but the first 1 'elseif'
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-26-2005, 10:48 AM   #5
 
paulieweb's Avatar
 
Join Date: Oct 2005
Location: State College, PA
Posts: 66
Trader Feedback: 0
Default

yea i think you need to end every if
paulieweb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-26-2005, 11:41 AM   #6

Muppet Magnet
 
Fanjita's Avatar
 
Join Date: Sep 2005
Location: Edinburgh, UK
Posts: 2,388
Trader Feedback: 0
Default

Put an end after each of the ifs from line 41 onwards, e.g.

Code:
if pad:cross() then
loadcross
end
Also as pointed out you'll need to do something different with those dofile calls. Try assigning the filenames to variables, then using those, e.g.

Code:
loadcross = "crossfilename"
loadtriangle = "trianglefilename"

...

if pad:cross() then
filetoload = loadcross
end

...

dofile(filetoload)
Fanjita is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-27-2005, 01:39 PM   #7
 
sumpaintballer41's Avatar
 
Join Date: Jul 2005
Location: Ware, MA
Posts: 868
Trader Feedback: 0
Default

Hmm, ive never had to end after every IF statement...I dont code that much but thats new to me. THis helps me too i guess
__________________
Cover your eyes and run...
gmansixfo= STEPMANIA LEGEND!!
Halo2 Gamertag~PSPH4X0R

7/17/06
~The Day My PSP Almost Died~
Thank you
GrandTheftAutoJunkie
sumpaintballer41 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
code

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:02 AM.



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