PSP3D Left Header
PSP3D Header Right
PSP3D Logo CraveOnline Logo
Help the PSP 3D community grow!
Vote for us below:


Vote on the PSP Top 200
PSP Top 200 - Games, Videos, Wallpapers, Files, Hacks, Homebrew

Development Center - Learn the basics of coding or talk about advanced coding techniques with other developers.

Welcome to PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums!

You are currently viewing our website as a guest, which gives you limited access to reply and interact to discussions and other members. By joining our free community, you will be able to post topics in the forums, communicate privately with other members, vote in polls, and access many other special features.

Registration is fast, simple, and absolutely free so join our community today!

Go Back PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums > PSP Forums > Development Center

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2006, 10:41 AM
omar_omar2's Avatar
omar_omar2 omar_omar2 is offline
Member
 
Join Date: Jun 2006
Location: in ur ass
Posts: 65
Points: 0.74
Donate
Send a message via ShopTapNham to omar_omar2
Question some definitions

ok im still a begginer in lua i need an explanation fo these codes

math.randomseed()
ok bitween the 2 bracets some script have numbers in them like this
math.randomseed(32)
so wuts this whole function do?
and the second code is about functions for instans
function input(some code in here) <-- question 1 = wut dose this code bitween the bracets do?
function input()
local (some code) <-- and for the local wuts the diffrence between the local and
the code between the bracets both deicribes the function as i know
please replay ASAP
thnx in advance

Last edited by omar_omar2 : 07-27-2006 at 01:51 PM.
Reply With Quote
  #2 (permalink)  
Old 07-09-2006, 11:12 AM
chrispy chrispy is offline
Senior Member
My Mood:
 
Join Date: Jan 2006
Posts: 351
Points: 41.54
Donate
Ill have to get back to you about randomseed (hint, do a search), but I cn certainyl tell you about the brackets.

Its known as parameter passing. Say you declare a variable in your main procedure, and then you want to do stuff to it, well, thats what parameter passing is, sorta.
Ill give you the easiest example. Don't say that its just convoluted code, it's an example!!!


function multiply(a,b)
x = a*b
end

while true do
multiply(8,2)
screenrint(0,0,x,black)
end

the output on the screen would be 16, get it?
it assigns the variables of the function by passing the parameters over.
Hope this helps.
Reply With Quote
  #3 (permalink)  
Old 07-09-2006, 09:50 PM
omar_omar2's Avatar
omar_omar2 omar_omar2 is offline
Member
 
Join Date: Jun 2006
Location: in ur ass
Posts: 65
Points: 0.74
Donate
Send a message via ShopTapNham to omar_omar2
yea kinda'f but still i really need to know wut mth.randomseed() is
and wut dose the # between the bracets do for it
btw, wuts the diffrence between a local and and the function for example:
function input()
local player = 2
pad = Controls.read()
end
so wuts the diffrence between the local and the pad = Controls.read()
we could've jus put
function input()
local pad = Controls.read()
end
dosent that work?
Reply With Quote
  #4 (permalink)  
Old 07-10-2006, 12:01 PM
didijeeeke's Avatar
didijeeeke didijeeeke is offline
Member
 
Join Date: Apr 2006
Posts: 50
Points: 0.23
Donate
Read this it explains how the function works

http://www.indigorose.com/webhelp/vp...d_Examples.htm
__________________
Reply With Quote
  #5 (permalink)  
Old 07-12-2006, 06:40 PM
chrispy chrispy is offline
Senior Member
My Mood:
 
Join Date: Jan 2006
Posts: 351
Points: 41.54
Donate
a local variable is one thats only in scope in one part of a program.

And randomseed thingy seeds the ran# generator.
Reply With Quote
  #6 (permalink)  
Old 07-27-2006, 01:56 PM
omar_omar2's Avatar
omar_omar2 omar_omar2 is offline
Member
 
Join Date: Jun 2006
Location: in ur ass
Posts: 65
Points: 0.74
Donate
Send a message via ShopTapNham to omar_omar2
hi,
randomseed is required for AI and im coding an enemy.
So i would like an explanation of this chunk of codes:

math.randomseed(os.time() )
time = os.time()
dateString = os.date("%c", time)

I was reading a script and I found this code ( the script has AI).
And from before i heard that AI requirs randoomseed etc.
I understand the first line but these lines seem to be very complex to me
so please i need an explanation of these codes

time = os.time()
dateString = os.date("%c", time)

thank u all in advance
Reply With Quote
  #7 (permalink)  
Old 07-27-2006, 02:00 PM
GIGABYTE's Avatar
GIGABYTE GIGABYTE is offline
Senior Member
 
Join Date: Jun 2006
Location: C:\windows\fonts\gigabyte.tff
Posts: 612
Points: 0.93
Donate
wow. this is like a new language for me... .... ill bet its hard
__________________
Reply With Quote
  #8 (permalink)  
Old 07-27-2006, 03:00 PM
omar_omar2's Avatar
omar_omar2 omar_omar2 is offline
Member
 
Join Date: Jun 2006
Location: in ur ass
Posts: 65
Points: 0.74
Donate
Send a message via ShopTapNham to omar_omar2
never mind about my prev question
i have another question but now it not definitions
the only probelm with my game is that it getting very messy cuz all of my codes are in one script
and if i want to put them in seperate scripts i have to use the dofile command its gonna immediatly excute the code and the code is not ment to be excuted it just some arrays so i heard about the io.open() but that only reads one line so is it possible to use the io.open() to read the whole file with out excuting the code ?
thnx in advance
__________________
1.00 --> 1.52 --> 2.00 --> 1.50 --> 2.00 --> 2.60 -->
1.50 --> 1.00 -- > 1.50
32 stick
512 stick
SOCOM: US Navy Seals
wipeout pure
kungfu hustle
napolean dynamite
^not new ^
making a friggin game in lua an C!!!!!!
Reply With Quote
  #9 (permalink)  
Old 07-27-2006, 06:20 PM
chrispy chrispy is offline
Senior Member
My Mood:
 
Join Date: Jan 2006
Posts: 351
Points: 41.54
Donate
ye, you create a lua file of all the little functions you want to do, for example drawing the different mode screen's outputs, then dofile on it in index.lua. Nothing will appear to change, but you will then be able to call the functions you declared in your other lua script. Not difficult, but its a bad explanation!!!

EG: in one lua file, perhaps called functions.lua:

function menu(
screenrint(x,y,option,color@new(255,255,255)
end

then in index.lua

dofile ("./functions.lua")
while not pad:start()
menu()
end

Obviously not a working lua script, but its pseudocode that outlines how it works.
Reply With Quote
  #10 (permalink)  
Old 07-27-2006, 07:01 PM
dorkdork777's Avatar
dorkdork777 dorkdork777 is offline
Moderator / Pastafarian
My Mood:
 
Join Date: Jan 2006
Location: sda1:/sys/kernel
Posts: 2,422
Points: 356.24
Donate
Send a message via ShopTapNham to dorkdork777
Quote:
Originally Posted by GIGABYTE
wow. this is like a new language for me... .... ill bet its hard
Actually, though I have no programming experience in any language, Lua and Python are probably the two easiest languages you could find.
__________________
Reply With Quote
Reply

« code snippets | WHATS WRONG with MY CODE??? »



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 0.00
Points Per Thread: 1.00
Points Per Reply: 0.10





Crave Partner Sites: CraveOnline.com | DVDFile.com | PSP3D.com | ComingSoon.net | SuperHeroHype.com | RedBalcony.com | ActionTrip.com | CraveLyrics.com
Soundtrack.net | CraveFix.com | SpikedHumor.com | RPGamer.com | TattooNow.com | ImpactWrestling.com | SeekLyrics.com | PedalBMX.com | WildKO.com
vidKing.com | StrategyInformer.com | HHdb.com | RapLeagues.com | HipHop-Lyrics.com | Cravecocktails.com | ThePhatPhree.com | RideJudge.com | HottieSpots.com

ShopTapNham Shop Online Powered by Custom vB Version 5.1.0 for Crave Online Media, LLC.
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd. and PSP3D.com.
LinkBacks Enabled by vBSEO 3.0.0 RC8

All times are GMT -4. The time now is 10:26 AM.
ShopTapNham Footer Right