Or is the script generally converted to a known language such as C++ first?
And how generally to you integrate a scripting language with the say a game engine?
It varies by language. Many scripting languages are run on VMs that are coded in assembly or C. Python and Ruby are both examples of this. The second part of your question is far too broad so I'm going to narrow it down and talk about Lua for a bit.
Lua is an excellent case study for anyone wanting to understand or build a scripting language. It very much follows the philosophy of "Be fast, be light, and stay out of the way". It can be used with its own VM or in a number of other contexts such as compiled directly to C. This makes it a very popular choice for both game scripting as well as for embedded systems programming since it has a tiny memory footprint for a dynamically typed scripting language. Lua can have objects if you want or not if you don't.
Lua has a C API, this is how you bolt Lua on to your C based engine (or C++ if you'd like) In general, you use what are called foreign function interfaces (FFI) to do things like this in other languages.
Our game development site goes into massive detail on this process as well as specifics for Lua.
A scripting language like any computer language has to convert its commands to machine code in order to execute. Given this fact you can take various paths to accomplish the task. You can convert the code into another language, or directly to machine code or to some custom "machine code" that runs on a VM. All the solutions have their pros and cons so the solution you choose depends on the nature of your problems. Integrating a scripting language with a game engine should not be that hard. All the game engines provide programming interfaces to integrate them with your code part of which is the scripting language.
compile
means to translate a program from a language into another. The alternative is tointerpret
a program, which means executing it instruction by instruction. Compiling allow for better performance, but interpreting do not require pre-processing (i.e., starting faster). Many game scripting languages are merely interpreted (e.g.bash
) because performance isn't so important in their domain