you should use quotes with a longer name here, you don't have to exact, but these will use the first items they find with "scorpion" and "spider" in them at all - which means you could end up not clicking what you wante dto click
mq.cmd('/dgra /useitem Scorpion')
mq.cmd('/dgra /useitem Spider')
Code:
/multiline ; /boxr pause; /alt activate 35; /alt activate 38; /boxr unpause; /rsay Casting Celestial Regeneration')
this should be utilizing a /timed on the unpause, and the purchase/activate
https://www.redguides.com/docs/projects/macroquest/reference/commands/timed/a multiline fires all the things at the same time, so when you need to stagger them, or use it like a sequential process, you use /timed (which is non cumulative)
/multiline ; /echo hi; /timed 10 /echo hi 1 second after button press; /timed 50 /echo hi 5 seconds after button press; /timed 200 /echo hi 20 seconds after button press;
you have what appears to be a slightly inconsistent designation of raid and zone for the dannet usage
from a readability standpoint some of your brackets/spacing could do with some cleanup
you also have this which i don't think is doing what you want it to do.
mq.cmd("/dex", ot, " /cwtn mode 7")
a "/cwtn" command is telling the whole group other than yourself to go into mode 7, so in this instance, you're dexing to your ot to tell everyone else in their group to go into mode 7
another suggestion and good practice is to have it do a resetcamp after doing the mode 7, just in case you were already in mode 7 and need to just update your camp to where you are now at
you can also get rid of the sqrt on your distance check and just square your hardcoded 60
Code:
local function check_distance(x1, y1, x2, y2)
return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2)
end