Thinking on the Future - Re: JS Engine, Global Scripts, and More!

Want to discuss changes to the UOX3 source code? Got a code-snippet you'd like to post? Anything related to coding/programming goes here!
Post Reply
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Thinking on the Future - Re: JS Engine, Global Scripts, and More!

Post by giwo »

So I implemented mapping an item type to a script, which seems to work out well.

Next up on the road to making skills run via JS is pushing out the SkillUse functions to JS.

This brought to mind a possible problem...

Now technically, I can use a global script to overload the SkillUse function and thus allow accessability via JS. However, this seems wonky to me. If I follow the system properly, a global script is one with an ID of 0, which basically just means that all objects which have their default script trigger will use it.

What happens with objects that don't have the defaut (IE we've set a script trigger). Unless I've missed something, these objects would not be able to run global scripts, rather they would be confined to the single script trigger we've assigned them.

Now assuming I haven't missed something, there are some possible ways to fix this problem. Namely adding a vector of script triggers which would store all those we have set on an object, every object would have at least one entry (0, or default) and then it would proceed from there. The tricky thing is prioritization, which could possibly be done just by order. Load in the entrys keeping them in order and then process the vector backwards until we reach the beginning when trying to find an SE overloaded function.

Currently I'm considering adding a system like how we overload commands and magic for overloading the SkillUse on a global basis, but this situation still applies to any script we may decide to make global, as well as customizing individual objects.

Thoughts, ideas, or corrections to this are more than welcome.
Scott
Post Reply