Hey experts.
I'm trying to make a script with a part checking the remaining time of targets cast?
To be exact, I want to check the cast of mechanical bug in ToSH, so if its spawning the small bugs, my mage should react with "Discharge". Has someone any idea?
Checking targets casting time?
Re: Checking targets casting time?
The only information we collect is whether the mob is casting or not. If you want to know how much time is remaining on their cast then you will have to read memory. I happen to know the offsets needed. Something like this should do it.
Code: Select all
casttime = memoryReadRepeat("float", getProc(), target.Address + 0x260)
elapsedtime = memoryReadRepeat("float", getProc(), target.Address + 0x264)
remaining = casttime-elapsedtime
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: Checking targets casting time?
Do you want to farm tp with the bot? oOso if its spawning the small bugs, my mage should react with "Discharge". Has someone any idea?
Re: Checking targets casting time?
@ Ego, yes, that was my intention.
@ rock, your sugested code seems not to be working on the simple code
got this error
5:57pm - scripts\rom/bot.lua:505: onLoad error: [string "..."]:7: attempt to index global 'target' (a nil value)
have also try to read a "floatptr" instead of "float" - same errror
@ rock, your sugested code seems not to be working on the simple code
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
changeProfileOption("MAX_TARGET_DIST", 400);
player:target(106355)
while (true) do
casttime = memoryReadRepeat("float", getProc(), target.Address + 0x260)
elapsedtime = memoryReadRepeat("float", getProc(), target.Address + 0x264)
remaining = casttime-elapsedtime
printf(remaining)
printf("\n")
end
</onLoad>
</waypoints>
5:57pm - scripts\rom/bot.lua:505: onLoad error: [string "..."]:7: attempt to index global 'target' (a nil value)
have also try to read a "floatptr" instead of "float" - same errror
Re: Checking targets casting time?
That's because you don't define 'target'. Try
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
changeProfileOption("MAX_TARGET_DIST", 400);
local target = player:findNearestNameOrId(106355)
if target then
player:target(target)
while player:hasTarget() do
casttime = memoryReadRepeat("float", getProc(), target.Address + 0x260)
elapsedtime = memoryReadRepeat("float", getProc(), target.Address + 0x264)
remaining = casttime-elapsedtime
printf(remaining)
printf("\n")
end
end
</onLoad>
</waypoints>
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Who is online
Users browsing this forum: No registered users and 2 guests