Advertisement

Scripting??

Started by January 15, 2002 06:04 PM
4 comments, last by PredeX 22 years, 10 months ago
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
Let us learn to dream, gentleman, and the we may perhaps find the truth - F. A. Kekulé
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)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Advertisement
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!"
Alex BroadwinA-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!"
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.

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!"
Alex BroadwinA-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!"
Thx a lot for your posts, with your help I got some basic understanding how scripts work!

PredeX
Let us learn to dream, gentleman, and the we may perhaps find the truth - F. A. Kekulé

This topic is closed to new replies.

Advertisement