Back to "util" tags

tranq's aspect switcher by tranq

Description: This is a script to automatically switch to the aspect you want with the press of a button/hotkey.

STEP 1: Get the main script

Copy the main script that I posted in the message after this one called AspectSwitcher and add it to your scripts. You can call it whatever you want, just remember the name and use that instead of AspectSwitcher in Step 2.

STEP 2: Create macro buttons for each aspect and slot

For each of the aspects you want to switch to, create an additional script that looks like the following:

;============ Script start

// set aspect category, 0 = weapon, 1 = spellbook, 2 = armor

setvar _aspectCategory 0

// set aspect type, see AspectSwitcher script at the top for list

setvar _aspectType 0

script AspectSwitcher

;============ Script end

Great, now give the script a name! For example, this one would switch to Air Weapon, so let's call it AirWeapon

Remember to change the name of AspectSwitcher to whatever you named the script when you copied it!

STEP 3: Create a macro button in CUO

So you set up a script for each aspect you want to switch to? Great! Now if you want to use a hotkey, you can assign one to each of the scripts created in step 2 directly. But if you want a macro button, go to Options -> Macros and create a new macro, give it the name you want to see on the button, select "say" and add in ">script NameOfYourScript". Do this for each one and you'll have a macro button for each, yay!

LIMITATIONS

Yes, there's one small caveat. The script can't tell the difference between weapon and spellbook text, so if you use spellbooks make sure to swap the weapon slot into an aspect you don't use and vice versa if you use a weapon. Otherwise it will find the matching text of the spellbook and will think it found it in weapon.

Enjoy!

1// CATEGORIES (set as _aspectCategory)
2// 0 = weapon
3// 1 = spellbook
4// 2 = armor
5
6// ASPECT IDs (set as _aspectType)
7// 0 = air
8// 1 = artisan
9// 2 = blood
10// 3 = command
11// 4 = death
12// 5 = discipline
13// 6 = earth
14// 7 = eldritch
15// 8 = fire
16// 9 = fortune
17// 10 = holy
18// 11 = lyric
19// 12 = poison
20// 13 = shadow
21// 14 = void
22// 15 = water
23
24if not varexist _aspectCategory
25    sysmsg "No aspect category set! Stopping." 56
26    stop
27endif
28
29if not varexist _aspectType
30    sysmsg "No aspect type set! Stopping." 56
31    stop
32endif
33
34say "[aspect"
35waitforgump 2424293173
36
37if _aspectCategory = 0
38    setvar! nextButton 5
39    setvar! activationButton 8
40elseif _aspectCategory = 1
41    setvar! nextButton 10
42    setvar! activationButton 13
43elseif _aspectCategory = 2
44    setvar! nextButton 15
45    setvar! activationButton 17
46endif
47
48@setvar! found 0
49
50if _aspectCategory < 2
51    while not dead
52        if ingump "Whirlwind" 2424293173 and _aspectType = 0 and found = 0
53            setvar! found 1
54        elseif ingump "Fortify" 2424293173 and _aspectType = 1 and found = 0
55            setvar! found 1
56        elseif ingump "Ravage" 2424293173 and _aspectType = 2 and found = 0
57            setvar! found 1
58        elseif ingump "Inspiration" 2424293173 and _aspectType = 3 and found = 0
59            setvar! found 1
60        elseif ingump "Decay" 2424293173 and _aspectType = 4 and found = 0
61            setvar! found 1
62        elseif ingump "Iron Will" 2424293173 and _aspectType = 5 and found = 0
63            setvar! found 1
64        elseif ingump "Earth Hands" 2424293173 and _aspectType = 6 and found = 0
65            setvar! found 1
66        elseif ingump "Energy Surge" 2424293173 and _aspectType = 7 and found = 0
67            setvar! found 1
68        elseif ingump "Fire Nova" 2424293173 and _aspectType = 8 and found = 0
69            setvar! found 1
70        elseif ingump "Windfall" 2424293173 and _aspectType = 9 and found = 0
71            setvar! found 1
72        elseif ingump "Judgement" 2424293173 and _aspectType = 10 and found = 0
73            setvar! found 1
74        elseif ingump "Cacophony" 2424293173 and _aspectType = 11 and found = 0
75            setvar! found 1
76        elseif ingump "Toxicity" 2424293173 and _aspectType = 12 and found = 0
77            setvar! found 1
78        elseif ingump "Vanish" 2424293173 and _aspectType = 13 and found = 0
79            setvar! found 1
80        elseif ingump "Doom Dragon" 2424293173 and _aspectType = 14 and found = 0
81            setvar! found 1
82        elseif ingump "Ice Storm" 2424293173 and _aspectType = 15 and found = 0
83            setvar! found 1
84        endif
85        if found = 1
86            overhead "Correct aspect found!"
87            waitforgump 2424293173
88            gumpresponse activationButton 2424293173
89            waitforgump 2424293173
90            gumpresponse activationButton 2424293173
91            waitforgump 2424293173
92            gumpresponse activationButton 2424293173
93            waitforgump 2424293173
94            gumpclose 2424293173
95            stop
96        endif
97        gumpresponse nextButton 2424293173
98        waitforgump 2424293173
99    endwhile
100else
101    while not dead
102        if ingump "Chance to Avoid Movement Effects" 2424293173 and _aspectType = 0 and found = 0
103            setvar! found 1
104        elseif ingump "Exceptional Crafting Chance Bonus" 2424293173 and _aspectType = 1 and found = 0
105            setvar! found 1
106        elseif ingump "All Stats Increase" 2424293173 and _aspectType = 2 and found = 0
107            setvar! found 1
108        elseif ingump "Follower Exp Gain" 2424293173 and _aspectType = 3 and found = 0
109            setvar! found 1
110        elseif ingump "Gain Unholy Symbol" 2424293173 and _aspectType = 4 and found = 0
111            setvar! found 1
112        elseif ingump "10 Sec After Using Mana" 2424293173 and _aspectType = 5 and found = 0
113            setvar! found 1
114        elseif ingump "Damage Resistance While Stationary" 2424293173 and _aspectType = 6 and found = 0
115            setvar! found 1
116        elseif ingump "Effective Spirit Speak" 2424293173 and _aspectType = 7 and found = 0
117            setvar! found 1
118        elseif ingump "Field Damage Resistance" 2424293173 and _aspectType = 8 and found = 0
119            setvar! found 1
120        elseif ingump "Harvesting Skill Bonus" 2424293173 and _aspectType = 9 and found = 0
121            setvar! found 1
122        elseif ingump "Resist Per Symbol Spent" 2424293173 and _aspectType = 10 and found = 0
123            setvar! found 1
124        elseif ingump "Effective Barding Skill Bonus" 2424293173 and _aspectType = 11 and found = 0
125            setvar! found 1
126        elseif ingump "Effective Poisoning" 2424293173 and _aspectType = 12 and found = 0
127            setvar! found 1
128        elseif ingump "Bonus Stealth Steps" 2424293173 and _aspectType = 13 and found = 0
129            setvar! found 1
130        elseif ingump "Effective Parrying" 2424293173 and _aspectType = 14 and found = 0
131            setvar! found 1
132        elseif ingump "Effective Alchemy" 2424293173 and _aspectType = 15 and found = 0
133            setvar! found 1
134        endif
135        if found = 1
136            overhead "Correct aspect found!"
137            waitforgump 2424293173
138            gumpresponse activationButton 2424293173
139            waitforgump 2424293173
140            gumpresponse activationButton 2424293173
141            waitforgump 2424293173
142            gumpresponse activationButton 2424293173
143            waitforgump 2424293173
144            gumpclose 2424293173
145            stop
146        endif
147        gumpresponse nextButton 2424293173
148        waitforgump 2424293173
149    endwhile
150endif