Frictional Games Forum (read-only)
Elven scripting tutorials - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Articles (https://www.frictionalgames.com/forum/forum-40.html)
+---- Thread: Elven scripting tutorials (/thread-10017.html)

Pages: 1 2 3


Elven scripting tutorials - Elven - 08-27-2011

I am not maybe as amazing scripter then the old advanced scripters, but I have noticed that many people (maybe not you) have problems with understanding the scripting itself. So I decided that I should put my knowledge into use and make video for those who maybe want to start scripting or who isn't so good at it.

English ain't my primary language, so I hope if you forgive me for my small grammar errors and stuff. Anyway if you have any suggestions about what to do tutorial, let me know here please Smile! If I consider it needed, I'll give it a go. I know also that there probably are already many tutorials. But I didn't see any that basic level. You cannot jump one level up without knowing previous level after all Wink! Since as I said, English ain't my primary language, I tend to talk little bit easier as well and use less words what might confuse people (hard language). I hope thought that it will help for some people!

Here is the current list (only one, tha start)
Basics of the Basic!
When is it syntax and when not?
Make your life easier: Notepad++ with plugin & Debugging!
*So, how the duckling I install hps support?
Scripting Functions (intro)
Timers
Piano Scare (Request)
Adding Credits!
Setting up development mode!
LOOPABLE TIMERS (Limited edition)
Hallucination monster scare!
Yes, probably after I am done with all tutorials, I will post that "creation" here as well Smile

Thanks,
Elven


RE: Elven scripting tutorials - Juby - 08-27-2011

Ahh nice, I am far too lazy to make videos so I salute you for that!


RE: Elven scripting tutorials - Elven - 08-27-2011

Taking 15-25 minutes per day isn't sooo bad Smile.

Plus it is for myself as well. I also study thing or do and then share it with others Smile.


RE: Elven scripting tutorials - JetlinerX - 08-27-2011

Thanks very much! I am a fairly good scripter, but I really look forward to these and hope to learn something. Page, Bookmarked.


RE: Elven scripting tutorials - MegaScience - 08-28-2011

And yet you almost always deny my scripting advice, you silly man you! Tongue


RE: Elven scripting tutorials - Elven - 08-28-2011

Ok, part 2 is up =)! http://www.youtube.com/watch?v=Pv9GK5Gh4Bw


RE: Elven scripting tutorials - JetlinerX - 08-28-2011

I know your tutorials are on scripting, but can I make a request? Can you do a tutorial on building outside environments?


RE: Elven scripting tutorials - Juby - 08-28-2011

(08-28-2011, 03:11 PM)JetlinerX Wrote: I know your tutorials are on scripting, but can I make a request? Can you do a tutorial on building outside environments?

http://wiki.frictionalgames.com/hpl2/tutorials/level_editor/tutorial_3

Wink


RE: Elven scripting tutorials - JetlinerX - 08-28-2011

Holy crap! Sorry! I totally missed that tutorial!

Thnaks Juby!


RE: Elven scripting tutorials - Kyle - 08-28-2011

You should add something about what each word in the script means. It's all about the details, the details. Tongue

Here's some scripting words that are somewhat simplified compared to some of the tutorials on the wiki. I hope you check it out. Tongue


bool = This is a true/false statement. It is used mostly to check to see something. True meaning yes, false meaning no.

int = This is an integer. It is a whole number that can be positive or negative. Examples: 1, 6, 32, -8, 0, -43

float = This is a whole number and some more left after it. Examples: 1.2, 3.23, 53234.3, -443.1, -323.1

string = This is a word or phrase. It is not a number. You can think of it as a string of characters. Examples: Hello, Hello World, How are you

"" = This is used to go around strings to seperate them from other things, so the game can recognize that a phrase is being used instead of a word. Examples: "Hello", "Hello World", "How are you"

void = This is used at the beginning of functions. It means that nothing is before it, aside from using int, bool, or string. Examples: void OnStart(), void OnEnter(), void OnLeave(), void CollideRoomTwo()

== = This is used for when something equals something else in an "if" statement or an "else if" statement. It literally means "equal to". Examples: x == a, t + 1 == x

!= = This is used when something does not equal something else in an "if" statement or an "else if" statement. Examples: x != a, 2 != 3

&& = This is an "and" symbol. It is used mostly when asking for multiple things. Example: for(int i = 1; i > 0 && i < 11; i++)

|| = This is an "or" symbol. It is used for asking multiple things and if one of them is true, then whatever you want happens aside from it being false.

if = This is an "if" statement. It is used when you are going to ask something. Example: if (x == a) { [whatever you want here] }

else = This is an "else" statement. It is used when something of an "if" statement isn't true, then it will do that. Example: if (x == a) { } else { [do what ever would happen instead if x doesn't equal a] }

else if = This is an "else if" statement. It is used when you want to ask if another thing is true if the "if" statement was false. Example: if (x == a) { } else if (x == b) { [What ever you want to happen if x == b && x != a] }

for = This is a "for" statement. It is used mostly when creating multiple instances of something. Example: for (x = 1; x > 5 && x < 0; x++) { AddTimer("timer"x, x * 1.5, "TimerFunction01") }

< = This is a less than sign.

> = This is a greater than sign.

<= = This is a less than or equal to sign.

>= = This is a greater than or equal to sign.

++ = This adds 1 to a number. Example: x++

-- = This subtracts 1 to a number. Example: x--

Scope = This term refers to the access a variable has to the whole network of scripts within your custom story files. Examples: int x in a function stays within that function. x would become undefined if attempted to be used within another function. SetLocalVarInt("Variable", 1); is like saying x = 1, but it can be used all within the script. SetGlobalVarInt("Variable", 1); is the same thing but can be used within all the scripts within your custom story folder. Need global.hps to work. See below.

// = This is used to signal that all text to the right of it will be notes and will not conflict with the script itself.

/* = This is used to signal that all text to right and underneath it will become notes. This can be useful for typing paragraphs at the beginning to explain a script or ideas or organization. Only stopped by */

*/ = This is used to stop a /* from turning things into notes, so the space between /* and */ will all be notes.