Advertisement

A script as a whole

Started by June 08, 2007 01:02 PM
2 comments, last by WitchLord 17 years, 5 months ago
I've been experimenting with Angelscript for a while now and I like it. So far I've got some stuff to work like calling angelscript functions from C++ and calling registered C++ functions from angelscript. Now I got stuck while trying to call angelscript functions from within angelscript itself (see code example below). I've poked around with the samples in SDK and the manual, but... well... let's just say I failed to find something helpful. What I'm curious about here is how the C++ code (AS implementation) has to be designed to allow this kind of script execution. Are there any online examples I could take a look at? Here's a sample code: bool test() { return true; } int main() { if (test) { Print("OK"); } return 0; } PS. Does Angelscript have a logo that people can put into their products?
Uhm, I don't understand your question. You call the AngelScript function from within AngelScript just as you would call a C function from another C function.

bool test() {  return true;}int main() {  if( test() )   {    Print("OK");  }  return 0;}


In your example you forgot the () when calling test, that's probably why it didn't work for you.

Or do you really mean to ask how to have AngelScript call a C++ function that in turn calls another AngelScript function? For this you would need 2 script contexts, when the first AngelScript function calls the C++ function, the second context is prepared with the function id of the second AngelScript function and then executed. When the second AngelScript function returns the C++ function also returns to the first AngelScript function.

There is no logo for AngelScript yet. Though, perhaps it would be a good idea to design one. For now I only have an internet button link: .

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
Haha I feel stupid. Yes, I did forget the parentheses. There was one other script I had that was similar to this one, but wouldn't work no matter what. I decided to delete it and write a new simpler one instead (the one I posted) and seems like I made a typo. So I thought there was something wrong with my code. Well it works properly now, ty. Seems like I need more practice in C++.

I'm really not a pro graphics designer, but mind if I try to design some logos?
Sure, go ahead. All ideas for logos are welcome. :)

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