Jump to content

Alter scripts in runtime?


Recommended Posts

Well if you already did a change to "exec(blah)" you can run again "exec(blah)". That's it :D Even you can add a "note bloc" in-game and from there add new function and then run "exec(blah)"

For other stuff like "this" you can use "package". You can replace a function or "update" a function with new behaviour (disable/enable as needed).

Link to comment
Share on other sites

@jamesonj yes that would be pretty slow, and unnecessary, you only have to re-compile the scripts that has been edited.

Can you tell us what you're trying to accomplish? Perhaps we could help you out better if we knew you intentions.

There's actually a resource that will make scripts be re-compiled when you edit and save them. This can cause some issues however (saving a script mid-edit, accidentally triggering an infinite loop). But perhaps you could take advantage of that code.

PR of that feature, and discussion of the issues can be found here.

Link to comment
Share on other sites

I wanted modders to be able to open the game scripts during runtime, seeing the changes happen as they go. Like TAML works in T2D.

However, since it seems slow, and based on your help, i'm planning to create an in-game IDE: load a script, change and re-exec it.

Link to comment
Share on other sites

You could also use an external IDE and use this externalCommand to reload the script in the engine. Not 100% sure how that works, but maybe you can figure it out from there. At the very least, that would let you use Torsion and reload scripts "live".

Edit: apparently you just run the exe again with the arguments "externalCommand 1 path-to-script".

E.g: "Torque3D.exe externalCommand 1 server/main.cs" then it figures it out, quite strange.. But if it works!

Edit edit: also, why it's generally safer to do in TAML is because you can't write loops and functions in TAML, you can only write object definitions which is fairly safe :P

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...