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; ill try this soon! Zitat von Faint Can lua load .mp3 files? No. Sorry but you should be able to ...
-
10-06-2005, 04:09 PM #121
ill try this soon!
No. Sorry but you should be able to load .wav
Zitat von Faint
Geändert von cools (10-06-2005 um 04:11 PM Uhr)
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
10-06-2005, 04:36 PM #122NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
There's no space between the comma after 50 and string.format.
Zitat von Twenty 2
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-06-2005, 04:45 PM #123Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I tested the program with the exact code i posted so i dont think it matters.
F.A.L.O?
-
10-06-2005, 04:49 PM #124NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Just upgraded it, so instead use this keyboard.lua file :)
Zitat von MagicianFB
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-06-2005, 07:12 PM #125
Hey, MagicianFB. You probably didn't see it, but back on page 11 I was asking if you could tell a little about your rpg project to kinda' help me and anybody else who wants to do an rpg type project. I also asked a few other questions, but it ended up being kind of a long post so I won't repeat it here. The main thing I guess I want to be able to do is scrolling backgrounds (static bg's would be fine if I wanted to try a king's quest type game, or Myst orqsomething, I guesss). The only mention I've found of a scrolling background was in the forums at www.luaplayer.org but it was a really quick no details thing.
-
10-07-2005, 11:24 AM #126QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
More RPGs, I cant wait to see what others did. I got a scrolling background working, exacly like in zelda1 on NES.
I'de like to see how you guys got it working tho. Got random fights FF style, working on menus and sub menus wich I'm having problems with :icon_sad: .
-
10-07-2005, 11:27 AM #127Rock Star

- Registriert seit
- Aug 2005
- Ort
- CT| FW: 4.01 M33-2
- Beiträge
- 11.844
- Points
- 70.899
- Level
- 100
- Downloads
- 0
- Uploads
- 0
i wanna test the keyboard, and try and incoporate it into my lua program, but first i have to exchange my bricked psp :icon_sad: :Cry: :Cry: :icon_sad:
Zitat von MagicianFB

-
10-07-2005, 11:48 AM #128
Perhaps there could be some cooperation on the rpg thing? Not neccesarilly on the games themselves, but on how to code them. Perhaps some sort of template code for certain sections that can be edited for use in ones program. ie: the code for a basic battle setup that can be copied and pasted in place with some modifications for the specific game. I'm still doing research on programming in lua, but I had thought of making templates I could use (like one for each area in a game--paste in the template, assign a background png, make the map and assign other variables, but everything that is the same from area to area need not be redone) and posting them for others to use. If we all did that, we could get on with making the games more quickly.
At any rate, I would be interested to hear about your scrolling background. You said Zelda style? Could it be used with a .png for final fantasy style?
Also, what kind of trouble are you having with the menu? I'm not a coder just yet, but maybe someone else would have some insight and it could help others who might run into the same problem.
-
10-07-2005, 01:23 PM #129QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
Snaku, I am using png format files. Kinda wierd, but I'm not using small blocks to draw the field. Instead, I'm using 480x272 pictures, I stack em in an table to create my field (piece positions) so I can have multiple worlds easily. All I have to do is change the table. Example:
This is still only a 16 piece field as you can see, but it can be whatever you desire it too be. How it works now, is instead of bliting the whole field at once, witch I found was kinda laggy and jerky, I only blit 2 images at once. The "CurentPiece" and the "Next Piece". Like zelda, if the Hero's position get near either end of the screen, then the next piece is generated. Depending on the position of the Hero once again, the next block's X, Y coords will be set, then the piece will be calculated from the table. Really simple accually. :razz: Here's what a next piece funciton looks like:Code:Field={BD,AB,AB,BB, AD,AD,BA,BC, AD,AD,BD,BB, BA,AA,AA,BC}
I know its kinda ugly with all the "elseif Piece==16" but its only because I'm testing soem stuff. I need to make limits for each piece type. Then all that's left is to add anims here and there, water, birds, trees, etc. Then one can make diferent piece pictures for different world, and stack em in a different order so on.Code:function NextPieceDown() if Piece==1 then NextPiece=(Field[5]) CurrentPiece=5 elseif Piece==2 then NextPiece=(Field[6]) CurrentPiece=6 elseif Piece==3 then NextPiece=(Field[7]) CurrentPiece=7 elseif Piece==4 then NextPiece=(Field[8]) CurrentPiece=8 elseif Piece==5 then NextPiece=(Field[9]) CurrentPiece=9 elseif Piece==6 then NextPiece=(Field[10]) CurrentPiece=10 elseif Piece==7 then NextPiece=(Field[11]) CurrentPiece=11 elseif Piece==8 then NextPiece=(Field[12]) CurrentPiece=12 elseif Piece==9 then NextPiece=(Field[13]) CurrentPiece=13 elseif Piece==10 then NextPiece=(Field[14]) CurrentPiece=14 elseif Piece==11 then NextPiece=(Field[15]) CurrentPiece=15 elseif Piece==12 then NextPiece=(Field[16]) CurrentPiece=16 elseif Piece==13 then NextPiece=(Field[1]) CurrentPiece=1 elseif Piece==14 then NextPiece=(Field[2]) CurrentPiece=2 elseif Piece==15 then NextPiece=(Field[3]) CurrentPiece=3 elseif Piece==16 then NextPiece=(Field[4]) CurrentPiece=4 end PieceY=0 repeat screen:blit(PieceX,PieceY,Field[Piece]) NextPieceX=0 NextPieceY=PieceY+272 screen:blit(NextPieceX,NextPieceY,NextPiece) screen:blit(HeroX,HeroY,Heroimg) PieceX=0 PieceY=PieceY-4 HeroY=HeroY-3.5 screen.waitVblankStart() screen.flip() until NextPieceY==0 Piece=CurrentPiece end
About my menus, I think I got it fixed for now. I was having trouble calling the submenus inside the main menu since I was creating a loop inside another loop. Found a wa around it.
Hope this inspires some of you. :icon_smil
-
10-07-2005, 02:26 PM #130
Is there a Way to Clear only a part of the screen?
Could you do something like this:
Code:screen:clear(100, 100)
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
10-07-2005, 03:26 PM #131
- Registriert seit
- Jun 2005
- Beiträge
- 32
- Points
- 4.700
- Level
- 43
- Downloads
- 0
- Uploads
- 0
System.usbDiskModeActivat e()
yellow = Color.new(255, 255, 0)
blue = Color.new(0, 0, 255)
orange = Color.new(223, 88, 6)
grey = Color.new(94, 97, 111)
black = Color.new(0, 0, 0)
red = Color.new(255, 0, 0)
white = Color.new (255, 255, 255)
brun = Image.load ("Images/brun.png")
crun = Image.load ("Images/crun.png")
drun = Image.load ("Images/drun.png")
erun = Image.load ("Images/erun.png")
frun = Image.load ("Images/frun.png")
grun = Image.load ("Images/grun.png")
hrun = Image.load ("Images/hrun.png")
ajump = Image.load ("Images/ajump.png")
istand = Image.load ("Images/istand.png")
Image:clear (white)
screen:blit (100, 150, istand)
screen.flip()
Image:clear (white)
screen.waitVblankStart(60 )
pad = Controls.read()
if pad:right() then
screen:blit (140, 150, drun)
screen.flip()
Image:clear (white)
screen.waitVblankStart(10 )
screen:blit (180, 150, brun)
screen.flip()
Image:clear (white)
screen.waitVblankStart(10 )
screen:blit (220, 150, crun)
screen.flip()
Image:clear (white)
screen.waitVblankStart(10 )
screen:blit (260, 150, drun)
screen.flip()
Image:clear (white)
screen.waitVblankStart(10 )
screen:blit (290, 150, erun)
screen.flip()
Image:clear (white)
screen.waitVblankStart(10 )
screen:blit (340, 150, frun)
screen.flip()
Image:clear (white)
screen.waitVblankStart(10 )
screen:blit (380, 150, grun)
screen.flip()
Image:clear (white)
screen.waitVblankStart(10 )
screen:blit (420, 150, hrun)
screen.flip()
Image:clear (white)
end
if pad:cross() then
screen:blit (100, 150, istand)
screen.flip()
screen.waitVblankStart(10 )
Image:clear (white)
screen:blit (130, 150, ajump)
screen.flip()
screen.waitVblankStart(20 )
Image:clear (white)
screen:blit (140, 150, istand)
screen.flip()
screen.waitVblankStart()
end
This is kind of ugly code but I am trying to learn
anyway, it always will come up then it will stay on for about 2 seconds the it will say press start to restart, so if someone could help me I would appreciate it :)
-
10-07-2005, 03:31 PM #132NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Does any one know what "loop in gettable" means, because it keeps on shoeing it as an error.
Edit: I added a loop around the controls part...
Code:System.usbDiskModeActivate() yellow = Color.new(255, 255, 0) blue = Color.new(0, 0, 255) orange = Color.new(223, 88, 6) grey = Color.new(94, 97, 111) black = Color.new(0, 0, 0) red = Color.new(255, 0, 0) white = Color.new (255, 255, 255) brun = Image.load ("Images/brun.png") crun = Image.load ("Images/crun.png") drun = Image.load ("Images/drun.png") erun = Image.load ("Images/erun.png") frun = Image.load ("Images/frun.png") grun = Image.load ("Images/grun.png") hrun = Image.load ("Images/hrun.png") ajump = Image.load ("Images/ajump.png") istand = Image.load ("Images/istand.png") Image:clear (white) screen:blit (100, 150, istand) screen.flip() Image:clear (white) screen.waitVblankStart(60 ) end pad = Controls.read() if pad:right() then screen:blit (140, 150, drun) screen.flip() Image:clear (white) screen.waitVblankStart(10 ) screen:blit (180, 150, brun) screen.flip() Image:clear (white) screen.waitVblankStart(10 ) screen:blit (220, 150, crun) screen.flip() Image:clear (white) screen.waitVblankStart(10 ) screen:blit (260, 150, drun) screen.flip() Image:clear (white) screen.waitVblankStart(10 ) screen:blit (290, 150, erun) screen.flip() Image:clear (white) screen.waitVblankStart(10 ) screen:blit (340, 150, frun) screen.flip() Image:clear (white) screen.waitVblankStart(10 ) screen:blit (380, 150, grun) screen.flip() Image:clear (white) screen.waitVblankStart(10 ) screen:blit (420, 150, hrun) screen.flip() Image:clear (white) end if pad:cross() then screen:blit (100, 150, istand) screen.flip() screen.waitVblankStart(10 ) Image:clear (white) screen:blit (130, 150, ajump) screen.flip() screen.waitVblankStart(20 ) Image:clear (white) screen:blit (140, 150, istand) screen.flip() screen.waitVblankStart() end endGeändert von MagicianFB (10-07-2005 um 03:38 PM Uhr)
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-07-2005, 03:50 PM #133
- Registriert seit
- Jun 2005
- Beiträge
- 32
- Points
- 4.700
- Level
- 43
- Downloads
- 0
- Uploads
- 0
k, thanks but it says '=' expected near 'e'
-
10-07-2005, 04:13 PM #134NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
That's because, due to a forum glitch, spaces are put in paces they shouldn't be.
Zitat von Dack Chaar
So just look through the code and find spaces that look like the shouldn't be there. For example, the System.usbDiskModeActivat e() has a space in it that shouldn't be there, so just delete it."15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-07-2005, 04:27 PM #135Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Im not to sure but i dont think you have a while loop and you have a "end"
Zitat von MagicianFB
before your pad = Controls.read() that shouldn't be there. Im not the best coder though to im not quite sure.
F.A.L.O?
-
10-07-2005, 05:13 PM #136
- Registriert seit
- Jun 2005
- Beiträge
- 32
- Points
- 4.700
- Level
- 43
- Downloads
- 0
- Uploads
- 0
K, thanks for your help guys, and sorry to be such a noob, but it says <eof> expected near end.
-
10-07-2005, 05:22 PM #137QJ Gamer Blue
- Registriert seit
- Aug 2005
- Ort
- USA
- Beiträge
- 214
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
im trying to make a slow moving cursor, but it moves too much by just tapping the dpad. any one know how to fix this
Code:black = Color.new(0, 0, 0) x = 139 y = 86 cursor = Image.load("cursor.png") background = Image.load("background.png") while true do screen:blit(0, 0, background, false) screen:blit(x, y, cursor) screen.flip() pad = Controls.read() if pad:up() then y = y - 1 screen.flip() end if pad:down() then y = y + 1 screen.flip() end if pad:left() then x = x - 1 screen.flip() end if pad:right() then x = x + 1 screen.flip() end end
-
10-07-2005, 05:23 PM #138QJ Gamer Blue
- Registriert seit
- Sep 2005
- Ort
- In your garage
- Beiträge
- 73
- Points
- 4.648
- Level
- 43
- Downloads
- 0
- Uploads
- 0
Zitat von sofa king dumb
Change the values in your x and y's. Each time a buttons pressed the X and Y are told to move in some way. The value determins how far the cursor moves each time. Thus if it's a high value then the cursor moves faster.. lower value.. moves slower.
:)Geändert von Bilo (10-07-2005 um 05:29 PM Uhr)
-
10-07-2005, 05:31 PM #139QJ Gamer Blue
- Registriert seit
- Aug 2005
- Ort
- USA
- Beiträge
- 214
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
if pad:right() then
x = x + 0.25
screen.flip()
end
would this work then? thanks in advance
-
10-07-2005, 05:32 PM #140NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
What do all the second pair of numbers when yo blit an objects mean?
example:
Code:-------------these two: v v ---------------------- screen:blit(0, 0, image, 0, 0, width, height, false)
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-07-2005, 05:33 PM #141QJ Gamer Blue
- Registriert seit
- Sep 2005
- Ort
- In your garage
- Beiträge
- 73
- Points
- 4.648
- Level
- 43
- Downloads
- 0
- Uploads
- 0
I think so.
I'm not sure how lua handles values.. Not too sure if it would see the value 0.00
but in theory, yes.
Try it and see.
-
10-07-2005, 05:34 PM #142QJ Gamer Blue
- Registriert seit
- Sep 2005
- Ort
- In your garage
- Beiträge
- 73
- Points
- 4.648
- Level
- 43
- Downloads
- 0
- Uploads
- 0
Zitat von MagicianFB
Isn't it the rotation point?
-
10-07-2005, 06:29 PM #143QJ Gamer Blue
- Registriert seit
- Aug 2005
- Ort
- USA
- Beiträge
- 214
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
what am i doing wrong, im trying to make a paint in lua using the dpad, but it ends up like an ect-a-sketch and by that i mean the line that is being drawn cannot be turn on/off using x like its supposed to. (attached is the cursor pic its just a red dot, and that im using and that's the script) thanks in advance
Code:black = Color.new(0, 0, 0) white = Color.new(255, 255, 255) x = 139 y = 86 cursor = Image.load("cursor.png") canvas = Image.createEmpty(480, 272) canvas:clear(white) while true do screen:blit(x, y, cursor) screen.flip() pad = Controls.read() if pad:up() then y = y - 1 screen.flip() end if pad:down() then y = y + 1 screen.flip() end if pad:left() then x = x - 1 screen.flip() end if pad:right() then x = x + 1 screen.flip() end if pad:cross() then canvas:drawLine(x, y, 1, 1, black) screen.flip() end end
-
10-07-2005, 07:39 PM #144
XteticX, that sounds interesting. I had thought to have one image maybe 2 to 3 times the size of the screen that could be scrolled around, but the tiles are probably better. Any reason they have to be the size of the screen, or could you have smaller tiles? Then if you had a small animation going on somewhere, a much smaller section of the screen would be getting refreshed over and over. Also, would it mess things up to have different size tiles? Meaning the whole map could be made of 420x278 tiles (or whatever size) and then one tile could actually be made of 4 smaller tiles... just as an example. Also, just a side thought, smaller tiles would mean less offscreen stuff is being loaded and causing lag.
I have to go to work now, but tomorrow I will begin studying the coding thing in ernest. Thanks for posting some of your stuff. I'm sure it'll help.
-
10-07-2005, 07:46 PM #145NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Hey guys! Here's a quick demo of how to load RPG Maker XP charsets in lua. Just use the replace charset.png, with the one you want.
Code:function loadcharset(charset) down = {} left = {} right = {} up = {} for i=1,4 do down[i] = Image.createEmpty(charset:width()/4, charset:height()/4) end for i=1,4 do left[i] = Image.createEmpty(charset:width()/4, charset:height()/4) end for i=1,4 do right[i] = Image.createEmpty(charset:width()/4, charset:height()/4) end for i=1,4 do up[i] = Image.createEmpty(charset:width()/4, charset:height()/4) end for i=0,3 do down[i+1]:blit(0, 0, charset, (i*charset:width()/4), 0, charset:width()/4, charset:height()/4) end for i=0,3 do left[i+1]:blit(0, 0, charset, (i*charset:width()/4), charset:height()/4, charset:width()/4, charset:height()/4) end for i=0,3 do right[i+1]:blit(0, 0, charset, (i*charset:width()/4), 2*charset:height()/4, charset:width()/4, charset:height()/4) end for i=0,3 do up[i+1]:blit(0, 0, charset, (i*charset:width()/4), 3*charset:height()/4, charset:width()/4, charset:height()/4) end end charset = Image.load("charset.png") loadcharset(charset) screen:blit(0, 0, down[1]) screen:flip() pos = 0 while true do screen.waitVblankStart(8) pad = Controls.read() if pad:up() then if pos==4 then pos = 1 else pos = pos+1 end screen:clear() screen:blit(100, 100, up[pos]) screen:flip() elseif pad:down() then if pos==4 then pos = 1 else pos = pos+1 end screen:clear() screen:blit(100, 100, down[pos]) screen:flip() elseif pad:left() then if pos==4 then pos = 1 else pos = pos+1 end screen:clear() screen:blit(100, 100, left[pos]) screen:flip() elseif pad:right() then if pos==4 then pos = 1 else pos = pos+1 end screen:clear() screen:blit(100, 100, right[pos]) screen:flip() elseif pad:r() then break end end"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-08-2005, 07:43 AM #146
Ok, stupid question: what are rpg maker char sets? I've never used an rpg maker, being unsatisfied with the level of graphics and all. I haven't been following them since rpg maker 2 came out for ps2. Is the XP one pretty good?
XteticX, I read through your post again (with slightly less tired eyes so it made more sense this time). Seems to be an effective method. So is the position of the Hero always in the center and the background scrolls, or does he move around the screen and the background starts scrolling when he nears the edge of the screen? The latter is the result I'd like to go for. I'm wanting to do environments very similarly to ff vii-ix. Either hand drawn, or snatched from another source, like an anime or something. As I've said, I don't expect to be able to make a final fantasy quality game, but I do want to go for that kind of feel. I've always hated the more traditional rpgs, with repeated tiles for a patch of grass or identical looking trees and huts.
Also I noticed "Hero" was capitalized in your post. Is that his name, and if so, is that a clue as to what your project is?Geändert von Snaku (10-08-2005 um 08:28 AM Uhr)
-
10-08-2005, 12:00 PM #147QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
Zitat von Snaku
A clue. lol. No, Its just the name of the variable. And yes, caracter moves around freely, once he reaches the edge of the screen, then the anim moves the next piece. I'm just saying, PROBABLY, you could do it like FF as you say if you had maybe 5 pieces of the background at once. Having the next piece for all four direction ready, but flikering issues could arise. Anyway I'm just saying it IS possible, just it ain't gonna be easy.
I could prob do it but my free time is limited right now. :icon_sad:
This would indeed make our lifes easier, but I think the current luaplayer still cant blit big enought images. Something like 512pix max I'm not sure. Anyway I hope you get your game into gear soon. I wanna see some RPGs come out before ours. Good luck.I had thought to have one image maybe 2 to 3 times the size of the screen that could be scrolled around
-
10-08-2005, 02:22 PM #148Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
What is wrong with this code? It says i have a error on line 19 with "then".
Code:m = 1 ran = math.random(100) blue = Color.new(0, 0, 225) while true do pad = Controls.read() if pad:up() then screen:clear() screen:print(132, 230, string.format("d", m + 1), blue) screen:flip() end if pad:down() then screen:clear() screen:print(132, 230, string.format("d", m - 1), blue) screen:flip() end if pad:cross() and m = ran then screen:clear() screen:print(132, 230, string.format("d", m), blue) screen:print(122, 230, "You guessed correctly!", blue) screen:flip() end if pad:start() then break end end
F.A.L.O?
-
10-08-2005, 02:27 PM #149NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
ypu have to use == when asking if something is true.
Zitat von Twenty 2
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-08-2005, 02:59 PM #150Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Ok i fixed the == part and I forgot to put a % in front of d. No when I test the program and when i press up it goes straight to 2 and wont go higher. When i press down it goes straight to zero.
Code:m = 1 ran = math.random(100) blue = Color.new(0, 0, 225) while true do pad = Controls.read() if pad:up() then screen:clear() screen:print(230, 136, string.format("%d", m + 1), blue) screen:flip() end if pad:down() then screen:clear() screen:print(230, 136, string.format("%d", m - 1), blue) screen:flip() end if pad:cross() and m == ran then screen:clear() screen:print(230, 136, string.format("%d", m), blue) screen:print(230, 136, "You guessed correctly!", blue) screen:flip() end if pad:start() then break end end
F.A.L.O?


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