Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Elven scripting tutorials
Author Message
Elven Offline
Posting Freak

Posts: 861
Joined: Aug 2011
Reputation: 26
Post: #11
RE: Elven scripting tutorials

Thanks Kyle Big Grin! I'll make special video about it next time then Smile! Very good idea Smile! My plan is to give all the basic and important stuff for scripter and to make them understand the scripting, not copy paste everything.

Can you explain that little bit more tho, just for myself: for (x = 1; x > 5 && x < 0; x++) { AddTimer("timer"x, x * 1.5, "TimerFunction01") }

Especially the beginning part Wink

The Interrogation
Chapter 1

My tutorials
08-28-2011 05:36 PM
Find all posts by this user Quote this message in a reply
Juby Away
Senior Member

Posts: 290
Joined: May 2011
Reputation: 5
Post: #12
RE: Elven scripting tutorials

(08-28-2011 05:36 PM)Elven Wrote:  Thanks Kyle Big Grin! I'll make special video about it next time then Smile! Very good idea Smile! My plan is to give all the basic and important stuff for scripter and to make them understand the scripting, not copy paste everything.

Can you explain that little bit more tho, just for myself: for (x = 1; x > 5 && x < 0; x++) { AddTimer("timer"x, x * 1.5, "TimerFunction01") }

Especially the beginning part Wink

for(int x = 1; x (greater than) 5 (and) x (less than) 0; x(adds 1)) { AddTimer("timer"+x, x (times) 1.5, "TimerFunction01") }

the information in the parenthesis explain what each part does.

Insanity. Static.
(This post was last modified: 08-28-2011 06:15 PM by Juby.)
08-28-2011 05:46 PM
Find all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #13
RE: Elven scripting tutorials

First, let me strech this out, so to say...

void OnStart()
{
for (int x = 1; x > 5 && x < 0; x++)
{
AddTimer("timer"+x, x * 1.5, "TimerFunction01");
}
}

Sorry about this, but it appears I was running too quick through this when typing it out those few months ago. The bolded parts are the areas where I should have put something. Tongue

Now the explanation.

A "for" loop is used to do something under certain conditions. It is mostly used with numbers that can be used multiple times to shorten your script. The parameters, or the things between the parentheses, "(" and ")", are seperated between a simicolon ( ; ). The first parameter, is the counter, which is the counting variable with it's inital value. The second one is the condition(s), this is where it loops when the conditions are true. The last parameter determines the change in the value of the variable, which is usually + 1 of it's current value (repesented by the variable++ (x++ in this case)).

When the loop is initiated, it creates multiple instances of the variable. Like any other AddTimer command function, there is it's local name, it's name before initiated, and then the name of the timer function.

With the code above in mind, I will create another piece of code which does the exact same thing, and as you can see, the code is much more repeated in a sense.

void OnStart()
{
     AddTimer("timer1", 1.5, "TimerFunction01");
     AddTimer("timer2", 3, "TimerFunction01");
     AddTimer("timer3", 4.5, "TimerFunction01");
     AddTimer("timer4", 6, "TimerFunction01");
}

Go here for more information:

http://wiki.frictionalgames.com/hpl2/tutorials/forloop

(This post was last modified: 08-28-2011 05:57 PM by Kyle.)
08-28-2011 05:57 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 861
Joined: Aug 2011
Reputation: 26
Post: #14
RE: Elven scripting tutorials

Thank you Kyle Smile! I am not much smarter as well Big Grin!

The Interrogation
Chapter 1

My tutorials
08-28-2011 06:43 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 861
Joined: Aug 2011
Reputation: 26
Post: #15
RE: Elven scripting tutorials

Hey. IT has been a while. School started and I was little bit busy. But I got part 3 up. This time title is "timers" Smile!

The Interrogation
Chapter 1

My tutorials
10-04-2011 12:28 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 861
Joined: Aug 2011
Reputation: 26
Post: #16
RE: Elven scripting tutorials

Added Piano Scare tutorial Smile

The Interrogation
Chapter 1

My tutorials
10-19-2011 09:15 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 861
Joined: Aug 2011
Reputation: 26
Post: #17
RE: Elven scripting tutorials

Many people had problems with adding credits. So I created quick tutorial just for credits. How to add credits Smile

The Interrogation
Chapter 1

My tutorials
10-20-2011 11:50 AM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 861
Joined: Aug 2011
Reputation: 26
Post: #18
RE: Elven scripting tutorials

Feels so weird posting all alone. But here is something what was requested:

Setting up development mode!

The Interrogation
Chapter 1

My tutorials
10-20-2011 10:17 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 861
Joined: Aug 2011
Reputation: 26
Post: #19
RE: Elven scripting tutorials

Added this: Make your life easier: Notepad++ with plugin & Debugging!

The Interrogation
Chapter 1

My tutorials
02-05-2012 03:15 PM
Find all posts by this user Quote this message in a reply
trollox Offline
Member

Posts: 215
Joined: Dec 2011
Reputation: 3
Post: #20
RE: Elven scripting tutorials

Smile i might sound retarded Elven but could you make a tortorial about installing that extra thingy to the
c++ ? i can't get it to work! I'm it's annoying me :C Would be awesome.
Trollox.
That test installation just confused me Big Grin
(This post was last modified: 02-05-2012 06:29 PM by trollox.)
02-05-2012 06:29 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)