View Single Post
  #34  
Unread 02-05-2009, 02:54 AM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Default

I see what gm9 is getting at about reducing the used code. I did a similar include/config file with my Statbar and used a Top-Level-of-tree-located button, which gets pressed instead of repeated the same long amount of code multiple times.


To pass on the number, you can simply make a custom value on the button itself called something like "iPassedNum" or something shorter...

First set that number.
Then press the button. Have the onPress code in the button be the code you already have used a bunch of times, using the number value in the string (use the concatenated stuff... ##)

You could get fancy with your config.
Maybe use a Data object:
Code:
<Data Name="1" SpellName="Tyrannical Mind"/>
<Data Name="2" SpellName="Spell Lash"/>
<Data Name="3" SpellName="Haruspex"/>
<Data Name="4" SpellName="NULL"/>
<Data Name="5" SpellName="NULL"/>
<Data Name="6" SpellName="NULL"/>
<Data Name="7" SpellName="NULL"/>
<Data Name="8" SpellName="NULL"/>
<Data Name="9" SpellName="NULL"/>
<Data Name="10" SpellName="NULL"/>
The check in the button:
Code:
1a=(Text == DataPage.1.SpellName)
2b=(Text == DataPage.2.SpellName)
3c=(Text == DataPage.3.SpellName)
4d=(Text == DataPage.4.SpellName)
5e=(Text == DataPage.5.SpellName)
6f=(Text == DataPage.6.SpellName)
7g=(Text == DataPage.7.SpellName)
8h=(Text == DataPage.8.SpellName)
9i=(Text == DataPage.9.SpellName)
10j=(Text == DataPage.10.SpellName)
COND=1a || 2b || 3c || 4d || 5e || 6f || 7g || 8h || 9i || 10j
As you can see.. you could get fancy, making it much easier to modify for different classes, and save some coding in the end when the list of buffs you're check gets longer... Especially if you did something like loaded it by your subclass or something spiffy for big config files

Please excuse any coding type-o's/mistakes, lol
__________________
"I'm afraid you're guilty of thought-crime. Don't bother getting the door, we'll let ourselves in..."
<Donate to DrumsUI> < [DrumsUI] Updater > < [DrumsUI] Full Interface> < Drumstix42 on Twitch.tv
>

Last edited by Drumstix42 : 02-05-2009 at 03:13 AM.
Reply With Quote