Advertisement

Angelscript for beginners

Started by October 30, 2006 10:38 AM
4 comments, last by WitchLord 18 years, 1 month ago
Hey Guys, could somebody be so kind and give me a hind or links which shows me how to setup Angelscript and how to execute a script. Furthermore i´d like to know how to add a C++ Function/Class and/or how to exec a script from c++ thx in advance
This may come out a bit rude, even though it's not meant to be...

Did you check the samples in the SDK?

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Yep but there´s a question left..
What does the AddScriptSection() function do?
What is a section regarding to a script??

[Edited by - chaoslion on October 30, 2006 2:46:58 PM]
All script sections added to the same module are merged internally into one script before compiling. However, the line number and section names are kept so that any compiler messages are reported with the name and line number of the particular section.

The most common use for multiple calls to AddScriptSection() is if you have multiple script files that you want to compile together, for example common functions, or something like that.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

ok thanks for your help, you really helped me out a lot :)
but i got a final question, everytime i´m trying to call
a function with a string parameter, the program crashes.

i succsessfully linked the lib with the angelstring.cpp/h file..

void PrintSmt(std::string &str) { cout << str;}//... asIScriptEngine *as = asCreateScriptEngine(ANGELSCRIPT_VERSION); RegisterScriptString(as); as->RegisterGlobalFunction("void print(string  ∈)",asFUNCTION(PrintSmt), asCALL_CDECL);


what did i do wrong?

furthermore:
is it possible to use open parameter list ??
something like printf
// in angelscript print("bla %s","^^");
You're welcome. :)

I'm not sure why the string doesn't work for you. Did you get an error message when you registered the print function? What OS/CPU are you using? And what compiler? Depending on the OS/CPU/compiler native calling conventions, i.e. asCALL_CDECL, are not supported.

Does the tutorial sample work? In it I have registered the print function the exact same way as you showed.

Open parameter lists are not yet supported by AngelScript. You can register the printf function, but you have to specify the parameters that AngelScript will pass to it. I do not recommend it however, as it would be difficult for you to guarantee that the script doesn't do something that won't crash the application.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement