Trying to understand arrays

So, I've got a rudimentary idea of how to create a table within an alias, but I'm trying to figure out how to make it so once a trigger goes off, I'll go through each of the items on the table on balance and on eq. I do use svo, so I can take advantage of the queue system, but I'd really like to make it so it will do each until it actually works. ie: table would be like ^hyp1$ hyp1list = {confusion, stupidity, generousity, hypochondria} My initial trigger line would by a successful hypno, and it would do an autheticity check against my variable of doinghypno, that was set to true once I pressed my button to initiate hypnosis. However I don't really understand how to set up the rest so that it would pull each wanted affliction from the table. Any one able to tutor me on this?
 

Comments

  • NizarisNizaris The Holy City of Mhaldor
    edited January 2013
    In terms of "what works in combat" (TM) -- you don't want to automatically suggest new afflictions on regaining eq every time. Your opponent is going to notice the lull in the combat, realize that you are a serpent, conclude that you are starting a hypno chain, and then walk out of the room.

    Hypnosis is best used in one of the following two ways: before combat, while phased, to prep for jumping them, and two, in the middle of combat. When doing it in the middle of combat, you want to mix it in with dstabs.

    I suggest the following. Have your table be part of a script. Have your alias call a function of this script. Your alias is going to pick the first item off of the list, and suggest it. That way, you can have control over when you suggest a new affliction.

    To make it work, hrm.

    hypnoList = {}

    -- Called from alias ^hypno (.*)$
    -- Sets up hypnoList with full list of space-separated afflictions.
    function buildHypnoList( text )
    for affliction in string.gmatch(text, "%a+") do
    hypnoList.insert(affliction)
    end
    end

    -- Called from alias ^saff$
    -- Suggests first affliction in hypnoList.
    function suggestListedAff()
    send( "suggest " .. hypnoList[1] )
    enableTrigger("afflictionSuggestedTrigger")
    end

    -- Called from trigger on successful suggestion, named "afflictionSuggestedTrigger".
    -- Removes first affliction in hypnoList, so that next suggestion will pull next affliction.
    function afflictionSuggested()
    table.remove(hypnoList, 1)
    disableTrigger("afflictionSuggestedTrigger")
    end
    image
  • NizarisNizaris The Holy City of Mhaldor
    The above will allow you to pick and choose when you suggest, and when you continue with melee combat. It will also allow you to spam "saff" alias, so that you can chase eq/bal.
    image
  • Partly understand what you mean, excuse me for my denseness in regards to lua.  So first I would put this script into the script section, augmenting the part between the brackets of hypnolist = {} to be an array like so: { generosity, stupidity, etcetera}?
  • Ah wait, never mind, realization has dawned on me.

  • NizarisNizaris The Holy City of Mhaldor
    edited January 2013
    Just realized a slight bug in the above. Replace buildHypnoList() with the following:

    -- Called from alias ^hypno (.*)$
    -- Sets up hypnoList with full list of space-separated afflictions.
    function buildHypnoList( text )
    hypnoList = {}
    for affliction in string.gmatch(text, "%a+") do
    hypnoList.insert(affliction)
    end
    end

    This will reset the hypnoList each time that you call the associated alias. Without this small change, you will only add new afflictions on the end of an existing table. Probably not the best. This will clear it, and then reset it with new afflictions.
    image
  • NizarisNizaris The Holy City of Mhaldor
    You can also setup aliases that call a predetermined list of afflictions. Like so:

    alias ^hypno1$
    buildHypnoList( "confusion stupidity impatience" )

    alias ^hypno2$
    buildHypnoList( "epilepsy generosity" )

    etc ...

    image
  • Cool, thanks for all the help.
Sign In or Register to comment.