Pieces to the Puzzle
1. Make the UI in LavishGUI
2. Make the Atoms to build the lists (Combo box and List box)
3. Load and Save your LavishSettings
4. Upload Abilities to Combo Box, Load Your List to the UI
5. Make a routine to Execute the abilities
First lets start with your Lavish GUI
Next you need Make the Atoms.. BuildCombatMeleeSequence RemoveCombatMeleeSequence AddCombatMeleeSequence
Those atoms just asked LavishSettings to find CombatMeleeSequence. We have to make that in the main script. First you Load it..and make sure when you exit you save it to some kind of file
Dont forget to actually tell the script to put your abilities in the combo box.
Ok Lastly make a routine to loop through the abilities and do them
Stuff your missing... Your missing all the organization of the script. This is just a sample of how to do this task for those that already have some simple scripts and want to learn the basics for dealign with combo boxes and list items. You are also missing my actual combat routines, which execute abilities and check for interupts and all that crazy stuff. Let me know if i left out anything. Hope this helps someone.
1. Make the UI in LavishGUI
2. Make the Atoms to build the lists (Combo box and List box)
3. Load and Save your LavishSettings
4. Upload Abilities to Combo Box, Load Your List to the UI
5. Make a routine to Execute the abilities
First lets start with your Lavish GUI
Code:
<checkbox Name='doCombatMeleeSequencechk' Template='VG.BlueCheckbox'>
<visible>4</visible>
<X>13</X>
<Y>120</Y>
<Width>15</Width>
<Height>20</Height>
<Text>Combat Melee Seq.</Text>
<OnLoad>
if ${Script[vga].VariableScope.doCombatSeqMelee}
{
This:SetChecked
}
</OnLoad>
<OnLeftClick>
Script[vga].VariableScope.doCombatSeqMelee:Set[${This.Checked}]
</OnLeftClick>
</checkbox>
<ComboBox Name="CombatMeleeSequenceCombo" Template="VG.ComboBox">
<X>145</X>
<Y>122</Y>
<Width>240</Width>
<Height>20</Height>
<OnLoad>
This:AddItem[NONE]
</OnLoad>
<OnSelect>
if ${This.SelectedItem.Text(exists)}
{
AddCombatMeleeSequence "${This.SelectedItem.Text}"
BuildCombatMeleeSequence
}
</OnSelect>
</ComboBox>
<Listbox Name="CombatMeleeSequenceList" Template="VG.ListBox">
<X>13</X>
<Y>146</Y>
<Width>95%</Width>
<Height>80</Height>
<AutoSort>TRUE</AutoSort>
<Sort>User</Sort>
<OnLoad>
BuildCombatMeleeSequence
</OnLoad>
<OnRightClick>
RemoveCombatMeleeSequence "${This.SelectedItem}"
This.SelectedItem:Remove
BuildCombatMeleeSequence
</OnRightClick>
</Listbox>
Code:
;********************************************
/* Add item to the CombatSeqMelee list */
;********************************************
atom(global) AddCombatMeleeSequence(string aName)
{
if ( ${aName.Length} > 1 )
{
If ${LavishSettings[VGA].FindSet[CombatMeleeSequence].FindSetting[${aName} (3)](exists)}
LavishSettings[VGA].FindSet[CombatMeleeSequence]:AddSetting[${aName} (4), ${aName}]
If ${LavishSettings[VGA].FindSet[CombatMeleeSequence].FindSetting[${aName} (2)](exists)}
LavishSettings[VGA].FindSet[CombatMeleeSequence]:AddSetting[${aName} (3), ${aName}]
If ${LavishSettings[VGA].FindSet[CombatMeleeSequence].FindSetting[${aName}](exists)}
LavishSettings[VGA].FindSet[CombatMeleeSequence]:AddSetting[${aName} (2), ${aName}]
LavishSettings[VGA].FindSet[CombatMeleeSequence]:AddSetting[${aName}, ${aName}]
}
else
{
return
}
}
atom(global) RemoveCombatMeleeSequence(string aName)
{
if ( ${aName.Length} > 1 )
{
CombatMeleeSequence.FindSetting[${aName}]:Remove
}
else
{
}
}
atom(global) BuildCombatMeleeSequence()
{
variable iterator Iterator
CombatMeleeSequence:GetSettingIterator[Iterator]
UIElement[CombatMeleeSequenceList@MeleeCFrm@Melee@CombatSubTab@CombatFrm@Combat@ABot@vga_gui]:ClearItems
while ( ${Iterator.Key(exists)} )
{
UIElement[CombatMeleeSequenceList@MeleeCFrm@Melee@CombatSubTab@CombatFrm@Combat@ABot@vga_gui]:AddItem[${Iterator.Key}]
Iterator:Next
}
}
Code:
variable settingsetref CombatMeleeSequence
variable bool doCombatMeleeSequence
function LoadLS()
{
LavishSettings[VGA]:Clear
LavishSettings:AddSet[VGA]
LavishSettings[VGA]:AddSet[CombatMeleeSequence]
CombatMeleeSequence:Set[${LavishSettings[VGA].FindSet[CombatMeleeSequence]}]
call PopulateMeleeLists
}
function SaveLS()
{
LavishSettings[VGA]:Export[${LavishScript.CurrentDirectory}/scripts/VGA/Save/${Me.FName}.xml]
}
Code:
Function PopulateMeleeLists()
{
variable int i
for (i:Set[1] ; ${i}<=${Me.Ability} ; i:Inc)
{
if ${Me.Ability[${i}].Type.Equal[Combat Art]} || ${Me.Ability[${i}].Type.Equal[Combat Art]}
{
UIElement[CombatMeleeSequenceCombo@MeleeCFrm@Melee@CombatSubTab@CombatFrm@Combat@ABot@vga_gui]:AddItem[${Me.Ability[${i}].Name}]
}
}
variable iterator Iterator
OpeningMeleeSequence:GetSettingIterator[Iterator]
UIElement[CombatMeleeSequenceList@MeleeCFrm@Melee@CombatSubTab@CombatFrm@Combat@ABot@vga_gui]:ClearItems
while ( ${Iterator.Key(exists)} )
{
UIElement[CombatMeleeSequenceList@MeleeCFrm@Melee@CombatSubTab@CombatFrm@Combat@ABot@vga_gui]:AddItem[${Iterator.Key}]
Iterator:Next
}
Code:
function CombatMeleeSequence()
{
debuglog "Running Combat Melee Sequence"
if !${newattack} && ${doCombatSeqSpell} && ${fight.ShouldIAttack} && ${Me.TargetHealth} < ${AssistBattlePct} && ${Me.TargetHealth} > 0
{
call TooClose
variable iterator Iterator
CombatMeleeSequence:GetSettingIterator[Iterator]
while ( ${Iterator.Key(exists)} )
{
call checkabilitytocast "${Iterator.Value}"
if ${Return} && ${Me.Ability[${Iterator.Value}].IsReady} && ${fight.ShouldIAttack}
{
call executeability "${Iterator.Value}" "attack"
call checkcriticals
}
Iterator:Next
if !${fight.ShouldIAttack}
return
}
}
return
}
Last edited: