using MM to pass information to addon?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

using MM to pass information to addon?

#1 Post by silinky » Thu Jul 19, 2012 3:16 am

hey, anther weird question :)

still in the process of making a combined advanced autofighter addon, going ok in the direction of an alpha stage, and i found a dead end:

is there a possibility to run MM in the background, and "ask it" from my addon to pass me for ex the distance of my target, so that my addon can use it for calculations?


thx

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: using MM to pass information to addon?

#2 Post by lisa » Thu Jul 19, 2012 3:47 am

well I don't think you could get the addon to directly tell MM but you could have MM monitoring for info, after all it monitors 1000's of things from the game all the time, mostly done via memory now though but RoMScripts can get info from the in game functions which would include an addon.

small example is my madman addon I have for dod first boss.

MM uses this

Code: Select all

		  if RoMScript("madman.Time") >= 1 then 
			 player:clearTarget();
			 printf("Running\n")
			 yrest(4000)
		  end
the addon has this

Code: Select all

function mm_OnUpdate(frame, elapsedTime)
	if madman.Time >= 1 then
		madman.Time = madman.Time + elapsedTime
	end
	if madman.Time >= 5 and mm_once == false then
		MoveForwardStop();
		mm_once = true
	end
	if madman.Time >= 7 and mm_once == true then
		madman.Time = 0
		mm_once = false
	end
end
So the addon is changing the value of madman.Time and MM is monitoring it's value.

You can also do it the other way of course but this is just the example I had off hand.

Another example is the loginxml, the addon and scripts work together to be able to do what they do, worth a browse.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: using MM to pass information to addon?

#3 Post by rock5 » Thu Jul 19, 2012 4:03 am

The difference there is the bot script is getting info from the game. Having the addon ask for information from the bot would be more difficult, mainly because the addon can't just wait for a response but has to use the onupdate event, which makes things a bit more complex.
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: using MM to pass information to addon?

#4 Post by lisa » Thu Jul 19, 2012 4:14 am

I am guessing he wants a UI with target information, so you could have nil info until MM makes the info = something else.

So on screen you would see

Dist = --
and when MM updates the info it says
Dist = 128

As for getting addon to tell MM to update, it would depend what you are doing. If you just want target info you could set MM to monitor having a target and when it has a target to constantly send certain info to the addon variables that will update on the screen UI as it is received, there would be a small delay but it would work.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#5 Post by silinky » Thu Jul 19, 2012 4:30 am

ty for the ides, guys :)

i have one also (thinking hard to find a solution)
i run MM in the background, with a WP that toggles spamming of a button. now instead of the button it would spam a macro 10 times a second, the macro of my addon.
since my addon cannot get distance info from the game, i was thinking about passing it from MM:

Code: Select all

RoMScript("MyBattleFunction(" .. distance .. ")")
and then, take distance as an argument and process it in my addon to act accordingly

seems a good idea?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: using MM to pass information to addon?

#6 Post by lisa » Thu Jul 19, 2012 4:39 am

it wouldn't be hard.

Just do a check for target and is attackable, do distance check and spamm the macro, not sure you will get to 10 times a second though.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#7 Post by silinky » Thu Jul 19, 2012 4:45 am

haha yeah, i saw that the more advanced the bot is, the slower the reaction time is. that is why i want to combine it with an addon, and use MM only for info that can be obtained exclusively from memory

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: using MM to pass information to addon?

#8 Post by lisa » Thu Jul 19, 2012 4:57 am

You could even create your own version of bot.lua as such with just the memory monitoring, so it doesn't look for mobs or anything else.
I think setting it to travel would be the same but it could be fun if you have the time lol
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: using MM to pass information to addon?

#9 Post by rock5 » Thu Jul 19, 2012 5:10 am

You could have the bot just continuously getting the target value like lisa said but write it to a macro. Then have the addon spam your attack function using the current value in the macro. That way if the addon is faster than the bots updates, it can spam the attack many times per each bot update.

But are we talking about manual play but with bot/addon attack or are you trying to use your addon for attack while using the bot for normal navigation?
  • 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
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#10 Post by silinky » Thu Jul 19, 2012 5:36 am

oh sorry :) i was talking about manual playing :)

botting some materials is fine as it is bc i don't need fery fast dps there.

what do you mean by
but write it to a macro. Then have the addon spam your attack function using the current value in the macro.
?

sorry if the question is stupid, but i do not fully understand :)

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

Re: using MM to pass information to addon?

#11 Post by rock5 » Thu Jul 19, 2012 5:48 am

You could create a bot function or waypoint onload code that keeps checking if the player has a target. If so, the easy solution would be to change a variable in game, eg

Code: Select all

RoMScript("} targetdistance = "..distance.." a={")
Then just have the addon use that value when it's there.

But to get faster speed than using a RoMScript you could write to a macro instead, eg.

Code: Select all

writeToMacro(macroNum, distance)
Then you can have the addon read the macro using GetMacroInfo function. Of course you would have to make sure they use the same macro.
  • 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
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#12 Post by silinky » Thu Jul 19, 2012 6:25 am

wow, rock, very good idea :)

i did not know i can pass variables like that. this opens up a whole dimension of possibilities ( i am a lua script kiddie lol, php is my domain)

ty for the info, i try to create smtg good with this

User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#13 Post by silinky » Fri Jul 20, 2012 1:21 am

is there a way for the bot to check if a rogue is behind the target?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: using MM to pass information to addon?

#14 Post by lisa » Fri Jul 20, 2012 1:42 am

yes but would involve some complicated math stuff, you could just check if a rogue is within X distance of a mob easily though.

As for the behind stuff check my userfunction I made a little while back
http://www.solarstrike.net/phpBB3/viewt ... =27&t=3713

It has all sorts of complicated math stuff in it for those calculations.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#15 Post by silinky » Fri Jul 20, 2012 1:50 am

thx lisa, i will implement it :)

User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#16 Post by silinky » Tue Jul 31, 2012 4:05 am

so i have managed it.
thx u all.

how can i precisely say the frequency the bot is updating my info? can i print it out somehow how many fractions of a seconds have passed after a code cycle? to find out the time resolution the bot can handle, and maybe to optimize some code, and take out executed functions i don't need.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: using MM to pass information to addon?

#17 Post by lisa » Tue Jul 31, 2012 5:40 am

to test function speeds generally you would set a variable to the current time, run a loop of # doing the function and then print the difference between the time varible and current time.

Code: Select all

local _time = os.time()
for i = 1,500 do
RoMScript("SendSystemChat('lol')")
end
print(os.difftime(os.time(), _time)
So that will tell you how long it took you to do 500 of the function.
If it took you 20 seconds then you are doing a function 20/500 seconds.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#18 Post by silinky » Tue Jul 31, 2012 7:07 am

thanks lisa, not exactly what i wanted, but it was useful, and helps, and sometimes my english sux at explaining :)

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: using MM to pass information to addon?

#19 Post by lisa » Tue Jul 31, 2012 7:13 am

If you are after the number of times a code is done you just need a simple var = var + 1
just print var when you want to know the number of times the code was done.

Combination of that and the time difference should get what you are after.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
silinky
Posts: 213
Joined: Mon Nov 23, 2009 5:07 am

Re: using MM to pass information to addon?

#20 Post by silinky » Tue Jul 31, 2012 7:44 am

yes, this is what i wanted :)
thank you!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 44 guests