Sign in to follow this  

A script as a whole

This topic is 3845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

This topic is 3845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this