Author Topic: I need a teacher  (Read 1391 times)

I'm in need of someone to show me how to script. i can model on my own, that's easy. I don't want to read tuts Cause i have a tourq book. Its easier for me to learn threw someone else. I have an idea for a game mode but can't get started. If i can get some help I would be great full. i have programs that will help and a VoIP site.

Haha. Hey NPC!! I can script. I'm not the best but you have seen what I made. Maybe you could teach me to model if I teach you to script.

Thanks,

General Hack

Well NPC, it is better if you learn on your own, but, if you really need a teacher I can teach a bit.

Haha. Hey NPC!! I can script. I'm not the best but you have seen what I made. Maybe you could teach me to model if I teach you to script.

Thanks,

General Hack

Hack I don't model using blender that the only thing.

Well NPC, it is better if you learn on your own, but, if you really need a teacher I can teach a bit.

I tried to learn on my own i can't get the grasp of it.

I'm in need of someone to show me how to script. i can model on my own, that's easy. I don't want to read tuts Cause i have a tourq book. Its easier for me to learn threw someone else. I have an idea for a game mode but can't get started. If i can get some help I would be great full. i have programs that will help and a VoIP site.
any coding background / knowledge whatsoever?

any coding background / knowledge whatsoever?


Little I slept threw my python   coding class. NTM the few tuts i have found

I taught myself to script, Honor only told me some variable help.

Send me a PM, and i can try and help you.

but Fair Warning - this will take many many days to do.  but if you stick with it, you can learn a lot.

Send me a PM, and i can try and help you.

but Fair Warning - this will take many many days to do.  but if you stick with it, you can learn a lot.
This goes for me too.  If you want some pointers, PM me.  You can also skype me (same name as here), I'm usually on.

I really appreciate it  guys

OK So global Var have a $ and local have a %
« Last Edit: September 27, 2010, 02:57:52 PM by NPCKiller »

Well NPC, it is better if you learn on your own, but, if you really need a teacher I can teach a bit.
I can imagine you being an evil teacher.

*SIT DOWN CHILDREN AND SHUT UP. TODAY WE ARE GOING TO LEARN SCRIPTING. IS THAT CHEWING GUM. SPIT IT OUT RIGHT NOW. *belt**

I can imagine you being an evil teacher.

*SIT DOWN CHILDREN AND SHUT UP. TODAY WE ARE GOING TO LEARN SCRIPTING. IS THAT CHEWING GUM. SPIT IT OUT RIGHT NOW. *belt**
You don't know anything about scripting.
Shut up. :S

Scripting in a nutshell: (of what I know so far)

% = Local Variable (ends once the function is ended)
$ = Global Variable (is used throughout the entire code)
True = 1 (boolean)
False = 0 (boolean)



Call a function:

Code: [Select]
function()
{
    //Write the code here
}

Use variables in a function:

Code: [Select]
function(example)
{
    %LocalVariable1 = "This is the string data being entered into %LocalVariable1!";

    $GlobalVariable1 = "This is the string data being entered into $GlobalVariable1!";
   
    echo("This is the string data being entered into the echo function!");
}

Code: [Select]
function(example2)
{
    %localVariable1 = 2000;
    %localVariable2 = "Local String Data!";

    $globalVariable1 = 20;
    $globalVariable2 = "Global String Data!";

    echo(%localVariable1);
    echo(%localVariable2);
    echo($globalVariable1);
    echo($globalVariable2);
}

This will echo:
2000
Local String Data!
20
Global String Data!



Visual:

To visually see this work, try adding a "TEST.cs" file into your Blockland folder under "config" using this code:
(edit with Notepad)
Code: [Select]
//TEST.cs

function test()
{
    %localvar1 = 500;
    %localvar2 = "Local Data Collected!";

    $globalvar1 = 1000;
    $globalvar2 = "Global Data Collected!";

    echo(%localvar1);
    echo(%localvar2);
    echo($globalvar1);
    echo($globalvar2);
}

Then start Blockland, and type [exec("config/test.cs");] into the console. It will then say "Executing TEST.cs." Then Test(); to start the test. *Note: Your Blockland folder must be the only folder before "config" for this to work! Otherwise, type in [exec("(folder)/config/test.cs");]

This should appear:




IF, IF THEN, & IF THEN IF conditional statements:

IF - executes code if the IF condition is true
IF ELSE - executes code if the IF condition is false
IF ELSE IF - may not execute the ELSE statement even if the IF condition is false!

Code: [Select]
if(example3)
{
    //Code is written here.
}

Code: [Select]
ifexample4)
if()
{
    //Code is written here.
}
else
{
    //Code is written here.
}

Code: [Select]
function(example5)
if()
{
    //Code is written here.
}
else if()
{
    //Code is written here.
}

Real example:
Code: [Select]
if(3>10)
  echo("IF statement executed and was true!");
else if(4>10)
   echo("IF statement executed and was false!!");
else
    echo("IF statement executed and the ELSE IF was false!");

In this example, the IF and ELSE IF statements are false, and only the echo after the ELSE statement is executed.
*Note: Brackets are not required when a statement only has one piece of code.



Operators:

== - equals (only one equal sign can cause issues)
&& - and (both must be true!)
|| - or (only one must be true!)
NOT - converts the condition to the opposite it represents (True/False)
SPC - combines two values with a space
@ - combines two values together to form a new value
NL - Concatenates one value together with a new line to form a new value.
TAB - Concatenates one value together with a tab to form a new value.
$= -  Evaluates whether string1 is equal to string2
!$= Evaluates whether string1 is not equal to string2.

*Note: The basic math symbols are also used. (+, -, *, /, =, >, <)

Notes:
*Use // to make notes (does not affect the script)
*Scripts must be a .cs file. To make a .cs file simply create a .txt file and edit the ending to .cs!
*Another type of conditional statement is a switch statement, but I do not yet know what these do.
*To be a good script writer, you will need to know much more than this - these are just the basics.



For a better and much more in-depth tutorial, check out KINEX's Scripting Tutorials.
This was taken directly from his tutorials.
(Packed together)
« Last Edit: October 03, 2010, 04:43:13 PM by Wesley Williams »

i wish to learn scripting as well how would i learn it myself without a teacher?

You can take a look at pieces of code.  There are also plenty of online tutorials, and some great references.

http://forum.blockland.us/index.php?topic=108156.0
http://www.egotron.com/torque/old_script.html#removeWord