It's a problem in your code, post it and we will try and help.
Printable View
It's a problem in your code, post it and we will try and help.
I'm sorry, I forgot to add that certain other scripts I have downloaded won't work aswell, it's just the lua tutorial scripts (part 1)
where can i find the new features in the new lua,,
It could be any number of things. Have you tried running it on windows LUA player?Zitat:
Zitat von code-zero
well i have a question and if any1 knows any tut's that would be helpful but heres my prob:
kinda like aotm he has multiple angry faces shooting at the same time but i'm unsure how to do this i've been trying multiple things but can't figure out how to do it i hope you understand my prob and can help me out=-)
hi, this s my code:
it works, but i get the same two money amounts every time, 1.e+6(1000000) ,and 7.5e+5(750000) how can i make it so that each time a takes another values that what it already has? and one more thing how can i disable scientific notation??Code:b = Color.new(255, 255, 255)
System.usbDiskModeActivate()
cases = {26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }
money_value = {100000, 750000, 500000, 400000, 300000, 200000, 100000, 50000, 25000, 10000, 50000, 1000, 750, 500, 400, 300, 200, 100, 75, 50, 25, 10, 5, 1, .01 }
case_money = {}
while true do
pad = Controls.read()
if pad:start() then
break
end
n = 1
a = math.random(26)
screen:clear()
while n < 27 do
case_money[n] = money_value[a]
n = n + 1
end
if n >26 then
assign = false
end
screen:print(130, 100, money_value[1], b)
screen:print(130, 150, money_value[2], b)
screen.waitVblankStart()
screen:flip()
end
right before your "while true do" put:
math.randomseed(os.time() )
math.random()
math.random()
math.random()
same thing. it still doesnt work, heres my current code:Zitat:
Zitat von califrag
thanks for all ur help!Code:b = Color.new(255, 255, 255)
System.usbDiskModeActivate()
cases = {26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }
money_value = {100000, 750000, 500000, 400000, 300000, 200000, 100000, 50000, 25000, 10000, 50000, 1000, 750, 500, 400, 300, 200, 100, 75, 50, 25, 10, 5, 1, .01 }
case_money = {}
math.randomseed(os.time() )
math.random()
math.random()
math.random()
while true do
pad = Controls.read()
if pad:start() then
break
end
n = 1
a = math.random(26)
screen:clear()
while n < 27 do
case_money[n] = money_value[a]
n = n + 1
end
screen:print(130, 100, money_value[1], b)
screen:print(130, 150, money_value[2], b)
screen.waitVblankStart()
screen:flip()
end
ok i decided to try to learn LUA. I started with trying the "hello world" thing (using notepad), I typed the code and every thing and I saved it as script.lua but it saved as a text document. How can I make it save as a LUA file??? sorry for the incredibly noobish question its just i am very new to programing.
Thanks guys :icon_smil
if the name is somethin like blah.txtZitat:
Zitat von MrBoots
then just simply rename it to blah.lua
windows may ask you that is may not work if u chage the file extension, but ignore that.
Zitat:
Zitat von Grimfate126
Thats what I did but its still a text document.
Zitat:
Zitat von Grimfate126
ooo sorry change
screen:print(130, 100, money_value[1], b)
screen:print(130, 150, money_value[2], b)
to
screen:print(130, 100, money_value[a], b)
screen:print(130, 150, money_value[n], b)
that should be giving you two different random money values. what is it you're trying to accomplish?
i think to get rid of scientific notation you would just use
string.format("%d", moneyvalue[a])
instead
me along with 2 other pepps are workin on a deal or no deal trye game. so this functions is supposed to assign each case a money value. i put the print thing just to check it. but the math.random thing for variable "a" keeps its value, so every time it starts, each case has the same money. basically, i need it like this:Zitat:
Zitat von califrag
1. a is a random number from 1 to 26.
2. when n is increased by one, "a" now equals ANOTHER number from 1 to 26, and so on, besides the number that has already been chosen.
sry if i sound confusing
Never mind I fixed it. My mistake
Ok, so my problem IS my source code then, here:
Code:blue = Color.new(0,0,255)
screen:print(200, 130, "My name is Code-Zero!", blue)
screen.flip()
while true do
screen.waitVblankstart()
end
Just a quick guess before i start coding, try this:Zitat:
Zitat von code-zero
Code:blue = Color.new(0,0,255)
while true do
screen:print(200, 130, "My name is Code-Zero!", blue)
screen.waitVblankstart()
screen.flip()
end
Zitat:
Zitat von Grimfate126
dude.. well.. i couldn't figure out how to do it from your code.. so I just wrote the code myself.. i understood what you meant.. just look at the attached script file... basically it builds a table of case numbers, sets a default case, removes it from the table, then each time "x" is pressed it selects a random case from the ones which are left, and then sets a new value for it... just download the script file and the eboot and test it out... pretty it up with some images and let me know how it works out for you!
Wow you took the liberty to goZitat:
Zitat von califrag
code a version yourself to help someone out :razz: .
You good man deserve an award and maybe 1000 Points?
If you want to claim your Award PM me saying so :icon_wink .
Dont worry, this aint no scam. c5cha7 is looking for good
people in the scene to donate my points to :D .
I appreciate the offer but really I did it because I think it's a neat idea and it was a good ten minute exercise for me to learn how to remove and add to a table ;D I honestly would probably not use the points even if you gave them to me, but thanks anyways! Did you test out that script? did it work for you like it needs to?Zitat:
Zitat von c5cha7
Nope, didn't work, it just says error: no script file found
well i'm at least able to get it running.. what firmware version are you on?
lol okay then,Zitat:
Zitat von califrag
also code-zero i think you may need to change your lua cmd file.
Right click on the index.cmd and edit it to this:
--
luaplayer index.lua
PAUSE.
--
Note that your file has to be called index.lua if you name it that
in the cmd :icon_wink .
Edit: Unless your on PSP lol :p .
(I Always try the emulator)
Edit:
it has a wierd problem when resetting the case numbers and starting a new game but the idea is there.. i'll play with it some more and update the attachment before i go to bed
EDIT: I fixed it and it now works fine and even tells you which cases are left to choose from. i updated the attachment on the previous post.
error: something about vblankstart nil value
Ok, so I managed to get 1 script working on the psp (wasn't mine) and for some reason this is the only downloaded script that has worked on my psp. It was a pickup line generator, :p
what version of luaplayer do you have?
0.14 for fimware 1.00 (I'm using bock eloader)
hmm k, i dont really know how eBock and stuff works. So do you need to have the 1.00 version with eBock? Because maybe thats the problem. Also Can you use higher versions of luaplayer, like 0.16? Thats the one have, and everything works and i know there's a 1.00 version of that aswell.
I'll try version 0.16 and report in then, it's wierd though, that only certain scripts are playing correctly.
yeah thats what got me thinking about the version you have. Maybe the others use commands 0.14 doesnt support.
Nope, didn't fixit, I'll try using the tutorial to change it to a stand alone eboot
hmmmm, what i've done which absolutely rocks is i got the eloader on my 32mb and my 1gb card and luaplayer v0.17DK2 on my 32 mb and luaplayer v0.16 on my 1gb - its great!
I'm having an odd graphical problem with my Lua script.... this http://i2.tinypic.com/syvv4l.png is showing up like this: http://i2.tinypic.com/syvuy9.jpg ingame. Anyone know whats wrong?
Uhm sometimes it could just be what format the image it is in, but otherwise I have no idea.
.PNG, which has been working for me for a while.Zitat:
Zitat von PopcOrn DeVil
Ok i haven't done anything to it and suddenly LUAplayer doesn't work anymore. First i got an error saying something is nil and press start to restart (the usual), but this happens on startup of LUAplayer itself. Tried to reinstall and still to game. Now it just crashes and tells me its not able to run it? This sucks bigtime since i cannot play my own game to test it.
Did anybody else have this? If so what did you do, or else any ideas on this?
Edit:
Never mind, it works again. I have no clue about what happened, i just kept on reinstalling and rebooting till it worked again, jey!
Ok, I've got some major image problems in LUA. The first problem is when I run the following script on the PSP, it runs fine, but when loading it using windowsluaplayer I get myself the following error:
Script
Error:Code:System.usbDiskModeActivate()
green = Color.new(0, 255, 0)
time = 0
pi = math.atan(1) * 4
background = Image.load("images/background.jpg")
smiley = Image.load("images/smiley.png")
while true do
screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
x = math.sin(pi * 2 / 250 * time) * 200 + 220.5
y = 172 - math.abs(math.sin(pi * 2 / 125 * time) * 150)
screen:blit(x, y, smiley)
time = time + 1
if time >= 500 then
time = 0
end
screen.waitVblankStart()
screen.flip()
pad = Controls.read()
if pad:start() then
break
end
end
Next, as soon as I replace the background.jpg by the same file in png, it doesn't load at all, no matter on the PSP as on Windows. Though my tutorial used a .png file that loaded just fine.Zitat:
error: index.lua:5: Image.load: Error loading image.
Thanks in advance
You sure you havent used any capital letters or anything on the ACTUAL image name?
Make it a png file. might fix it. I never thought lua could read jpg?