Zeige Ergebnis 1.561 bis 1.590 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; no prob man...
-
04-15-2006, 06:34 AM #1561
no prob man
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 07:13 AM #1562Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Would this work?
(i just wrote that)Code:time = Timer:new() score = 0 while true do if time = time + 1 then score = score + 5 end

--XBL Gamertag: PhenoM904--
-
04-15-2006, 07:19 AM #1563OMFG

- Registriert seit
- Jul 2005
- Ort
- Toronto
- Beiträge
- 2.814
- Points
- 19.453
- Level
- 88
- Downloads
- 0
- Uploads
- 0
nope that won't work. if I knew sorta what you were trying to accomplish I can try and help.
Zitat von MaSt3r_ShAk3
-
04-15-2006, 07:19 AM #1564
i dont think so because the timer is in miliseconds and the highest framerate is 60 fps so then time is never time+1 but more. you can also just use time as a variable and increment it by 1 each time it goes through the loop.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 07:22 AM #1565Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
I want it that every half second the score increases by 5
Zitat von Slasher
@altair- how would I do that? just put score = score + 1 at the bottom of the loop?
--XBL Gamertag: PhenoM904--
-
04-15-2006, 07:24 AM #1566
This would work:
Notice: Put "timeold=time" at the end of the loopCode:when true do if time/1000=timeold/1000 +1 then score = score + 5 end "more code here" timeold=time end
BTW Maybe you need to make it like this:
Because the loop is probably not precisely 1 second or a multiple of that. This wont affect the rest of the game because the timer will keep running so you still get 5 points per second. Hope thats clearCode:if time/1000>=timeold/1000 +1 then
NVM the var-thing I didn't know you wanted to do that after each secondGeändert von Altair (04-15-2006 um 07:28 AM Uhr)
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 07:37 AM #1567Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Ok.. would i do time = timer:new() before the loop? or store a nil value in time

--XBL Gamertag: PhenoM904--
-
04-15-2006, 07:51 AM #1568
yeah time = timer:new() before the loop. Also you should start the timer at the beginning of the game. SO maybe something like this:
Code:if start==false then time:start() start==true end
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 07:54 AM #1569Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
I get, Error: attempt to index global 'timer' (a nil value)...

--XBL Gamertag: PhenoM904--
-
04-15-2006, 08:01 AM #1570
ok i forgot i just used your code but its like this:
time=Timer.new()LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 08:02 AM #1571Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
i got this error whats rong?
C:\Documents and Settings\Mori\Desktop\lua \luaplayerwindows>luaplay er rock.lua
error: rock.lua:41: Argument error: The Controls functions take no arguments (an
d also, must be called with a colon from an instance: e g mycontrols:left().
-
04-15-2006, 08:05 AM #1572
show the rest of your code and atleast line 41
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 08:08 AM #1573Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
its the one you helped me w/

-
04-15-2006, 08:08 AM #1574Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
wtf??? this is annoying "error: Calling 'new' on bad self (number expected, got table)" its reffering to the time = Timer:new()

--XBL Gamertag: PhenoM904--
-
04-15-2006, 08:15 AM #1575Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
ah, ill hold off on score til the 2nd release

--XBL Gamertag: PhenoM904--
-
04-15-2006, 08:22 AM #1576
did you read my last post on that? Its on the bottom of the page before this.
I sain it should be:
time=Timer.new()LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 08:31 AM #1577Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Yeah... I still got errors
But I realized I do need it to increase speed every 10 seconds...
its referring to the time = Timer:new()Code:Error: Calling 'new' on bad self (number expected, got table)
Geändert von Mast3r_Shak3 (04-15-2006 um 08:34 AM Uhr)

--XBL Gamertag: PhenoM904--
-
04-15-2006, 08:36 AM #1578
its time=Timer.new() NOT time = Timer:new() note the point instead of the double colon
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-15-2006, 08:39 AM #1579Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Ah, lemme try it out...
Error: Attempt to perform arithmetic on global 'time' (a userdata value)
--XBL Gamertag: PhenoM904--
-
04-15-2006, 08:49 AM #1580Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
i cant get a pause to work... what i would like is for ex
screen
rint(10, 20, "BLALALALAL" color1)
-- Have it pause for x amount of time then play the next line
-
04-15-2006, 08:51 AM #1581Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
You have to add a screen.waitVblankStart() and put your delay in the (). Keep in mind 60 will have a 1 second delay

--XBL Gamertag: PhenoM904--
-
04-15-2006, 09:00 AM #1582Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
that is what did but it seems to add up all the time and have ya wait in the begining

-
04-15-2006, 09:05 AM #1583Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Do you want the same interval between each string?

--XBL Gamertag: PhenoM904--
-
04-15-2006, 09:08 AM #1584Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
nope could that be why?

-
04-15-2006, 09:29 AM #1585Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Well, if you wanted different intervals you would be putting screen.waitVblankStart() after every string. Then putting screen.flip() at the end... post ur code

--XBL Gamertag: PhenoM904--
-
04-15-2006, 09:33 AM #1586Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
k here it is:
----joke
white= Color.new(225,225,225)
brick=Image.load("Smile.p ng")
------ end load
screen.flip()
screen
rint(10, 10, "Opening Flash0", white)
screen.waitVblankStart(12 0)
screen
rint(10, 20, "Cant Open... Starting Brute Force", white)
screen.waitVblankStart(12 0)
screen
rint(10, 25, "jfklafdjoaiudfjkfdajklfd afdjlkadfkl", white)
screen.waitVblankStart(10 )
screen
rint(10, 35, "980341809314789312489132 748913298478913", white)
screen.waitVblankStart(10 )
screen
rint(10, 40, "324902023423043204023490 234023943204932", white)
screen.waitVblankStart(5)
screen
rint(10, 50, "Flash0 Open.. Shuting Down will cuas a brick.", white)
screen.waitVblankStart(20 )
screen
rint(10, 60, "Flash0:/vsh is being delited", white)
screen.waitVblankStart(60 )
screen
rint(10, 70, "There you Go Pricked PSP", white)
screen.waitVblankStart(5)
screen
rint(10, 80, "Enjoy By-By now", white)
screen.waitVblankStart(30 )
screen.flip()
-
04-15-2006, 09:43 AM #1587Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
try that...Code:----joke white= Color.new(225,225,225) brick=Image.load("Smile.png") ------ end load while true do screen:print(10, 10, "Opening Flash0", white) screen.waitVblankStart(120) screen.flip() screen:print(10, 20, "Cant Open... Starting Brute Force", white) screen.waitVblankStart(120) screen.flip() screen:print(10, 25, "jfklafdjoaiudfjkfdajklfda fdjlkadfkl", white) screen.waitVblankStart(10) screen.flip() screen:print(10, 35, "9803418093147893124891327 48913298478913", white) screen.waitVblankStart(10) screen.flip() screen:print(10, 40, "3249020234230432040234902 34023943204932", white) screen.waitVblankStart(5) screen.flip() screen:print(10, 50, "Flash0 Open.. Shuting Down will cuas a brick.", white) screen.waitVblankStart(20) screen.flip() screen:print(10, 60, "Flash0:/vsh is being delited", white) screen.waitVblankStart(60) screen.flip() screen:print(10, 70, "There you Go Bricked PSP", white) screen.waitVblankStart(5) screen.flip() screen:print(10, 80, "Enjoy By-By now", white) screen.waitVblankStart(30) screen.flip() end
--XBL Gamertag: PhenoM904--
-
04-15-2006, 09:53 AM #1588Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
no error it just does not show any thing

-
04-15-2006, 09:54 AM #1589Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
What?? That doesnt make sense...

--XBL Gamertag: PhenoM904--
-
04-15-2006, 09:55 AM #1590Jesus loves me more.
- Registriert seit
- Mar 2006
- Ort
- Illegal Abric Sites
- Beiträge
- 1.551
- Points
- 11.452
- Level
- 70
- Downloads
- 0
- Uploads
- 0
there is no text on the psp it did not print to screen



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