## Recommended Posts

Hey As I guess lots of us do here, I use AngelScript for scripting behaviours of stuff in a game engine. This often involves a lot of tweaking of scripts, which normally means restarting the app to see stuff take effect. However, in my previous setup I made a system that could reload the scripts and dynamically rebind any script functions on the fly. This, however, was based on the fact that it was just functions. No scripts had any data of their own; everything was stored in an owning game entity. Now, with the advent of script classes, I've rewritten it so that a game entity has an instance of a script class with members, so that the behaviour script easily can store entity specific data in its own members. That makes it easier to write stateful scripts. However, this also botches my reloading code totally. So... Basically... Before I start writing some new reloading stuff for my new setup, I thought I'd ask here if anyone has any thoughts, ideas or experiences about this? Any tips on what way to go? I guess the real problem is that I have to reinstantiate all existing instances script class instances, copy member data from the old ones (where it matches up), and then notify all events that they've got a new script class instance. It's of course doable just like that, but I'm wondering if there's any shortcuts... If there's something in AS that can help me out on the way? I'm thankful for any info that could be useful. Thanks /Anders Stenberg

##### Share on other sites
I think you'll have a lot of problems with incompatibilities between the script changes. I mean, if you have an instanced object with 3 attributes, and the new script version only declares 2, or 4. What will you do then?

Perhaps it is easier if you simply restart the level, and start the scripts from scratch?

##### Share on other sites
What's this 'script class' you speak of? My immense ego forces me to suspect you are using my wrapper library, but WL could have added something into AngelScript without me noticing...

##### Share on other sites
With script classes we mean classes declared in the scripts.

AngelScript:

class MyClass{  MyClass() {}          // default constructor  void DoSomething() {} // a method  int prop;             // property}

Don't tell me you didn't know AngelScript supports this already? [wink]

With the current version in the SVN, AngelScript also supports interfaces, which work much like C++'s abstract base classes, or Java's interfaces.

Regards,
Andreas

##### Share on other sites
I hear 'script class' I think 'class Script {}', not a class declared in a script.

##### Share on other sites
Quote:
 Original post by DeyjaWhat's this 'script class' you speak of? My immense ego forces me to suspect you are using my wrapper library, but WL could have added something into AngelScript without me noticing...

Hehe, no I'm not using your wrapper. As WL said, I meant a class defined in a script.

/Anders

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628402
• Total Posts
2982470

• 9
• 10
• 9
• 19
• 24