Does this event exist?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Dayquil
Posts: 5
Joined: Sun Jan 02, 2011 1:51 pm

Does this event exist?

#1 Post by Dayquil »

I was wondering if there is currently an event sort of like onLoad in the waypoint file.
Except this event would fire every time a waypoint is completed/processed, something like onWaypoint.

This would be useful to check for things as each waypoint gets processed, and not have to repeat the code in each waypoint, for instance if a daily gets done after harvesting at a certain item, then you can use the event to see if it that completed the quest and then redirect the character to another indexed return path dynamically. Or if you want to make sure a buff is on your character at all possible times, like rouge's hide for example. Checking as you go through each waypoint that you are hidden, and reapply hide if something like going into combat temporarily took you out of hide mode.

There may be something already like this, if so is please provide an example.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Does this event exist?

#2 Post by rock5 »

I thought of something like this too but it's not really practical.

An easy solution I use is to add a function to the onLoad section of the waypoint file where you include all the commands you want to repeat at the waypoints, then just add the function to all the waypoints you want to do those commands. eg,

Code: Select all

<waypoints>
    <onLoad>
        function commands()
            ....
            ....
            ....
        end
    </onLoad>
    <waypoint x="nn" z="nn"> commands() </waypoint>
    <waypoint x="nn" z="nn"> commands() </waypoint>
    <waypoint x="nn" z="nn"> commands() </waypoint>
    <waypoint x="nn" z="nn">  </waypoint>
    <waypoint x="nn" z="nn"> commands() </waypoint>
</waypoints>
This also gives you more control as you can choose not to add it to certain waypoints, for example waypoints that don't have clear access to the return path.
  • 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
User avatar
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: Does this event exist?

#3 Post by jduartedj »

I must say that in my point of view a profile <onWaypoint> event would make a lot of sense, mostly for checking some stuff and so on.
Take using this:

Code: Select all

UseFood("Potion: Unbridled Enthusiasm","Unbridled Enthusiasm");
if the waypoint file has no combat, where can i put it?
onload? what if if lasts for more than 1h?
onskillcast? what if I don't use buffs?

I think many of use are checking/using stuff in the onCombat event because we have no other reliable 'frequent' event to check/use it.

in such case onWaypoint would make sense to me.
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates
Dayquil
Posts: 5
Joined: Sun Jan 02, 2011 1:51 pm

Re: Does this event exist?

#4 Post by Dayquil »

Yea rock that seems like a good enough work around. I guess I could just make an addon if I wanted the checks to be reusable and create a function in the onLoad event for specific waypoint situations.

Thanks.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Does this event exist?

#5 Post by rock5 »

jduartedj wrote:if the waypoint file has no combat, where can i put it?
onload? what if if lasts for more than 1h?
onskillcast? what if I don't use buffs?
True, but then, if you really think about it, what you want is not to execute some commands at the waypoints but to execute some commands on a regular basis. Maybe what we need is some option to setup timed events. Wait a second, aren't there timed events? I believe you use registerTimer to set them up. You could probably use it anywhere like the onLoad section of a profile or waypoint file. I'm not sure how we could change rombot to make user friendly options to set them up, though.
  • 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
User avatar
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: Does this event exist?

#6 Post by jduartedj »

maybe a Timed (or Timer) event is in order?

Code: Select all

<Timed time="xxxx">
-- since onLoad this event is fired at every xxxx ms
-- this is used for a used-based regular event
</Timed>
And from here you'd create this event upon the profile creation and enable it when the bot starts.

Only issue I see here is if people want different intervals? add an even id?

Code: Select all

<Timed time="xxxx" id="#"> </Timed>
or maybe it really isn't necessary it'd stack up all occurrences of the Timed XML tag and make the events from that stack.

What may be usefull is a time offset.

Code: Select all

<Timed time="xxxx" offset="xxxx"></Timed>
but only as optional ofc.
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Does this event exist?

#7 Post by rock5 »

I'm not sure what you mean by stacks and offsets but, yes, we would probably need to be able to create multiple timed events with different durations. Or maybe that would be too complex. Maybe having the ability to set up 1 timed event, like your example above, in your profile or waypoint file would be enough?

The way I think registerTimer works is to allow you to register multiple timers and checks them whenever yrest is used. Which raises a concern. What if a timed event takes awhile to execute like with some RoMScript commands? It's possible it could play havoc with the regular running of the bot.
  • 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
User avatar
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: Does this event exist?

#8 Post by jduartedj »

rock5 wrote:I'm not sure what you mean by stacks and offsets but, yes, we would probably need to be able to create multiple timed events with different durations. Or maybe that would be too complex. Maybe having the ability to set up 1 timed event, like your example above, in your profile or waypoint file would be enough?

The way I think registerTimer works is to allow you to register multiple timers and checks them whenever yrest is used. Which raises a concern. What if a timed event takes awhile to execute like with some RoMScript commands? It's possible it could play havoc with the regular running of the bot.
Good point, Lua doesn't have 'true' threads! it might slow down the bot a little but for knowledge sake I think we should at least test this. do a simple thing, 1 timed event on the profile that is triggered at the bot start. We can even make it simpler by making it a fixed value like 2500ms for test sake. So if the XML parses a "<Timed>" tag the th bot fires a Timer that execute whatever is inside those tags every 2.5 secs.

P.S.: By stack I mean having loads of timed eventes stored in memory to be executed a "stack of events", and by offset I mean that it starts with an offset and not at T=0 ms, so event 'A' starts at 0 but event 'B' (offset=250ms) starts at 250ms.
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates
Post Reply