Item Search
     
BG-Wiki Search
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Old Merits
    Join Date
    Nov 2015
    Posts
    1,181
    BG Level
    6
    FFXI Server
    Asura
    WoW Realm
    Cho'gall

    Making a New Addon: Looking for LUA for Windower documentation help

    So.. A couple lsmates and I are working on making an addon which simplifies/unifies BLM nukes to single commands.
    Spoiler: show
    TBH, it's more like I explained what I wanted to do a few days ago, and they took off running with the idea.^^;;


    The basics:
    1) Set element mode by direct command or cycling thru elements.
    2) Addon command like.. "//nuke3" casts a T3 nuke of the current element. Will also have aoe versions like "//nukega2" which does the same for aoe nukes.

    The other guys working on this are professional programmers, but aren't too familiar with the LUA language, so we have that much running, but we've run into a snag. We'd like to include the functionality from a GS include that I made which handles spell degradation, (bumps your cast down a tier if the one you call for is on cooldown or you don't have enough MP to cast it,) but none of us are familiar enough w/ the language to easily convert GS code > addon code. Are there any good resources/documentation on how to do so? How much of GS syntax is tied directly to GS and is going to be difficult to replicate as a stand-alone addon?

    I know that we could just include the include file with instructions on how to use it, but this has become a learning experience for us and want to know how to do what we want to do. ^^

  2. #2
    BG Content
    Join Date
    Jul 2007
    Posts
    21,105
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    GS code is add-on code. There are limited differences (GS manages some exposed tables like "player".)

    Where are you having trouble specifically?

  3. #3
    Old Merits
    Join Date
    Nov 2015
    Posts
    1,181
    BG Level
    6
    FFXI Server
    Asura
    WoW Realm
    Cho'gall

    Quote Originally Posted by Byrthnoth View Post
    GS code is add-on code. There are limited differences (GS manages some exposed tables like "player".)

    Where are you having trouble specifically?
    Probably the biggest question at the moment is how to hook into pre-target, since we have to change the spell based on cooldowns and/or current player MP before it gets sent to the client, and want to do it in a way that we know does not conflict w/ GS or Shortcuts. One of the main guys on this said he already had those functions working before he had to go out of town and poofed before sharing what he had (lol orz,) so I figured it would be a good idea to ask if there were any solid resources to help what we are trying to do before he gets back.

  4. #4
    The Shitlord
    Join Date
    Feb 2008
    Posts
    11,366
    BG Level
    9
    FFXIV Character
    Kharo Hadakkus
    FFXIV Server
    Hyperion
    FFXI Server
    Sylph
    WoW Realm
    Rivendare

    pretty sure if you take a look at motenten's job library, specifically the refine.waltz or .mode functions, gearswap is already capable of almost all of what you're looking to do. you'd just need to set up a windower shortcut so that //nuke3 became translated into gs c nuke3, then tie your refine or mode function to that. i've been working on something similar, but my shortcut is an in-game macro. my code knowledge is extremely rudimentary, mind you, so this is pretty primitive.


    Motenten's library: https://github.com/Kinematics/GearSwap-Jobs


    my primitive version of something similar:


    first, in user_setup:

    Code:
    send_command('bind f11 gs c cycle CastingMode')
    
    
    
    state.CastingMode:options('Normal', 'Fire', 'Ice', 'Wind', 'Water', 'Earth', 'Thunder')
    then later, in job_self_command:
    Code:
    elseif cmdParams[1] == 'eleSP_exec' then
            if state.CastingMode.value == 'Normal' then
                send_command('input /echo "Casting Mode: Normal - No Element Selected')
            elseif state.CastingMode.value == 'Fire' then
                send_command('input /ma "Fire VI" <t>')
                send_command('input /ma "Fire V" <t>')
                send_command('input /ma "Fire IV" <t>')
                send_command('input /ma "Fire III" <t>')
                send_command('input /ma "Fire II" <t>')
                send_command('input /ma "Fire" <t>')
            elseif state.CastingMode.value == 'Water' then
                send_command('input /ma "Water VI" <t>')
                send_command('input /ma "Water V" <t>')
                send_command('input /ma "Water IV" <t>')
                send_command('input /ma "Water III" <t>')
                send_command('input /ma "Water II" <t>')
                send_command('input /ma "Water" <t>')
            elseif state.CastingMode.value == 'Thunder' then
                send_command('input /ma "Thunder VI" <t>')
                send_command('input /ma "Thunder V" <t>')
                send_command('input /ma "Thunder IV" <t>')
                send_command('input /ma "Thunder III" <t>')
                send_command('input /ma "Thunder II" <t>')
                send_command('input /ma "Thunder" <t>')
            elseif state.CastingMode.value == 'Earth' then
                send_command('input /ma "Stone VI" <t>')
                send_command('input /ma "Stone V" <t>')
                send_command('input /ma "Stone IV" <t>')
                send_command('input /ma "Stone III" <t>')
                send_command('input /ma "Stone II" <t>')
                send_command('input /ma "Stone" <t>')
            elseif state.CastingMode.value == 'Wind' then
                send_command('input /ma "Aero VI" <t>')
                send_command('input /ma "Aero V" <t>')
                send_command('input /ma "Aero IV" <t>')
                send_command('input /ma "Aero III" <t>')
                send_command('input /ma "Aero II" <t>')
                send_command('input /ma "Aero" <t>')
            elseif state.CastingMode.value == 'Ice' then
                send_command('input /ma "Blizzard VI" <t>')
                send_command('input /ma "Blizzard V" <t>')
                send_command('input /ma "Blizzard IV" <t>')
                send_command('input /ma "Blizzard III" <t>')
                send_command('input /ma "Blizzard II" <t>')
                send_command('input /ma "Blizzard" <t>')
            else
                select_default_macro_book()
            end
        elseif cmdParams[1] == 'barSP_exec' then
            if state.CastingMode.value == 'Normal' then
                send_command('input /echo "Casting Mode: Normal - No Element Selected')
            elseif state.CastingMode.value == 'Fire' then
                if player.main_job == 'WHM' or
                player.sub_job == 'WHM' then
                    send_command('input /ma "Barfira" <me>')
                elseif player.main_job == 'RDM' or
                player.sub_job == 'RDM' or
                player.main_job == 'RUN' or
                player.sub_job == 'RUN' then
                    send_command('input /ma "Barfire" <me>')
                else
                    select_default_macro_book()
                end
            elseif state.CastingMode.value == 'Water' then
                if player.main_job == 'WHM' or
                player.sub_job == 'WHM' then
                    send_command('input /ma "Barwatera" <me>')
                elseif player.main_job == 'RDM' or
                player.sub_job == 'RDM' or
                player.main_job == 'RUN' or
                player.sub_job == 'RUN' then
                    send_command('input /ma "Barwater" <me>')
                else
                    select_default_macro_book()
                end
            elseif state.CastingMode.value == 'Thunder' then
                if player.main_job == 'WHM' or
                player.sub_job == 'WHM' then
                    send_command('input /ma "Barthundra" <me>')
                elseif player.main_job == 'RDM' or
                player.sub_job == 'RDM' or
                player.main_job == 'RUN' or
                player.sub_job == 'RUN' then
                    send_command('input /ma "Barthunder" <me>')
                else
                    select_default_macro_book()
                end
            elseif state.CastingMode.value == 'Earth' then
                if player.main_job == 'WHM' or
                player.sub_job == 'WHM' then
                    send_command('input /ma "Barstonra" <me>')
                elseif player.main_job == 'RDM' or
                player.sub_job == 'RDM' or
                player.main_job == 'RUN' or
                player.sub_job == 'RUN' then
                    send_command('input /ma "Barstone" <me>')
                else
                    select_default_macro_book()
                end
            elseif state.CastingMode.value == 'Wind' then
                if player.main_job == 'WHM' or
                player.sub_job == 'WHM' then
                    send_command('input /ma "Baraera" <me>')
                elseif player.main_job == 'RDM' or
                player.sub_job == 'RDM' or
                player.main_job == 'RUN' or
                player.sub_job == 'RUN' then
                    send_command('input /ma "Baraero" <me>')
                else
                    select_default_macro_book()
                end
            elseif state.CastingMode.value == 'Ice' then
                if player.main_job == 'WHM' or
                player.sub_job == 'WHM' then
                    send_command('input /ma "Barblizzara" <me>')
                elseif player.main_job == 'RDM' or
                player.sub_job == 'RDM' or
                player.main_job == 'RUN' or
                player.sub_job == 'RUN' then
                    send_command('input /ma "Barblizzard" <me>')
                else
                    select_default_macro_book()
                end
            else
                select_default_macro_book()
            end
        elseif cmdParams[1] == 'enSP_exec' then
            if state.CastingMode.value == 'Normal' then
                if player.main_job == 'PLD' then
                    send_command('input /ma "Enlight II" <me>')
                    send_command('input /ma "Enlight" <me>')
                elseif player.main_job == 'DRK' then
                    send_command('input /ma "Endark II" <me>')
                    send_command('input /ma "Endark" <me>')
                else
                    send_command('input /echo "Casting Mode: Normal - No Element Selected')
                end
            elseif state.CastingMode.value == 'Fire' then
                send_command('input /ma "Enfire" <me>')
            elseif state.CastingMode.value == 'Water' then
                send_command('input /ma "Enwater" <me>')
            elseif state.CastingMode.value == 'Thunder' then
                send_command('input /ma "Enthunder" <me>')
            elseif state.CastingMode.value == 'Earth' then
                send_command('input /ma "Enstone" <me>')
            elseif state.CastingMode.value == 'Wind' then
                send_command('input /ma "Enaero" <me>')
            elseif state.CastingMode.value == 'Ice' then
                send_command('input /ma "Enblizzard" <me>')
            else
                select_default_macro_book()
            end
        elseif cmdParams[1] == 'eleNIN_exec' then
            if state.CastingMode.value == 'Normal' then
                send_command('gs c set CastingMode Fire')
            elseif state.CastingMode.value == 'Fire' then
                send_command('input /ma "Katon: Ni" <t>')
                send_command('input /ma "Katon: Ichi" <t>')
                send_command('gs c set CastingMode Water')
            elseif state.CastingMode.value == 'Water' then
                send_command('input /ma "Suiton: Ni" <t>')
                send_command('input /ma "Suiton: Ichi" <t>')
                send_command('gs c set CastingMode Thunder')
            elseif state.CastingMode.value == 'Thunder' then
                send_command('input /ma "Raiton: Ni" <t>')
                send_command('input /ma "Raiton: Ichi" <t>')
                send_command('gs c set CastingMode Thunder')
            elseif state.CastingMode.value == 'Earth' then
                send_command('input /ma "Doton: Ni" <t>')
                send_command('input /ma "Doton: Ichi" <t>')
                send_command('gs c set CastingMode Wind')
            elseif state.CastingMode.value == 'Wind' then
                send_command('input /ma "Huton: Ni" <t>')
                send_command('input /ma "Huton: Ichi" <t>')
                send_command('gs c set CastingMode Ice')
            elseif state.CastingMode.value == 'Ice' then
                send_command('input /ma "Hyoton: Ni" <t>')
                send_command('input /ma "Hyoton: Ichi" <t>')
                send_command('gs c set CastingMode Fire')
            else
                select_default_macro_book()
            end
        elseif cmdParams[1] == 'spikeSP_exec' then
            if state.CastingMode.value == 'Normal' then
                send_command('input /echo "Casting Mode: Normal - No Element Selected')
            elseif state.CastingMode.value == 'Fire' then
                send_command('input /ma "Blaze Spikes" <me>')
            elseif state.CastingMode.value == 'Water' then
                send_command('input /echo "Casting Mode: Water - No Spikes Available')
            elseif state.CastingMode.value == 'Thunder' then
                send_command('input /ma "Shock Spikes" <me>')
            elseif state.CastingMode.value == 'Earth' then
                send_command('input /echo "Casting Mode: Earth - No Spikes Available')
            elseif state.CastingMode.value == 'Wind' then
                send_command('input /echo "Casting Mode: Wind - No Spikes Available')
            elseif state.CastingMode.value == 'Ice' then
                send_command('input /ma "Ice Spikes" <me>')
            else
                select_default_macro_book()
            end
        end
    combined with the appropriate in-game macro ('/console gs c eleSP_exec', etc.) that means i just set my elemental stance with f11 and then push one button for spikes, one for nukes, one for enspells, one for barspells, and it always casts the element that matches the stance im in.

    i haven't delved into the refine function much, so right now i'm just brute forcing it to automatically cast the highest tier i can. though i haven't had a chance to test the tier part; it worked when i only knew tier 1 spells.

  5. #5
    The Shitlord
    Join Date
    Feb 2008
    Posts
    11,366
    BG Level
    9
    FFXIV Character
    Kharo Hadakkus
    FFXIV Server
    Hyperion
    FFXI Server
    Sylph
    WoW Realm
    Rivendare

    oh, and as far as the targeting thing, i haven't found a way to actually make use of this, but this particular function (which i've got commented out) might interest you. it's from motenten's samurai script.

    Code:
    -- Set eventArgs.handled to true if we don't want any automatic target handling to be done.
    --function job_pretarget(spell, action, spellMap, eventArgs)
    --    if spell.type == 'WeaponSkill' then
    --        -- Change any GK weaponskills to polearm weaponskill if we're using a polearm.
    --        if player.equipment.main=='Quint Spear' or player.equipment.main=='Quint Spear' then
    --            if spell.english:startswith("Tachi:") then
    --                send_command('@input /ws "Penta Thrust" '..spell.target.raw)
    --                eventArgs.cancel = true
    --            end
    --        end
    --    end
     --end
    Edit: re-reading your post, definitely check out the refine function. i've struggled to wrap my head around it, but someone with more experience could probably easily adapt it to work the way you're wanting to calculate available MP and stuff.


    Also, the resources I've been using to learn this as I go:

    http://docs.windower.net/

    https://github.com/Kinematics/GearSwap-Jobs/wiki


    http://supernovaffxi.wikia.com/wiki/...arSwap_Lessons


    https://www.ffxiah.com/node/145


    https://github.com/Kinematics/GearSwap-Jobs


    and heavy reliance on help from the gearswap help thread. specifically, dlsmd.

  6. #6
    BG Content
    Join Date
    Jul 2007
    Posts
    21,105
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Quote Originally Posted by Nyarlko View Post
    Probably the biggest question at the moment is how to hook into pre-target, since we have to change the spell based on cooldowns and/or current player MP before it gets sent to the client, and want to do it in a way that we know does not conflict w/ GS or Shortcuts. One of the main guys on this said he already had those functions working before he had to go out of town and poofed before sharing what he had (lol orz,) so I figured it would be a good idea to ask if there were any solid resources to help what we are trying to do before he gets back.
    If you just want //nuke3 to translate to /ma "Thunder III" <t>, you don't need to do anything with gearswap at all. //nuke3 is not a valid command, so GearSwap and Shortcuts won't parse it.

    Actually, if you just use "//alias nuke thunder" and have shortcuts loaded, the rest should work itself out. //nuke3 would turn into //thunder3 and shortcuts would make /ma "Thunder III" <t>.

    I am not sure you actually need an addon for this.

  7. #7
    Old Merits
    Join Date
    Nov 2015
    Posts
    1,181
    BG Level
    6
    FFXI Server
    Asura
    WoW Realm
    Cho'gall

    Quote Originally Posted by Byrthnoth View Post
    If you just want //nuke3 to translate to /ma "Thunder III" <t>, you don't need to do anything with gearswap at all. //nuke3 is not a valid command, so GearSwap and Shortcuts won't parse it.

    Actually, if you just use "//alias nuke thunder" and have shortcuts loaded, the rest should work itself out. //nuke3 would turn into //thunder3 and shortcuts would make /ma "Thunder III" <t>.

    I am not sure you actually need an addon for this.
    A large part of the project is the learning aspect. I haven't messed w/ anything but GS really, and they haven't even done that much with LUA yet. We all see this as a chance to learn how to do this sort of stuff ourselves. The other part is just wanting to have the element selection, tier selection and degrade functions working as a stand alone addon, preferably w/o any dependencies on any other addons. As I said, I already have the spell degrade working in GS. I know that I could add the element mode thing to my include file. What we want is to make it work without GS. XD

  8. #8
    The Shitlord
    Join Date
    Feb 2008
    Posts
    11,366
    BG Level
    9
    FFXIV Character
    Kharo Hadakkus
    FFXIV Server
    Hyperion
    FFXI Server
    Sylph
    WoW Realm
    Rivendare

    sorry i misunderstood; i thought you were still working out the gearswap part. still, hopefully some of that might be useful as an example/template, if nothing else.

  9. #9
    Old Merits
    Join Date
    Nov 2015
    Posts
    1,181
    BG Level
    6
    FFXI Server
    Asura
    WoW Realm
    Cho'gall

    Quote Originally Posted by BaneTheBrawler View Post
    sorry i misunderstood; i thought you were still working out the gearswap part. still, hopefully some of that might be useful as an example/template, if nothing else.
    Appreciate it. ^^

Similar Threads

  1. New shell looking for advice on Hidesvini
    By Leroy in forum FFXI: Everything
    Replies: 7
    Last Post: 2009-04-27, 10:57
  2. Starting a new linkshell looking for advice
    By Joeyp in forum FFXI: Everything
    Replies: 24
    Last Post: 2008-08-20, 03:35
  3. Downloading FFXI for PC, need windower/yarnball help
    By Saitoe in forum FFXI: Everything
    Replies: 5
    Last Post: 2007-12-26, 17:18