Zeige Ergebnis 4.831 bis 4.860 von 10238
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; Simple logic ;)...
-
12-23-2006, 06:26 PM #4831words 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
Simple logic ;)

...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
-
12-23-2006, 07:56 PM #4832
thanks man
Zitat von Grimfate126
-
12-23-2006, 10:18 PM #4833QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- BEHIND YOU!!
- Beiträge
- 1.061
- Points
- 6.453
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Well if your professor or whatever has seen anything on psp he may easily be able to spot it. But if he doesn't own a psp then he will not know whatsoever. But for a project like that you will most likely have to show him your sources so...
Zitat von jamz1825
[url=http://xs.to][img]http://xs313.xs.to/xs313/07106/wmnp8z.png[/img][/url]
What's a recovery.elf
[QUOTE=iball]
He's the one that fixes Santa's sleigh when it breaks down[/QUOTE]
[QUOTE=Deturbanator]why are we allowed to see the whole flesh and being of the boob but we MUST blur out the tit?[/QUOTE]
[PRE][B]sg57 i love you for turning on the light of homebrew when i was in the darkness of sony[/b][/pre]
-
12-24-2006, 04:14 PM #4834
I'm trying to learn to learn how to use functions in lua, but I get a bunch of errors when i try to transfer the value of a variable from a function back to a variable of the same name in the main loop.
sigh, I'm probably just not getting something. Does anyone know where I can learn how to use functions correctly? All of the newby tutorials I've come across have been too basic or un-indepth for what i am trying to do.
-
12-24-2006, 04:19 PM #4835Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
www.evilmana.com
And heres something Im just gonna throw together that should work
You mean stuff like that doesnt work for you? If not then your probally doing something wrong check the tuts on evilmana for more info.Code:function addition() variable = 2 bill = 3 check = variable + bill end while true do addition() screen:print(0,0,check,red) screen.waitVblankStart() screen.flip end
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-24-2006, 04:27 PM #4836QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
what if he ask's to see the source?
Zitat von jamz1825
-
12-24-2006, 04:33 PM #4837QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
wait wait, lemme get this straight. you used the same .. word for a variable and a function?
Zitat von joshparrisjosh
like this?:
if so, that wouldnt work, as you just found out.Code:variable = something (some code) function variable()
if this has nothing to do with your problem, well then, the first thing you gotta know about getting help is that you post your code up and say what error luaplayer gives you. that way, people can .. well help you. :)[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
12-24-2006, 04:50 PM #4838
Okay well here's my code, just promise not to make fun of me because of how bad it seems. :o
white = Color.new(255,255,255)
green = Color.new(0,255,0)
locke = 1
truewords = nil
function loopy(locke, truewords)
while locke > 0 do
screen:clear()
pad = Controls.read()
screen
rint(0,0,"Pick a song", white)
if pad:up() then
screen
rint(100,100,"turn it up",green)
if pad:up() and pad:cross() then
locke = 0
truewords = "turn it up"
end
end
if pad:down() then
screen
rint(100,100,"the sharpest lives", green)
if pad:down() and pad:cross() then
locke = 0
truewords = "the sharpest lives"
end
end
screen.waitVblankStart()
screen.flip()
end
return truewords
return locke
end
while true do
screen:clear()
pad = Controls.read()
loopy(locke, truewords)
if locke > -1 then
screen
rint(100,100,"press x to continue")
if pad:cross() then
locke = locke - 1
end
end
if locke == -1 then
screen
rint(100,100,truewords,wh ite)
end
screen.waitVblankStart()
screen.flip()
end
-
12-24-2006, 05:01 PM #4839Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
First off dont quote your code. Code your code . It stops the smileys and the space problem. Secondly whats the problem with your code?
EDIT: O AND [email protected]!!!!!!!!!!!!!!!! SWEEEEEEEEEEEETTTTTTTTTTT TTTTTTTTTT YAAAAAAAAAAA
400 pOSTS !!! YAIf you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-24-2006, 05:09 PM #4840
the problem with my code is that without the "function loopy()" everything is gravy, but in its current state as posted... after the code executes to the point where it should blit the varible "truewords" it get the error that truewords is a nil value. This to me seems to point in the dirrection that my "function loopy()" isn't changing the value of truewords into a string as i would like it to.
Is this possible? I mean to change it to string through the use of a function?
-
12-24-2006, 06:02 PM #4841Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Very annoying all im trying to make is a simple screen saver app thing for me alone and lua player is being quite a fuc...... fucey... ya fucey. anyways I try to run this and i get an error a very common error that i see in almost all my homebrew games
error: script.lua:74: '=' expected near 'end'
And I go through this code over and over and i cant find anything wrong plz help.
Spoiler for Snow Simulator:If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-25-2006, 08:01 AM #4842QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
should beCode:screen.flip
Code:screen.flip()
-
12-25-2006, 08:02 AM #4843QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Yea it says its expecting = because it expects you're declaring screen.flip as a variable because you forgot the function arguments.
-
12-25-2006, 08:24 AM #4844QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
hey i was wondering, since screen.flip() has parantheses, can it be 'customized'? like how you can put a color in 'screen:clear()'? i'm having a hard time imagining whats possible to 'customize' about flipping the screen...but, i'm sure there is SOMEthing you can do with it...
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
12-25-2006, 08:31 AM #4845QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
screen.flip doesn't take any arguements so no.
Ref: http://wiki.ps2dev.org/psp:lua_player:functions
-
12-25-2006, 09:00 AM #4846Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Ok thanks guys ill try that.
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-26-2006, 07:57 AM #4847QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Hey, I can't figure out how to get the stupid analog to work.... I dont really understand the numbers. Can someone show me an example of analog in use to move a character on the screen?
Also, whenever i put music in my game, it lags it so much its unplayable.
How can I fix this?
Thanks a lot for your help.
-
12-26-2006, 01:02 PM #4848
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Analog:
just replaceCode:pad = Controls.read(); if math.abs(pad:analogX()) > 20 then x = x + pad:analogX() / 64; end if math.abs(pad:analogY()) > 20 then y = y + pad:analogY() / 64; end screen:print(x,y-5,"<|",w); screen.waitVblankStart(); screen.flip()with what ever you want to move like a pic. :)Code:screen:print(x,y-5,"<|",w);
Hope that answers your question.
As for music:
this should work:
boltsnd = Sound.load("music/comp.wav")
If it lags up your putting too many pics slowing it down and OR your song is too long/too much space, OR somethins wrong with your PSP.
-
12-26-2006, 03:15 PM #4849Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Actually pspfreak9 the correct way to load music is
yoursound = Sound.load("yoursound.wav ",false)
false is there so it doesnt loop over and over. If you want it to loop then use true.If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-26-2006, 03:41 PM #4850
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
It works my way to and false is a default. :) But both ways work. ;)
-
12-26-2006, 08:10 PM #4851
I need help, I need to generate 9 numbers from 1 to 9 without 2 numbers to be the same.
How could i do that?Geändert von agashka (12-26-2006 um 08:26 PM Uhr)
-
12-26-2006, 09:30 PM #4852QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
use the math.random function
Zitat von agashka
Code:no.1 = math.random(1,9) if no.1 == 1 then no.2 = math.random(2,9) else if no.1 == 2 then no.2 = math.random(3,9) Etc.
-
12-26-2006, 09:53 PM #4853
mmm if no.1 = 5 and no.4 = 5....
-
12-26-2006, 10:38 PM #4854QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
yup, smething like that, when i wrote mine i was being anoyed but you get the idea
Zitat von agashka
-
12-26-2006, 11:28 PM #4855words 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
Uh, too bad the_undead has given you faulty code...
You might want to try that, or something similar to it compared to undead's ;)Code:number = {} for i=1,9 do number[i] = math.random(1,9) for j=1,i do while number[i] == number[j] and i ~= j do -- 2 numbers are the same number[i] = math.random(1,9) end ebd end
...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
-
12-27-2006, 01:06 AM #4856
thanks, actually here how i got it working;
alltoken = {1,2,3,4,5,6,7,8,9}
x = 9
gentable ={}
while x >=1 do
table.insert(gentable,tab le.remove(alltoken,math.r andom(table.getn(alltoken ))))
x = x-1 end
:)
-
12-27-2006, 04:21 AM #4857Seven Year Vet. BOW DOWN.

- Registriert seit
- Dec 2005
- Ort
- Manchester, UK
- Beiträge
- 2.240
- Points
- 14.794
- Level
- 78
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Guys, I've tried everything, and I'm stuck.
This maybe a weird question, but is there any way i could blit an image at an angle with having to make about 360 pictures of the same car facing in different directions?
Eg. this number 9 is my car
'9'
If i wanted to flip it veritcally, (or any other direction) it would look like this:
,6,
So, from the one image, how would i do this in lua?
-
12-27-2006, 06:16 AM #4858Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Did you search for some functions. THeres probaly one to blit an image at an angle.
Ok heres my questinos
I want to open a text file and print the whole file to the screen ie if the text file contains
aslkdfjaoidnfaoijdfoiajfo ;ia
dfiojasoifjaodijfoaijd;fi asjf
i want the psp to say that too. on all the lines. how would i do that?If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-27-2006, 06:51 AM #4859Seven Year Vet. BOW DOWN.

- Registriert seit
- Dec 2005
- Ort
- Manchester, UK
- Beiträge
- 2.240
- Points
- 14.794
- Level
- 78
- My Mood
-
- Downloads
- 1
- Uploads
- 0
well, the only way you could do that is to blit all the text in a file to one line, unless you do it a line at a time, changing where it blits it every time...
Can't remember how you do it a line at a time though, but i know theres a way. :Cry:
And how would i do a search for functions?
-
12-27-2006, 08:05 AM #4860Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
I just did a search
http://search.yahoo.com/search?ei=ut...ua%20functions
-= Double Post =-
Ok when I run my code it blits like the scale (not just the scale though its all the pics )but then it keeps flickering the menu and the scale over and over It wont stick with one pic.
Spoiler for GuitarHelpr:Geändert von GuitarGod1134 (12-27-2006 um 08:05 AM Uhr) Grund: Automerged Doublepost
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!


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