I was messing around with add-on development, and think I might have a functional one that issues a /lockstyle on upon zone change. I might try to integrate it with spellcast to look for a particular vanity set before applying lockstyle.

Any interest in an auto /lockstyle on addon?
#1

Posted 24 March 2014 - 08:38 PM
#2

Posted 25 March 2014 - 12:45 PM
Woot! I got it working
It will detect a zone change, use a vanity set (if you enable it in the settings), turn lock style on, swap back to idle set.
I do have some coding questions, I'm not convinced just adding @waits to make sure enough time has passed after zoing is the best way to do this. Also is there a better way to integrate with spellcast from an addon? Any more experienced developers who might be able to help, that would be great. I LOVE this API, so easy to work with, this is the first time I've done any programming with lua also, and digging that as well.
-- Setup require('luau') require('logger') _addon = _addon or {} _addon.name = 'Stylish' _addon.author = 'tarutarupanic' _addon.command = 'sty' _addon.commands = {} _addon.version = '1.0.0.0' defaults = {} defaults.usesets = false settings = config.load(defaults) -- Currently trying to set style try = false function reset() try = false end -- Style handler windower.register_event('Zone change', function(old, new) try = true try_style() end) function try_style() log(settings.usesets) if try then if settings.usesets then windower.send_command('@wait 9; input //sc set van') end windower.send_command('@wait 10; input /lockstyle on') if settings.usesets then windower.send_command('@wait 11; input //sc set idle') end reset() log('Lookin good!') end end -- Reset outstanding events windower.register_event('load', 'login', reset)
#3

Posted 25 March 2014 - 04:17 PM
I'm not sure about the delay, as /lockstyle is a pretty new command, I don't think many of us have experimented with it as of yet, best to just try what the minimum is that works for you, then add 2~3 seconds to that.
And unfortunately there's no better way to interact with SC, although you can shorten the commands a bit. Instead of "input //sc something" you can just do "sc something".
In general, you could shorten the addon by quite a bit, but that's up to you. If you want any advice with code like that you should hit us up on IRC, we're always happy to help there.
- tarutarupanic likes this
#4

Posted 25 March 2014 - 04:46 PM
Thanks! Will do.
#5

Posted 29 March 2014 - 07:49 PM
I think this is a great idea.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users