Tutorial: Scripting ( all of it )

Post your scripting questions / solutions here

Moderator: Moderators

Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Never thougt of that... I'll fix that in a jiffy.
Admin .MAP Forums
Image
Head above heels.
FforrestGump
Lance Corporal
Posts: 17
Joined: Fri May 23, 2003 1:15 pm

Post by FforrestGump »

good stuff :))


thanks

Fforrest 8)
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Now there is a link at the top/start of the tutorial that allows you to transfer the complete tutorial and appendixes and images in a ZIP file to your local disk.

Its a quick coversion so feel fre to point out any errors in the docs ( bad links and missing pictures and stuff like that )
Admin .MAP Forums
Image
Head above heels.
User avatar
lefty35
Sergeant
Posts: 69
Joined: Mon May 05, 2003 9:26 pm
Location: Undisclosed
Contact:

Post by lefty35 »

I needed this tutorial. I've also noticed that it's set up similarly to php. :)
Jagdtiger
Lance Corporal
Posts: 11
Joined: Sat Jun 14, 2003 3:53 pm

Post by Jagdtiger »

Good jod on the tutorial! :wink: However, you might want to include an "example script" and show where each part of your tutorial fits into it, for people like me who are clueless :? when it come to scripting. Lastly, a list of all the exec global commands and what they do would be most helpful(PLEASE :?: :D :D :D ).
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Not ignoring U
On vacation
Back in a week
:)
Admin .MAP Forums
Image
Head above heels.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Bjarne BZR wrote:Not ignoring U
On vacation
Back in a week
:)
lucky u
Live to map, not map to live.
-mohaa_rox, .map
moderator
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Jagdtiger wrote:However, you might want to include an "example script" and show where each part of your tutorial fits into it, for people like me who are clueless :? when it come to scripting.
...there ARE examples... what more exactly do you need exemplified? Be specific please.
Jagdtiger wrote:Lastly, a list of all the exec global commands and what they do would be most helpful(PLEASE :?: :D :D :D ).
Not really shure what you mean by this :oops:
Do you mean like exec global/DMprecache.scr?
You can execute ANY script like this... thake a look in the standard *.pk3 files to see all the shipped scripts.

But I guess you want to know what it DOES, right? Well... learn the scripting language and you will be able to read what they do for your self... :wink:
Admin .MAP Forums
Image
Head above heels.
User avatar
Sonsai
Colonel
Posts: 438
Joined: Mon Feb 17, 2003 1:40 pm
Location: Wisconsin
Contact:

Post by Sonsai »

Just started scripting today, so basically almost everything is variables, and the variables actions? I dind't get that far, I guess there's more to know

Last years math helped a lot, expressions, variables, equations, etc. etc. See kids, Stay in school!
Image
w0lv3
Lance Corporal
Posts: 23
Joined: Fri Jun 27, 2003 12:53 pm
Location: Australia

Post by w0lv3 »

no i want to quit school and script professionaly :lol:
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

if you need help sonsai i can help you. :D
Mainframe
Warrant Officer
Posts: 125
Joined: Tue May 13, 2003 9:41 pm
Location: Detroit, MI
Contact:

Post by Mainframe »

i just pm someone to help me get a link in scripting .... and i saw this hehehe this is sick .... wut books would you's recommend for this scripting stuff ... i took q basic.v6 years ago :( a few weeks of understanding the basics ill be all good i tink :shock: .... so much to learn no time to :(
User avatar
chris_in_cali
Sergeant
Posts: 65
Joined: Thu Jun 26, 2003 9:46 am

Post by chris_in_cali »

Ok, you lost me with array examples right here:

local.n[variableOne][variableTwo][5] = 23
local.a = local.n[variableOne]
local.b = local.a[variableTwo]
println local.b[5] // prints 23

I don't quite understand the function here. Are the second and third lines defining variableOne and variableTwo, or are they referencing them within local.n ? I also can't wrap around my head why println local.b[5] would display 23 unless the previous two lines are something like if statements... actually, I just don't know what's going on there. yeah...
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

chris_in_cali wrote:Ok, you lost me with array examples right here:

local.n[variableOne][variableTwo][5] = 23
local.a = local.n[variableOne]
local.b = local.a[variableTwo]
println local.b[5] // prints 23

I don't quite understand the function here. Are the second and third lines defining variableOne and variableTwo, or are they referencing them within local.n ? I also can't wrap around my head why println local.b[5] would display 23 unless the previous two lines are something like if statements... actually, I just don't know what's going on there. yeah...
This is a hairy example... and if someone would actually use code like tis in a script, they have probably just learned scripting and are showing off....

Here is what happens:

saying local.n[3][1][7] = 35 is saying local.n is an array, give me the variable at index 3
The variable at index 3 is also an array, give me the variable at index 1
The variable at index 1 is also an array, give me the variable at index 7
Set the variable at index 7 to the value 35

In the example above this is done in separate steps:

// Get way in there and set the variable to 23
local.n[variableOne][variableTwo][5] = 23
// Get one step in, and save the variable at index variableOne in local.a...
local.a = local.n[variableOne]
// Get one step in, and save the variable at index variableTwoin local.b...
local.b = local.a[variableTwo]
// Get one step in, and get the variable at index 5, and send it as a parameter to the println command.
println local.b[5]

A smarter and faster way to print it would be:

println local.n[variableOne][variableTwo][5]

Any clearer? If not, don't worry. Extreme arrays like this is seldom used... the only practical use of an array like this that I could imagine would be to store objects sorted in 3D space... but it would be a bad way to store them in most cases as it would use a very large piece of the memory...
Admin .MAP Forums
Image
Head above heels.
Tazz
Second Lieutenant
Posts: 155
Joined: Fri Feb 16, 2007 1:29 pm
Contact:

Post by Tazz »

I get page not found now......has it been moved or something?
Post Reply