-
Notifications
You must be signed in to change notification settings - Fork 0
/
autocast.cmd
149 lines (121 loc) · 4.33 KB
/
autocast.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
####################################################################################################
# autocast.cmd
# Selesthiel - [email protected]
#
# USAGE
# .autocast
# whisper yourCharacterName cast <spellname>
#
# Will try to cast the spell someone whispers to you
# EX: Someone whispers, "Cast bless"
# casts 'bless' on 'Someone'
# Selesthiel whispers, "cast uncurse"
# casts uncurse on Selesthiel
#
####################################################################################################
###############################
### CONFIG
###############################
# THE AMOUNT TO PREP THE SPELL AT
var prepAmount 10
# THE MINIMUM AMOUNT OF TIME TO PREPARE BEFORE CASTING
var minPrepTime 20
# IF YOU WANT TO USE CAMBRINTH, CHANGE useCambrinth to 1
var useCambrinth 0
var cambrinthItem mammoth calf
var chargeAmount 10
# SET enforceWhitelist TO 1 TO ALLOW ONLY THE WHITELIST SPELLS
var enforceWhitelist 0
# IF enforceWhitelist IS 1, ONLY ALLOW THESE SPELLS:
var whitelist uncurse|bless
# NOTE: The whispered spells will need to exactly match the spells as listed in the whitelist
# ex: if the whitelist has 'mg', but the person whispers "cast moongate", it won't be allowed to cast
###############################
### INIT
###############################
action (idling) eval spellName tolower($2); var target $1; echo Casting %spellName on %target; goto newTarget when (\S+) whispers, "[Cc]ast (\S+)
# With variable spell name input, need to handle busy notification a different way. Leaving out for now - JD
#action (busy) whisper $1 Busy when ^(\S+) whispers, "[Cc]ursed
action (busy) off
action var isFullyPrepped 1 when ^Your concentration lapses for a moment, and your spell is lost.$
action var isFullyPrepped 1 when ^Your concentration slips for a moment, and your spell is lost.$
action var isFullyPrepped 1 when ^You feel fully prepared to cast your spell.
action var isFullyPrepped 1 when ^Your formation of a targeting pattern
action var isFullyPrepped 0 when eval $preparedspell = None
var isFullyPrepped 0
###############################
### idle
###############################
idle:
action (idling) on
action (busy) off
if ("$preparedspell" != "None") then {
put release spell
pause .5
}
waitfor ThisWillNeverHappenSoJustWaitIndefinitely
pause 30
goto idle
###############################
### newTarget
###############################
newTarget:
action (idling) off
action (busy) on
if (!matchre("$roomplayers", "%target")) then {
var target null
var spellName null
if ("$preparedspell" != "None") then {
put release spell
pause .5
}
goto idle
}
if (%enforceWhitelist = 1 && !matchre("%spellName", "%whitelist")) then {
put whisper %target Can't cast %spellName
pause .5
var target null
var spellName null
goto idle
}
if ("$preparedspell" = "None"} then {
put prep %spellName %prepAmount
pause 1
if ("%useCambrinth" = "1") then {
put charge my %cambrinthItem %chargeAmount
pause
pause
put invoke my %cambrinthItem %chargeAmount
pause
}
goto newTarget
}
gosub waitForPrep %minPrepTime
gosub waitForMana 50
put cast %target
pause .5
put whisper %target All set!
var target null
var spellName null
goto idle
###############################
### UTILITIES
###############################
waitForPrep:
var waitForPrep.minSpellTime $1
if (!(%waitForPrep.minSpellTime > -1)) then var waitForPrep.minSpellTime 20
var isFullyPrepped 0
echo waitForPrep: Waiting for minspell time: %waitForPrep.minSpellTime
waitForPrep1:
gosub waitForMana 30
pause .1
if (%isFullyPrepped = 1 || "$preparedspell" = "None" || $spelltime > %waitForPrep.minSpellTime) then return
goto waitForPrep1
waitForMana:
var waitManaForAmount $1
if (!(%waitManaForAmount > 0)) then var waitManaForAmount 50
waitForMana1:
pause .5
#if ($mana > %waitManaForAmount || "$preparedspell" = "None") then return
if ($mana >= %waitManaForAmount) then return
goto waitForMana1