how do i promt for a variable. like on a ti-83 calc it would be like this
prompt X
sto > X
basically it prompts for a variable and thenstores it
Printable View
how do i promt for a variable. like on a ti-83 calc it would be like this
prompt X
sto > X
basically it prompts for a variable and thenstores it
thanks psphax0r9, works perfectly now,,
but for the on and off pi would i use a timer
like automatically start timer, at 4sec reset,
then i put a statement like when time > 2 then blit image2,,
could i use the timer like that?
yep you can
how do you start it automatic, without hitting any buttons
Zitat:
Zitat von PSPHax0r9
Code:white = Color.new(255, 255, 255)
courierb = Font.load("./arial.ttf")
courierb:setPixelSizes(0, 12)
while true do
screen:fontPrint(courierb, 0, 60, "Text in Arial!", white)
end
HTH!
Zitat:
Zitat von Sousanator
HTHCode:timer = Timer.new()
images = {}
images[1] = Image.load("image1.png")
images[2] = Image.load("image2.png")
images[3] = Image.load("image3.png")
timer:start()
while true do
if timer:time() >= 1000 and timer:time() <= 2000 then
screen:blit(0, 0, images[1])
elseif timer:time() >= 2000 and timer:time() <= 3000 then
screen:blit(0, 0, images[2])
elseif timer:time() >= 3000 and timer:time() <= 4000 then
screen:blit(0, 0, images[3])
elseif timer:time() > 4000 then
timer:stop()
timer:reset()
end
end
(you can replace the 1, 2, 3 in the screen blit with math.random(1, 3) and it would choose a random image to blit!)
No, you cannot prompt for a variable in LUA, you already asked this in the topic you made.
Not directly, but you can indirectly. Use a keyboard (a LUA coded keyboard i mean) for input and store this in a variable.
Where can I find a large list of different codes I can use?
For example, right now I need a code that would fill in what is in the parentheses(sp?)
if pad:start() and (image "title" is on the screen) then...
Another code I really need to know is something that will generate numbers 0-100, so that I can do probability related stuff ex.
if (generated number 0-33) then....
http://wiki.ps2dev.org/psp:lua_player:functionsZitat:
Zitat von Spiritbeast
Every function in LUAPlayer is there.
Alright, I'll take a look at that. If its every function, I should be set, although I'm not seeing anything about numbers at all. Thanks, though, I just probably am not looking hard enough.Zitat:
Zitat von PSPHax0r9
Well if you're just starting out I would HIGHLY recommend PSPMillionaire's LUA tutrials at www.evilmana.com , they are the best. Any thing to do with numbers is pretty much math you do yourself. I don't know how to explain it better than that.Zitat:
Zitat von Spiritbeast
Yeah, I am pretty new at Lua. I have done all of his tutorials (except jumping + shooting because I'm not making a platformer, let alone anything where a character moves around) and now I'm just wondering "what next?"Zitat:
Zitat von PSPHax0r9
I guess the true answer to that question is that I can't be over-reliant on tutorials, and that I'll have to do some self-teaching if I plan to go further (although it seems I'm pretty stuck right now).
Note: That functions page is working pretty well though, although maybe not for the game I'm trying to make right now, it's pretty informative and will help me in my Lua Developing. Thanks again.
Well what I did was...just started something. I'm making a game right now that will need a lot of minigames. So when I started I figured I would try to make a minigame all on my own. It's not as easy as it sounds, but it helped me learn so much. Basically, the more coding you do, the better you get.Zitat:
Zitat von Spiritbeast
Yeah, practice, practice, practice.Zitat:
Zitat von PSPHax0r9
And P.S., I got those random numbers working, I just created a little random number generator :) All I need to do is figure out how I can use it for how I need it.
I found the code in this: http://www.lua.org/manual/5.0/manual.html#2.5.1
Seems to have EVERYTHING.
I have another problem. I'm trying to do some stuff with time in my script, but its not working.
As you can see, my intentions were to add one to the jPos variable, then after three seconds, to subtract one and bring it back to zero. However, it seems to be adding one then subtracting one instantly. What is wrong with my code?Code:if jpos == 0 and pad:up() then
jpos = jpos + 1
screen.waitVblankStart(180)
jpos = jpos - 1
end
Ok guys I searched for this and found nothing. Im new to these forums and I have just started Lua. Ive followed a tut on how to make a simple program which prints text to the screen at evilmania.com. When I go to load it up with the lua play it comes up saying
Error: No script file found.
Press start to restart.
The file is in its own folder in the applications folder. Its named index.lua. Ive renamed it script.lua and still it shows me the same error. What and how can I make this work?
Alright, it first must be in the same folder as all the files in luaplayerwindows.
Also, it has to be named test.lua for the "Test" command script to read.
Zitat:
Zitat von Spiritbeast
try this:
sry, i deleted lua player, so i cant test it out. :icon_sad:Code:if pad:up() then
if jpos == 0 then
jpos = jpos+1
screen.waitVblankStart(180)
jpos = jpos-1
end
end
EDIT: is that code in your main loop? or is it in a function?
Well, im trying to make a JPEG sequence in LUA, but when i try to run it, I get the "script not found" error. This is exactly what my index.lua looks like...any suggestions? I'm assuming you guys wont steal my code. :)
Code:bg = Image.load("bg.jpg")
first = Image.load("1.jpg")
second = Image.load("2.jpg")
third= Image.load("3.jpg")
forth = Image.load("4.jpg")
fifth = Image.load("5.jpg")
sixth = Image.load("6.jpg")
eighth = Image.load("8.jpg")
ninth = Image.load("9.jpg")
tenth = Image.load("10.jpg")
screen:blit(0, 0, bg, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, first, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, second, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, third, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, forth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, fifth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, sixth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, seventh, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, eighth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, ninth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, tenth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, first, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, ninth, false)
screen.waitVblankStart()
screen.flip()
screen:blit(0, 0, eighth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, sixth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, seventh, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, fifth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, forth, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, second, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
screen:blit(0, 0, third, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(6 )
end
LuaPlayer for PSP currently only loads the .PNG format.Zitat:
Zitat von TheMarioKarters
Convert the pictures to .PNG and try again.
No I mean on my PSP XDZitat:
Zitat von Spiritbeast
Nvm fixed it.
It was because I had Screen:print instead of screen:print
My first error fix ;)
I Thought the newer version loads JPG's?Zitat:
Zitat von HaxxBlaster
Cause the Lua PC Emu loads JPG's???
you are correct, it can load jpegsZitat:
Zitat von c5cha7
Yeah i thought something was wrong :icon_razz .Zitat:
Zitat von macca-hacker
Cause i am loading some Jpgs for the chao garden,
and if it was PNG Only then i would have to change nearlly alot :dry: .
Thanks, it didn't work though. Is it because its in my main loop? (which it is)Zitat:
Zitat von Grimfate126
i keep getting the following error with this line of code: `then' expected near `='
the bolded section is the part that i keep getting the error for and i'm not sure whyCode:function hide()
for q = 1,5 do
if Player[1].x = treesonmap[q].x-30 and player[1].x = treesonmap[q].x+30 then hidebehindtext = true
else
hidebehindtext = false
if hidebehindtext == true then screen:blit(30, 30, hidebehind)
end
end
end
try putting two = instead of 1, i think thats what i did when i got that error,,
and try putting elseif instaed of just else, and put an end after hidebehindtext = false, then delete one of those ends at the end,,
k i'll try it 1 minute
k thank you=-)
edit: is there any type of swap depth comand in lua (kinda like flash)?
Can someone please help we with my Lua code please. I keep getting the No script file found error. Everything is in the correct folders also.
Code:--Mover
--Created by: kozine
grass = Image.load("images/grass.png")
player = Image.load("images/player.png")
flower = Image.load("images/flower.png")
screenwidth = 480 - player.width()
screenheight = 272 - player.width()
Player = {}
Player[1] = {x=200, y = 50}
while true do
pad = Controls.read()
screen:clear()
for a = 0, 14 do
for b = 0, 8 do
screen:blit(32 * a, 32 * b, grass)
end
end
screen:blit(100, 100, flower)
screen:blit(300, 220, flower)
screen:blit(Player[1].x, Player[1].y, player)
if pad:left() and Player[1].x > 0 then
Player[1].x = Player[1].x - 2
end
if pad:right() and Player[1].x < screenwidth then
Player[1].x = Player[1].x + 2
end
if pad:up() and Player[1].y > 0 then
Player[1].y = Player[1].y - 2
end
if pad:down() and Player[1].y < screenheight then
Player[1].y = Player[1].y + 2
end
screen.waitVblankStart()
screen.flip()
end
I keep getting that stupid error too. :(
what fw are you guys? cause 2.0+(at least 2.1+) means theres an error(it doesn't display error unfortuantly) you gatta use luawindows to find out what your error is
you need to add an extra end to the end to show the programme is over
Im using 2.6 =\Zitat:
Zitat von slicer4ever
it has the right number of ends,, but did you try naming it script.lua, and open it with script.cmd
if you still get that error you are probably double extensioning it, like if you have hidden extensions on youll see it named script.lua, but its actually named script.lua.txt since txt are hidden,,
so turn off hide file extensions and make sure its not script.lua.txt
Ok checked that. Saved it as script.lua and it did not have a hidden extension. Did the script.cmd with luaplayer Mover/script.lua and I get the following error:
Error: Mover/script.lua:4: Image.load: Error loading image
P.S: That is with Lua windows
hmmm....do this:
start>run>type:cmd>run
type in the screen that pops up:
cd
now then go to where you have luaplayerwindows folder don't gointo the folder just carry it over and place it right after cd then you should have soemtin like:
cd "c:/sometin/sometin/sometin/luaplayerwindows"
press enter
now type in luaplayer(press space) go to your script and carry it over now press enter and see if it works=-)
I dunno whether I have installed Lua windows correctly. I downloaded it from http://luaplayer.org/luaplayerwindows-0.14.zip and then I just extracted the files into my Lua Programming folder I made.
Screenshot:
http://i2.tinypic.com/s66al1.jpg
Is this correct or wrong?
Also, when I run Command Prompt via the run method I get this error:
Screenshot:
http://i2.tinypic.com/s66ejc.jpg
I have no idea what that means at all :S The only way I can run a CMD prompt is via making a .cmd file with the instructions inside.