Jump to content
  • Advertisement
Sign in to follow this  
mk1x86

Angelscript save context

This topic is 3050 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

Hello, I'm new to Angelscript. Here is my problem: I want to use angelscript to control characters in my game. The script is able to call c++ methods like "walkTo(int x,int y)" and "say(string str)". in script: void foo(Character@ alice) { alice.walkTo(10,10); alice.say("Look, there! A cave"); alice.walkTo(16,34); // cave position } now walkTo just sets an internal state and calculates the path to the destination. The actual walking cycle is done per frame. My idea is to suspend the context when calling walkTo and when the walking is done it is continued. Say alice is walking to 10,10. While she's walking the user wants to save and leave the game. My problem is that the context is not done with the script. I must somehow save the state the context is in and just don't know how I could do that. Checked the manual but couldn't find anything related to this topic. Also the search function didn't really help me.

Share this post


Link to post
Share on other sites
Advertisement
It's currently not possible to serialize the context state, though it is a feature I would very much like to add to the library. It will probably be a while before I can get to it though.

I suggest you instead write your scripts to be event based, i.e. whenever the actor needs to act on an event a script function is called to perform something and then immediately returns. The state would be stored in an object, rather than in the context. That way you will not have to worry about long running scripts that needs to be saved in the middle of the progress.





Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!