![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Small LUA question within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; If i have variables named 1, 2, 3, 4, and 5 how can i make it print one of those ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#3 |
![]() ![]() total-Z
|
Code:
if Controls.read():cross() then randomnumber = math.random(1,5) if randomnumber == 1 then print(var1) elseif randomnumber == 2 then print(vars) elseif randomnumber == 3 then print(var3) elseif randomnumber == 4 then print(var4) elseif randomnumber == 5 then print(var5) end end Code:
if Controls.read():cross() then print(var[math.random(1,5)]) end
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
#4 |
![]() ![]() Gutya
|
Thanks, i can't seem to get my program to work, im a noob and this is my first program. Sorry
THis is what i have: Code:
--Define Colors
black = Color.new(0,0,0)
white = Color.new(255,255,255)
--Table
Answers = {}
Answers[1] = "Go ahead, it might be your lucky day!"
Answers[2] = "Seems a bit risky to me"
Answers[3] = "Are you crazy?!"
--Load
screen:print(194,136,"Loading 0%",white)
screen.flip()
background = Image.load("background.png")
screen:clear()
screen:print(194,136,"Loading 50%",white)
screen.flip()
screen:clear()
screen:print(194,136,"Loading 100%",white)
screen.flip()
screen.waitVblankStart(60)
--Show Background
while true do
screen:blit(0,0,background,false)
--Main Game
pad = Controls.read()
if Controls.read():cross() then
screen:clear
print (120,190,Answers[math.random(1,3)],black)
screen.flip()
screen.waitVblankStart()
end
__________________
D:
|
|
|
|
|
|
#5 |
![]() ![]() total-Z
|
Code:
--Define Colors
white = Color.new(255,255,255)
--Table
Answers = {}
Answers[1] = "Go ahead, it might be your lucky day!"
Answers[2] = "Seems a bit risky to me"
Answers[3] = "Are you crazy?!"
--Load
screen:clear()
screen:print(194,136,"Loading",white)
screen.flip()
background = Image.load("background.png")
screen:blit(0,0,background,false)
screen.flip()
--Main Game
while true do
pad = Controls.read()
if pad:cross() then
screen:clear
screen:blit(0,0,background,false)
screen:print(120,190,Answers[math.random(1,3)])
screen.flip()
screen.waitVblankStart(7)
end
if pad:start() then break end
end
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth Last edited by youresam; 03-16-2006 at 07:15 AM.. |
|
|
|
|
|
#7 | |
![]() ![]() total-Z
|
Quote:
remember, "background" and "Answers" are 2 words, the forum bug adds spaces.
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
|
#9 | |
![]() ![]() total-Z
|
Quote:
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
|
#11 | |
![]() ![]() total-Z
|
Quote:
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
![]() |
| Tags |
| lua , question , small |
| Thread Tools | |
|
|