The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Graphic & Game Programming > TorqueScript


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 11-15-2007, 11:50 AM
MrPickle's Avatar
MrPickle MrPickle is offline
Sr. Programmer
Join Date: Nov 2007
Location: England, Lincolnshire
Posts: 255
iTrader: (0)
MrPickle is on a distinguished roadMrPickle is on a distinguished roadMrPickle is on a distinguished road
Hello world

Sorry if this is the wrong place.

Open notepad and type or copy & paste this into it:

Code:
function helloWorld(){ //function is telling us that this is a new function and helloWorld is the name of the function.
// "//" is a comment.
// { is to open our function.
echo("Hello World!"); // echo prints things into our console anything within the brackets is echoed.
//" " is a tagged field, you don't need these is you're echoing a number, one word or an equation.
} //close the function.
Now save it wherever you put your torque folder as a .cs file.

Fire up torque.

Now you'll need to exec it bye typing this into the console (` or ~)
Code:
exec("filepath.cs");
Now type "helloWorld();" into the console, it should print Hello World!

Now for a more complicated one.

Code:
function hello(%arg1, %arg2){ //function again to say this is a new function.
// hello is the name of our function.
// %arg1 and %arg2 are both local variables, they input what we want to say.
echo(%arg1 SPC %arg2); //our echo function again.
// "%arg1 SPC %arg2" If %arg1's string were to equal "Hello" and %arg2 were equal "World" this would Echo "Hello World" SPC add's a space inbetween our 2 strings.
} //close the function
Exec it (exec("filepath.cs"); ) then type into console (` or ~) hello("Hello", "World"); it should print Hello World, you can type input anything: hello("Dog", "cat"); hello("Apple", "banana");

If anything's unclear or you're stuck with anything feel free to ask/tell me.

__________________
PM me and tell me your name or a phrase and I shall write it in Elf for you. English Tengwar to be precise.
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
The Following User Says Thank You to MrPickle For This Useful Post:
HelloWorld (11-15-2007)
  #2 (permalink)  
Old 11-15-2007, 05:39 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
what's inside filepath.cs, and why do we need it?

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #3 (permalink)  
Old 11-16-2007, 04:19 AM
MrPickle's Avatar
MrPickle MrPickle is offline
Sr. Programmer
Join Date: Nov 2007
Location: England, Lincolnshire
Posts: 255
iTrader: (0)
MrPickle is on a distinguished roadMrPickle is on a distinguished roadMrPickle is on a distinguished road
You're ment to replace filepath with where the file is in relation to your torque folder.

In your torque folder there'll be several folders, If you save your file in the base folder you'd type exec("base/nameoffile.cs");.

You need it to tell the game to execute the file so when that function's called it knows what to do. If you don't execute it when you type helloWorld(); it'll say unkown command: HelloWorld();

__________________
PM me and tell me your name or a phrase and I shall write it in Elf for you. English Tengwar to be precise.
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #4 (permalink)  
Old 11-16-2007, 05:53 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
So torque is a C# compiler?
Reply With Quote
  #5 (permalink)  
Old 11-16-2007, 07:56 AM
MrPickle's Avatar
MrPickle MrPickle is offline
Sr. Programmer
Join Date: Nov 2007
Location: England, Lincolnshire
Posts: 255
iTrader: (0)
MrPickle is on a distinguished roadMrPickle is on a distinguished roadMrPickle is on a distinguished road
I'm not sure, there is always arguments about what language it's like or what language it is. (On the other forums I visit)

__________________
PM me and tell me your name or a phrase and I shall write it in Elf for you. English Tengwar to be precise.
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #6 (permalink)  
Old 11-16-2007, 08:27 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,109
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Quote:
Originally Posted by MrPickle View Post
I'm not sure, there is always arguments about what language it's like or what language it is. (On the other forums I visit)
They're officially using language of their own called TorqueScript, but I think they're based on both C++ and C#

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 04:30 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50