Back to "musicianship" tags

Provocation Hotkey by Nevor

1//-----   MANUAL SETUP      ----//
2
3//You can prevent Razor spamming system messages by using filters
4//It is not mandatory, but highly recommended to use them
5//Go to 'Filters' tab in Razor menu -> Text & Messages -> Check Enable text filter -> Click Add
6//Make sure to check 'Filter system messages', but do not check 'Ignore filtered messages in overhead and scripts'
7//Create the following text filters:
8// target set
9// Target a new
10// No one matching that was found on your screen
11
12//This variable determines the search radius for barding targets, change at your own risk (not tested)
13@setvar! bardingTargetSearchRadius 8
14//Amount of time to wait for the server to respond with system messages (adjust according to ping if necessary)
15@setvar! forServerResponse 300
16
17//-----   AUTO SETUP      ----//
18
19if not timerexists ProvoTimer
20    createtimer! ProvoTimer
21    settimer ProvoTimer 10500
22elseif timer ProvoTimer <= 10500
23    overhead '[SKILL COOLDOWN]' 43
24    stop
25endif
26
27@setvar! firstProvocationTarget 1
28@setvar! secondProvocationTarget 3
29@setvar! needToBard 3
30@setvar! previousLastTarget 7
31
32//----    CLEANING UP    ----//
33
34clearsysmsg
35if targetexists
36    if targetexists 'beneficial'
37        target self
38        wait 50
39    else
40        hotkey 'Cancel Current Target'
41        wait 50
42    endif
43endif
44
45//----    INSTRUMENT CHECK    ----//
46
47if not varexist myInstrument or not find myInstrument backpack
48//lute 3763, drum 3740, lap harp 3762, tambourine 3742, bamboo flute 10245
49    while findtype 3740|3742|3762|3763|10245 backpack as instrucheck
50        getlabel instrucheck instrulabel
51        wait forServerResponse
52        if 'supremely' in instrulabel
53            @setvar myInstrument instrucheck
54            overhead 'New supreme instrument set'
55            wait forServerResponse
56            dclick myInstrument
57            break
58        elseif 'exceedingly' in instrulabel
59            @setvar myInstrument instrucheck
60            overhead 'New exceeding instrument set'
61            wait forServerResponse
62            dclick myInstrument
63            break
64        else
65            @ignore instrucheck
66        endif
67    endwhile
68    @clearignore
69    if not varexist myInstrument or not find myInstrument backpack
70        overhead "Instrument not found. Set a new one!"
71        @setvar myInstrument
72        wait forServerResponse
73        dclick myInstrument
74    endif
75    if not varexist myInstrument or not find myInstrument backpack
76        for 3
77            overhead '** NO INSTRUMENT **' 33
78        endfor
79        stop
80    endif
81endif
82
83//----    TARGET SEARCH      ----//
84
85@setvar! preScriptLastTarget lasttarget    
86if find preScriptLastTarget ground -1 -1 bardingTargetSearchRadius
87    if noto preScriptLastTarget = 'hostile' or noto preScriptLastTarget = 'criminal'
88        @setvar! previousLastTarget preScriptLastTarget
89    endif
90endif
91if previousLastTarget != preScriptLastTarget
92    hotkey 'Target Closest Non-Friendly Monster'
93    @setvar! previousLastTarget lasttarget
94endif
95@setvar! checkLastTarget previousLastTarget
96
97while not dead previousLastTarget
98    if find checkLastTarget ground -1 -1 bardingTargetSearchRadius
99        getlabel checkLastTarget BardingStatusCheck
100        if 'break' in BardingStatusCheck
101            //do nothing
102        elseif 'pacified' in BardingStatusCheck or 'provoked' in BardingStatusCheck
103            if find checkLastTarget ground -1 -1 bardingTargetSearchRadius and checkLastTarget != firstProvocationTarget and checkLastTarget != secondProvocationTarget
104                @setvar! possibleProvoTarget checkLastTarget
105            endif
106        else
107            if not find firstProvocationTarget ground -1 -1 bardingTargetSearchRadius and find checkLastTarget ground -1 -1 bardingTargetSearchRadius and checkLastTarget != secondProvocationTarget
108                @setvar! firstProvocationTarget checkLastTarget
109            endif
110            if not find secondProvocationTarget ground -1 -1 bardingTargetSearchRadius and find checkLastTarget ground -1 -1 bardingTargetSearchRadius and checkLastTarget != firstProvocationTarget
111                @setvar! secondProvocationTarget checkLastTarget
112            endif
113        endif
114    endif
115    if not dead firstProvocationTarget and not dead secondProvocationTarget
116        @setvar! needToBard 1
117        break
118    elseif index > 0 and checkLastTarget = previousLastTarget
119        if dead firstProvocationTarget and not dead possibleProvoTarget and possibleProvoTarget != secondProvocationTarget
120            @setvar! firstProvocationTarget possibleProvoTarget
121        elseif dead secondProvocationTarget and not dead possibleProvoTarget and possibleProvoTarget != firstProvocationTarget
122            @setvar! secondProvocationTarget possibleProvoTarget
123        endif
124        @setvar! possibleProvoTarget 0
125        if find firstProvocationTarget ground -1 -1 bardingTargetSearchRadius and find secondProvocationTarget ground -1 -1 bardingTargetSearchRadius
126            @setvar! needToBard 1
127        endif
128        break
129    endif
130    hotkey 'Next Non-Friendly Monster Target'
131    @setvar! checkLastTarget lasttarget
132endwhile
133
134//----    BARDING      ----//
135    
136if needToBard = 1
137    hotkey 'Provocation'
138    wft 3000
139    target firstProvocationTarget
140    wait forServerResponse
141    if insysmsg 'Target cannot be seen'
142        overhead "▼ Not visible ▼" 43 firstProvocationTarget
143    elseif insysmsg 'That is too far away.'
144        overhead '▼ Too far away ▼' 43 firstProvocationTarget
145    else
146        wft 3000
147        target secondProvocationTarget
148        wait forServerResponse
149        if insysmsg 'You play successfully, provoking'
150            overhead '[PROVO SUCCESS]'
151            overhead '▼ Provoked ▼' 88 firstProvocationTarget
152            overhead '▼ Provoked ▼' 88 secondProvocationTarget
153            settimer ProvoTimer 0
154        elseif insysmsg 'You fail to incite'
155            overhead '[PROVO FAIL]' 43
156            overhead '▼ Failed ▼' 43 firstProvocationTarget
157            overhead '▼ Failed ▼' 43 secondProvocationTarget
158            settimer ProvoTimer 5000
159        elseif insysmsg 'Target cannot be seen'
160            overhead "▼ Not visible ▼" 43 secondProvocationTarget
161        elseif insysmsg 'That is too far away.'
162            overhead '▼ Too far away ▼' 43 secondProvocationTarget
163        elseif insysmsg 'The creatures you are trying to provoke are too far away from each other for your music to have an effect.'
164            overhead '▼ Too far apart ▼' 43 firstProvocationTarget
165            overhead '▼ Too far apart ▼' 43 secondProvocationTarget
166        elseif insysmsg 'tell someone to attack themselves!'
167            //Oops, that should not be possible to happen
168            overhead '[SELF TARGETING FAIL]' 33
169        else
170            //maybe the server could not respond with a sysmsg in time - adjust forServerResponse variable in setup to a higher value
171            overhead '[UNEXPECTED PROVO RESULT]' 33
172            settimer ProvoTimer 5000
173        endif
174    endif
175else
176    overhead '[NO TARGETS]' 43
177endif
178
179//----    INSTRUMENT CHECK      ----//
180
181getlabel myInstrument InstruLabel
182if '(10/' in InstruLabel
183    overhead '10 Songs left to play' 33
184elseif '(3/' in InstruLabel
185    overhead '* 3 Songs left to play *' 33
186elseif '(2/' in InstruLabel
187    overhead '** 2 Songs left to play **' 33
188elseif '(1/' in InstruLabel
189    for 3
190        overhead '*** LAST SONG ***' 33
191    endfor
192endif
193
194//----    CLEANING UP    ----//
195
196hotkey 'Set Last Target'
197wft 3000
198target preScriptLastTarget
199
200if targetexists 
201    hotkey 'Cancel Current Target'
202endif