# A script as a whole

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

## 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 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 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 on other sites
Sure, go ahead. All ideas for logos are welcome. :)

1. 1
Rutin
26
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 9
• 9
• 46
• 41
• ### Forum Statistics

• Total Topics
631751
• Total Posts
3002076
×