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 natan333 i think you have to do something like this Code: if letterPosy < 2 then letterPosy = ...
-
05-02-2006, 05:14 PM #1981Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von natan333
thats not what i meant. :)
i meant like: a have a square (which is the player) and a couple of red things coming at you ( enemies) i want it so that if ONE or more of the squares(there are ten at the moment) hit you, then gameover = true. but the enemies pass right through the player without doing anything.
--------------------------------------------------------------------------------------
-
05-02-2006, 05:54 PM #1982
Hi i have a little prob
its just won't go back to Test.lua when i press X what is that can som1 help.Code:--Colours white = Color.new(255,255,255) red = Color.new(255,0,0) pad = Controls.read() --Text screen:print(5,50,"Producer",white) screen:print(5,65,"Zereo_X",red) screen:print(5,75,"Special Thanks to",white) screen:print(5,90,"xodiac21,Grimfate126,Sousanator,EminentJonFrost",red) screen:print(0,250,"Press X to exit",red) screen.flip() while true do screen.waitVblankStart() end if pad:cross() dofile("Test.lua") end
-
05-02-2006, 06:20 PM #1983
guys wasnt this code supposed to go to picture 2 if arrow is inside erease picture ?Code:if pad:r() and pad:square() then if eraser and arrow then picture = 2 end end
or something like thisbut it gives me error =/Code:if pad:r() and pad:square() and picture == 2 then if eraser >= arrow and arrow <= eraser then picture = 2 end end
is there a way though ?
i would like to know becuase my way to make picture 2 work is guessing a imaginary retangle y and x and it takes long to find it =/Geändert von natan333 (05-02-2006 um 06:24 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
05-02-2006, 07:14 PM #1984
i think you have to do somthing like Eraserinarrow = eraser+arrow+1 then
if pad:r() and pad:square() and Eraserinarrow == 1 then
picture = 2
end
end
Really not shure it may(70%) not work.
-
05-02-2006, 11:42 PM #1985QJ Gamer Bronze
- Registriert seit
- Jan 2006
- Ort
- Western Australia
- Beiträge
- 1.046
- Points
- 8.803
- Level
- 63
- Downloads
- 0
- Uploads
- 0
if pad:r() and pad:square() and picture == 2 and eraser >= arrow and arrow <= eraser then
picture = 2
end
I'm pretty sure that's right.
-
05-03-2006, 05:17 AM #1986QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
you forgot to put './' just before "Test.lua"
Zitat von ZereoX
so it would be:
Code:if pad:cross() dofile("./Test.lua") end[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-03-2006, 05:21 AM #1987QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
??
Zitat von PopcOrn DeVil
Are you sure thats right?
lol
maybe
Code:if pad:r() and pad:square() and eraser >= arrow and arrow <= eraser then picture = 2 end
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-03-2006, 05:32 AM #1988QJ Gamer Bronze
- Registriert seit
- Jan 2006
- Ort
- Western Australia
- Beiträge
- 1.046
- Points
- 8.803
- Level
- 63
- Downloads
- 0
- Uploads
- 0
Yeah well he put it in his original if statement for some reason.
-
05-03-2006, 05:36 AM #1989QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
oh thats right..
Zitat von PopcOrn DeVil
well, maybe thats what causes the error.
we'll have to hear from ZereoX.[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-03-2006, 06:11 AM #1990QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Does anyone know about working objects that turn in to "Nil objects" when put the PSP to sleepmode, then back on again?
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-03-2006, 11:41 AM #1991
EminentJonFrost,i never added a ./ in my other script and it works perfect but this one just won't work
-
05-03-2006, 12:25 PM #1992
still getting error with that :Cry:
Zitat von EminentJonFrost
Bequiet!!!
I'm learning cc©cc
-
05-03-2006, 12:51 PM #1993QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
just a guess.. never tried it.. but maybe
Zitat von HaxxBlaster
Code:if sleepmode == true then "object" = nil end if sleepmode == false then "object" = 'sumtin here' end
-
05-03-2006, 01:03 PM #1994Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
can ANYBODY help me?????
--------------------------------------------------------------------------------------
-
05-03-2006, 01:52 PM #1995
EminentJonFrost,Lol look what i did
if pad:cross() <----Forgot then
dofile("Test.lua")
end
-
05-03-2006, 03:24 PM #1996
try this:
I changed all the spike[h].y232 into spike[h].y2 basicly.
Zitat von Grimfate126
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
05-03-2006, 03:37 PM #1997QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
lol
Zitat von ZereoX
amazing how little things escape our attention..[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-03-2006, 03:47 PM #1998
OK hi,Im making a card game but how do i do so that there random cards at the start like
you receive one of those cards at start
then after wards i can say how much that random card is wort.
Code:Aceclover = image.load("cards/AceClover.png") Acediamond = image.load("cards/AceDiamond.png") Aceheart = image.load("cards/Aceheart.png") Acespade = image.load("cards/AceSpade.png") Twoclover = image.load("cards/2Clover.png") Twodiamond = image.load("cards/2Diamond.png") Twoheart = image.load("cards/2Heart.png") Twospade = image.load("cards/2Spade.png") Threeclover = image.load("cards/3Clover.png") Threediamond = image.load("cards/3Diamond.png") Threeheart = image.load("cards/3Heart.png") threeSpade = image.load("cards/3Spade.png") Fourclover = image.load("cards/4Clover.png") Fourdiamond = image.load("cards/4Diamond.png") Fourheart = image.load("cards/4Heart.png") Fourspade = image.load("cards/4Spade.png") Fiveclover = image.load("cards/5Clover.png") Fivediamond = image.load("cards/5Diamond.png") Fiveheart = image.load("cards/5Heart.png") Fivespade = image.load("cards/5Spade.png") Sixclover = image.load("cards/6Clover.png") Sixdiamond = image.load("cards/6Diamond.png") Sixheart = image.load("cards/6Heart.png") Sixspade = image.load("cards/6Spade.png") Sevenclover = image.load("cards/7Clover.png") Sevendiamond = image.load("cards/7Diamond.png") Sevenheart = image.load("cards/7Heart.png") Sevenspade = image.load("cards/7Spade.png") Heightclover = image.load("cards/8lover.png") Heightdiamond = image.load("cards/8Diamond.png") Heightheart = image.load("cards/8heart.png") Heightspade = image.load("cards/8Spade.png") Nineclover = image.load("cards/9Clover.png") Ninediamond = image.load("cards/9Diamond.png") Nineheart = image.load("cards/9Heart.png") Ninespade = image.load("cards/9Spade.png") Tenclover = image.load("cards/10Clover.png") Tendiamond = image.load("cards/10Diamond.png") Tenheart = image.load("cards/10Heart.png") Tenspade = image.load("cards/10Spade.png") Jackclover = image.load("cards/JackClover.png") Jackdiamond = image.load("cards/JackDiamond.png") Jackheart = image.load("cards/JackHeart.png") Jackspade = image.load("cards/JackSpade.png") Queenclover = image.load("cards/QueenClover.png") Queendiamond = image.load("cards/QueenDiamond.png") Queenheart = image.load("cards/QueenHeart.png") Queenspade = image.load("cards/QueenSpade.png") Kingclover = image.load("cards/QueenClover.png") Kingdiamond = image.load("cards/KingDiamond.png") Kingheart = image.load("cards/KingHeart.png") Kingspade = image.load("cards/KingSpade.png")
-
05-03-2006, 03:51 PM #1999QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
can you clarify a bit more?
Zitat von ZereoX
this part: "after wards i can say how much that random card is wort"
i dont get it.[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-03-2006, 04:00 PM #2000
i mean that a random card apears then if its a 2Spade then i can say to lua that its wort 2 points
-
05-03-2006, 04:00 PM #2001words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
do an array. Ex:
Basically, do an array that holds all the cards. Use the random number function and have a variable be the card to draw, and chagne that variable via a random number. Since my LUA is very rusty, my array is probably rong, and probably combined with the C form of an array, but still, you get the concept i hope.Code:Deck = {} Deck[1] = AceSpades Deck[2] = AceHearts etc.. x = random.time(1,52) --w/e the random number function is and how to pick 2 numbers to get a random number from. Deck[x]
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
05-03-2006, 04:10 PM #2002Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von Altair
that doesnt work either
--------------------------------------------------------------------------------------
-
05-03-2006, 04:18 PM #2003
guys is there a way to make
to work only 1 time ? so next time it press that place it dosent workCode:if pad:r() and pad:square() then if letterPosx >= 238 and letterPosx <= 260 and letterPosy >= 20 and letterPosy <= 40 then picture = 3 end end
Bequiet!!!
I'm learning cc©cc
-
05-03-2006, 04:28 PM #2004
how can i make a image moves from one place to an other.
-
05-03-2006, 04:29 PM #2005TheMarioKartersGuest
Oh come on, try reading some tutorials.
Zitat von ZereoX
-
05-03-2006, 04:29 PM #2006QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
depends
Zitat von ZereoX
do want it to move by itself, under your control, what?[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-03-2006, 04:37 PM #2007
By it self so that the card starts from the pile and place it self at my desired location
-
05-03-2006, 04:45 PM #2008QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
you mean like solitiare?
Zitat von ZereoX
when you press a button, it goes from the deck to right beside it?[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-03-2006, 04:55 PM #2009
Like this from deck to where player cards are and a other cards goes to dealer side.
-
05-03-2006, 06:04 PM #2010Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
ok, i figured out what was wrong with my code, but i dont know how to fix it.
my old code:
it thought that it had to take the x2 and y2 and a and b values i had defined as 0. i TRIED to do this:Code:for c = 1,100 do spike[c] = { a = math.random(100), b = math.random(100), x2 = math.random(400, 20000), y2 = math.random(240), x232 = x2+a, y232 = y2+b, firing = true} end
for c = 1,100 do
spike[c] = { a = math.random(100), b = math.random(100), x2 = math.random(400, 20000), y2 = math.random(240),, firing = true}Code:x232 = spike[c].x2+spike[c].a, y232 = spike[c].y2+spike[c].b
end
BUT, now it gives me an error: test.lua:37:attempt to perform arithematic global on (?) a nil value.
wtf?
help pls.. thx--------------------------------------------------------------------------------------


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