Archived

This topic is now archived and is closed to further replies.

PredeX

Scripting??

Recommended Posts

PredeX    122
I guess this is a newbie question however i just didnt have the time to do any research on that topic, so heres my question: What the heck does scripting do or what are scripting engine? (I looked at the new article a bit already, but that didnt help a lot) Thx in advance PredeX

Share this post


Link to post
Share on other sites
krez    443
it is good to do anything that you don''t want to hard-code into your program. for example, if you made a game where people could build their own levels and stuff, they could use a script to tell the game how to run the level, without learning c++ or having to recompile the game.

--- krez (krezisback@aol.com)

Share this post


Link to post
Share on other sites
ATronic    122
A script is a language that does not usually need to be compiled. For example, I might make a game that reads a text file. Each time the game reads the word "Pop" it prints "You hear a loud noise", and each time it reads "Scream" it prints "A terrible scream echoes from the end of the hall." So the following script:

-Pop
-Scream
-Pop
Would have the following output:

"You hear a loud noise."
"A terrible scream echoes from the end of the hall."
"You head a loud noise."

Mind you, this is a simple example. You could have a more complex script that looks like this:

CreateCharacter(Bob)
AnimateCharacter(Bob, ANIM_RUN)
OnDeath(Bob) PlaySound(Scream):DestroyCharacter(Bob)

So the main advantage to scripts are that you can change elements of a game or level without a rebuild of your project. There are other advantages too. The main disadvantage is that you are limited by the abilities of your scripting language, and can do less than if you just coded something. But it''s generally worth it. For more info, consult the most useful source of info on the net: www.google.com

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"

Share this post


Link to post
Share on other sites
EvilCrap    134
A scripting engine is a program that acts like a virtual processor - it reads instructions, and executes them, from a software level.
a program is compiled to a native, machine-level form, when its run, its instructions can literally manipulate the processor

When a scriptor runs a Script, the Scriptor is the program being ran by the processor, it examines symbols, like words, and then performs some action based on their meaning.

program is to a cpu what a script is to a scriptor, and a scriptor is a program. get it?

like in previous posts, a script can basically look like normal code :
DoThis(x);
DoThat(c);

scripts and programs are really only different at runtime. a program needs to be compiled, or organized and broken into a set of assembly instructions - Prior to runtime. A Script can be busted up and organized on the fly, during runtime, because its instructions are scripted, and not literaly executed.

html is a script.

an important thing to keep in mind is that scripts can be compiled to compressed forms. for instnace, instead of storing and scripting, "CreateCharacter(bob)", you would store and script "AB H!", or some set of symbolic information. it would still be scripted -its not directly executed by the processor as a literal machine command, it is scripted by the scriptor.

Share this post


Link to post
Share on other sites
ATronic    122
What EvilCrap said is exactly right. Another example of a scripting language is Java. I assume you have heard the term Virtual Machine (VM). This is what "understands" the "code". Java is said to be slower, this is due to the fact that is goes through that layer.

JAVA SCRIPT ---> VM ---> MACHINE CODE

Also, as EvilCrap said, there can be compilation or compression. Compiled binary scripts are common in games, as they are VERY fast to read, and take a ton less space. Hope everyone here has cleared up your understanding of scripts.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"

Share this post


Link to post
Share on other sites