Jump to content

Lua support with mangos.


Guest Terrorblade__

Recommended Posts

It does not really matter what scripting language it is. I think having a scripting variant which does not need compilation of the scripts just is a psychological thing. It simply feels simpler. Doesn't mean it would be better, but it feel better for many people apparently. :-)
(like scripts which don't update every tick)

Lua ofc needs to be compiled before it can be executed. This process can, however, stay out of user's attention, on script reload for example.

For simple tasks, dofile is handy, as it does the whole job in one call. However, loadfile is more flexible. In case of errors, loadfile returns nil plus the error message, which allows us to handle the error in customized ways. Moreover, if we need to run a file several times, we can call loadfile once and call its result several times. This is much cheaper than several calls to dofile, because the program compiles the file only once.
Link to comment
Share on other sites

Besides, it's pretty easy to make just because of how much code there is to steal out there. ^_^

Haha. I definitely think it would spark more enthusiasm among people contributing scripts as i think people are scared of the phrase 'C++ Scripting' :D

I'm not to sure how or what but maybe even added development on EventAI would be a better step than going with LUA. Ofc its entirly upto the person what they want to do.

Lua ofc needs to be compiled before it can be executed. This process can, however, stay out of user's attention, on script reload for example.

Another plus to EventAI :P (But that depends on the job at hand as we know EventAI can only handle certain things)

Link to comment
Share on other sites

Personally, I try to stay away from EventAI as much as possible. It's complicated, it's hard to edit manually, and most of all it's hard to maintain because of frequent updates. Perhaps if someone wrote a very good EventAI editor (maybe mangos should make/include an official one in /contrib?) it would be much better.

Besides, still very much you can't do in EventAI that you can in C++ or some other programming/scripting language (using logic, making functions, checking server stuff, gossip scripting, etc.)

How would reloading work anyways? Just unload all scripts and divert script calls until new scripts are loaded and ready? Why doesn't SD2 support reloading yet? (it would still be useful for people like windows users who can actually use it as a DLL)

Link to comment
Share on other sites

Why doesn't SD2 support reloading yet? (it would still be useful for people like windows users who can actually use it as a DLL)
Problem with reload has been created when AI objects has been added to script DLL...

This is not easy reload like objects in all world (created at DLL side and expecting some state save).

Link to comment
Share on other sites

Problem with reload has been created when AI objects has been added to script DLL...

This is not easy reload like objects in all world (created at DLL side and expecting some state save).

So, when GetAI is called, it returns an entire class? (or pointer to one?) So is it even possible to reload C++ scripts? What about non-AI scripts, they should be reloadable right?

Link to comment
Share on other sites

What about keeping the scripts in the database? That works just great if you look at MaNGOS' scripting possibilties one year before. The list of scripting commands and events should be extended a bit, but even Blizzard must have some limits in scripting.

We began to use database scripts like EventAI. Why not keeping it up like that?

(Please correct me if I made any language mistakes ;))

Link to comment
Share on other sites

What about keeping the scripts in the database? That works just great if you look at MaNGOS' scripting possibilties one year before. The list of scripting commands and events should be extended a bit, but even Blizzard must have some limits in scripting.

We began to use database scripts like EventAI. Why not keeping it up like that?

(Please correct me if I made any language mistakes ;))

Main problem is what you can and can't do with a database. It will never be as fulfilling and easy as a programming or scripting language.

Link to comment
Share on other sites

when ic compile the mangos core with lua from the lus svn in the first post, i get these errors

mangos\\src\\framework\\Platform/Define.h(24) : fatal error C1083: file (Include) can't open:"ace/Basic_Types.h": No such file or directory

Link to comment
Share on other sites

when ic compile the mangos core with lua from the lus svn in the first post, i get these errors

mangos\\src\\framework\\Platform/Define.h(24) : fatal error C1083: file (Include) can't open:"ace/Basic_Types.h": No such file or directory

Given that it is from before they moved to the now-dead mangosscript.org, you probably aren't going to have much luck.

Link to comment
Share on other sites

Script bindings have seen a few changes, but the old Lua bindings can be updated for current revisions. Just follow the old SourceForge SVN log to see what changed in bindings, and and then continue with github logs. Will be a bit of work, but it's possible.

Link to comment
Share on other sites

All C++ scripts compiled in single DLL and then impossibnle reload DLL if in it used at least one AI object for some creature.
What is wrong with just looping all creatures in the world, checking the AI for each and changing / resetting accordingly ? Just because it's not impemented yet doesn't mean it's impossible ..
Link to comment
Share on other sites

What is wrong with just looping all creatures in the world, checking the AI for each and changing / resetting accordingly ? Just because it's not impemented yet doesn't mean it's impossible ..

Or perhaps, when reloading, temporarily change all AIs to the default AI and then switching back to scripted AI when scripts reloaded.

Link to comment
Share on other sites

  • 2 weeks later...
What is wrong with just looping all creatures in the world, checking the AI for each and changing / resetting accordingly ? Just because it's not impemented yet doesn't mean it's impossible ..

Possible, but need way proper reset creature state in like case or way store and restore state. Ofc, this can be possible and just not implemented. But wrong show it as easy loop by creatures ;)

Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use