Author |
Scripting Basics |
Psychotik~Burn Cadet
Joined: November 14, 2003 Posts: 17
| Posted: 2003-11-21 04:30  
Exactly how am I suppose to know what Functions you have assigned to what?
I have reviewed the LUA Documentation, but handing me a manual to the language isn't very helpfull if I don't know what the Custom Functions you have scripted into DS are.
I can send out "Hello World" to the screen from any Programming Language as long as I have access to what Function allows for it!
For example, when the map starts up what function would be used to set the team?
I noticed in the empty Script you have function onTeamSelected( team )
However is the variable team an Integer, or a String that is compared to what you have set for your team Name Variable?
_________________
|
*Morpheus* Cadet
Joined: February 11, 2002 Posts: 9
| Posted: 2003-11-21 10:38  
Hi,
you might only get access to a "database" of the DS-Functions if you make the "LUA Training exercises" Chromix posted in this thread. Thats the easyiest and maybe only way to get a list of that Functions
MfG
_________________ Morpheus
BombSquadLeader
|
Psychotik~Burn Cadet
Joined: November 14, 2003 Posts: 17
| Posted: 2003-11-25 23:30  
If we are not suppose to post on the forums, and I have yet to find an Email to submit any kind of scripts we have made...
Where do we put them, so we can gain access to the API?
_________________
|
Sandals Fleet Admiral Agents
Joined: January 21, 2002 Posts: 2001 From: Redmond,WA,USA
| Posted: 2003-11-26 00:01  
Quote:
|
Well Chromix locked the other the normal forum with all scripting related info because people only started to try out scripting if they wanted to spawn Ships or Gadgets.
And they decided not to give any help to people unless they actually learned to script.
This means you will have to show some stuff in Lua and once you know Lua you'll get access to the Scripting forum.
As you can see if this forum we tried to explain that people wanna start somewhere with scripting and that Spawning things is the easiest way to start.
They want Players to learn Lua so they can make Advanced Scripts that might be usefull for the game someday.
1 line scripts that spawn something somewhere/Give you a mission/or a small tutorial is not what they are looking for.
Most players aren’t interested in knowing Lua if they first start experimenting with scripting.
Personally i prefer learning things by opening someone else’s script and ripping it apart to see what does what.
|
|
Quote:
|
We tried that for a half year. And the result was:
1 line scripts that spawn something somewhere
Everything I've seen during that time were those spawn one-liners ripped from the example scripts I placed here for download.
So we had lots of ppl who were like "Wheeee, I can spawn stations and lots of QSBs and...", set up servers which ran those "spawn-everything" maps and invited lots of other players to join them. Since players didn't familiarize themselves with LUA at all they weren't able to do anything slightly more complex than those c&ped one-liners.
That's not the way it works.
So being able to script in LUA is now required for getting access to the DS-Scripting API.
|
|
Show off l33t LUA skills that are such that you could contribute to the game in a meaningful way instead of just wanting to learn scripting in order to spawn stuff in your own server for the wow factor and they'll get you access tot he Scripting Reference and all such stuff.
_________________
|
Psychotik~Burn Cadet
Joined: November 14, 2003 Posts: 17
| Posted: 2003-11-26 04:15  
Maybe you missed it, but let me repeat.
Where do I show it off ?????????????
My Script starts off with a global database of information which is stored in arrays. In this database I have stored some simple information of Market Items. Then matched up on 3 other arrays have tied in Market Value, Max Buy Price, and Amount in Stock.
The array takes the Amount in Stock, compares it to the Market Value. Then it sets a Buy Price, if the New Buy price exceeds the Max Buy Price it replaces the New Buy Price with the value of this Items Max Buy Price.
The whole time it's running from the Beginning to the end of the array of Market Items, it repeats the process displaying it to the terminal.
Whats my opinion of LUA? Stripped down simple programming language used for internal programming, for quick intergration of lesser functions.
Things I dislike about LUA: It appears lacking in a few areas of mathmatics, for example Rounding numbers off to whole numbers. Granted you can send the data to the program calling the script and have the Originating program do it for you, but why not send the data back the way you want it to be. Also I noticed no documented information for user inputing.
It's not as versatile as I would like, but it gets most of the work done.
_________________
|
Sandals Fleet Admiral Agents
Joined: January 21, 2002 Posts: 2001 From: Redmond,WA,USA
| Posted: 2003-11-26 07:18  
Keep an eye out for [Dev]Shigernafy or [Admin]Chromix.
_________________
|
T|t@n {C?} Cadet
Joined: August 28, 2002 Posts: 123
| Posted: 2003-11-26 07:32  
uhmmm chromix is also [dev] not [admin]...
_________________
|
Chromix Cadet
Joined: June 29, 2001 Posts: 3052
| Posted: 2003-11-27 15:43  
Quote:
| It appears lacking in a few areas of mathmatics, for example Rounding numbers off to whole numbers. Granted you can send the data to the program calling the script and have the Originating program do it for you, but why not send the data back the way you want it to be. |
|
Lua doesn't have tons of features, but it offers ways to the users to build the features he needs.
function round( num )
return math.floor( num + 0.5 )
end
print( round( 3.1415 ) ); -- 3
print( round( 11.49 ) ); -- 11
print( round( 11.50 ) ); -- 12
print( round( 11.51 ) ); -- 12
Quote:
| Also I noticed no documented information for user inputing. |
|
Standard input
for line in io.lines() do print( "You wrote " .. line ); end;
_________________
|
Psychotik~Burn Cadet
Joined: November 14, 2003 Posts: 17
| Posted: 2003-11-27 22:28  
I was taking the manual for facevalue, io.lines looks to be a function for reading information from files.
Thanks for the routine for rounding though, I was looking for examples on the math routines and the ones I found showed math floor, and the results as still having the fractional values after it's used.
_________________
|
Psychotik~Burn Cadet
Joined: November 14, 2003 Posts: 17
| Posted: 2003-11-28 00:50  
Chromix, I would like access to the Scripting Areas and the API if possible.
How can I go about this, and where can I send a sample of my scripting for you to check out?
And no it's not a 1 line script More like 146 lines
_________________
[ This Message was edited by: psychladel on 2003-11-28 04:05 ]
_________________
|