Converting to Ashita!

Discuss the development of Lua addons for Ashita v3 here.
Locked
Hana
Posts: 1
Joined: Tue May 29, 2018 4:29 pm

Converting to Ashita!

Post by Hana » Tue May 29, 2018 5:00 pm

I've been putting this off for way too long. I've wanted to make the conversion to Ashita for quite some time but having to fix some of my very generic addons was holding me back. I'm absolutely sick of Windower though and eager to learn and be a part of the Ashita community :D

First off I'm not exactly fluent in coding. Most of what I've created has been through learning by example of other addons and writing basic functions for what I needed. I'm looking through the Ashita wiki (http://ashita.atom0s.com/wiki2/doku.php?id=addons:adk) and I'm having difficulty figuring out how to properly change a couple of snippets of code.

1. Limiting actions to a specific zone.

Code: Select all

battle = S{
	291, -- Reisenjima
}

	function jp1()
		while (jp > 0) and battle:contains(windower.ffxi.get_info().zone) do
			windower.send_command('pause 2;input /item "Capacity Ring" <me>;pause 5;input /ja "Spectral Jig" <me>;')
			coroutine.sleep(60)
		end
		if not battle:contains(windower.ffxi.get_info().zone) then
			jp = 0
		end
	end

	windower.register_event('addon command', function(command)
		if command == 'jp' then
			jp = 1 do
				jp1()
			end
		end
	end)	
I'm not sure why but the formatting appears a bit weird when pasted into code display. I promise it's more organized on my screen lol

2. Chat based reactions. Edit: Nevermind! I discovered OnEvent can use .txt files for multiple commands to react to, fantastic! :)

I've found examples of using packets to identify a zone but packets are an entirely new world to me. Though again I'm willing to learn. I searched for files within the Ashita\resources\ folder but oddly the folder is empty.

So in short I'm mainly looking to figure out how to limit things to specific zones and then input a command. In the meantime I'll keep looking for examples of code and try to learn off those but I certainly appreciate any help!
User avatar
atom0s
Site Admin
Posts: 457
Joined: Sat May 14, 2016 5:13 pm

Re: Converting to Ashita!

Post by atom0s » Tue May 29, 2018 6:07 pm

You can get your own zone id via:

Code: Select all

local zone = AshitaCore:GetDataManager():GetParty():GetMemberZone(0);
Then adjust the table/list stuff from windower to just a normal table object and check if it contains the value.
Lead Ashita Developer

Want to donate to say thanks?
https://www.paypal.me/atom0s
Sinnersslayer
Posts: 60
Joined: Thu Jan 25, 2018 6:48 am

Re: Converting to Ashita!

Post by Sinnersslayer » Mon Jun 04, 2018 5:12 am

Welcome aboard!
Hoping for some cool ports from Windower :)
Locked