Page 1 of 1
translate of addon to bot
Posted: Fri Sep 16, 2011 7:11 pm
by Ajoir
Code: Select all
local timeInvited = nil;
local timeDeclineDelay = 2 + math.random(7);
function declineInvite_OnUpdate()
if( timeInvited ~= nil and os.difftime(os.time(), timeInvited) > timeDeclineDelay ) then
This is a part of an addon. I want translate it to bot, but "timeInvited" doesn't work. Which it's the code what i must write to work as userfunction? I dont know if i explain it right....
Re: translate of addon to bot
Posted: Fri Sep 16, 2011 8:00 pm
by lisa
So you just want bot to autodecline invites?
If you want the addon to be somehow called from the bot I would need a lot more code then what you posted. Somewhere else in the addon it will be giving timeInvited a value of not nil otherwise it would never work.
Re: translate of addon to bot
Posted: Fri Sep 16, 2011 8:47 pm
by Ajoir
lisa wrote:So you just want bot to autodecline invites?
If you want the addon to be somehow called from the bot I would need a lot more code then what you posted. Somewhere else in the addon it will be giving timeInvited a value of not nil otherwise it would never work.
yes, i want a autodecline invite in trade, duel and party.
i think must be something like that:
Code: Select all
if [b](this its the code that i unknow) [/b] then
RoMScript("StaticPopup_OnClick(StaticPopup1, 2);")
printf("decline for party/duel/trade ");
soundPlay(soundresource);
end
Somewhere else in the addon it will be giving timeInvited a value of not nil otherwise it would never work.
I don't know if I understand you. I have the addon "d303fix". I send you my original addon. it works fine, but i prefer work how userfuncion
Re: translate of addon to bot
Posted: Fri Sep 16, 2011 10:10 pm
by lisa
If the addon works fine then I would stick with it.
Trouble is with doing the same thing with the bot is we would need to create a monitoring of those events which would put more load on the bot usage.
The game itself already monitors such events and makes it much easier to use an addon to deal with declining.
If there wasn't an addon then you could probably search memory for the pop and what causes it to monitor it without constantly sending macros to in game but since the addon already exists I would just use it.
Re: translate of addon to bot
Posted: Fri Sep 16, 2011 11:44 pm
by Ajoir
lisa wrote:If the addon works fine then I would stick with it.
Trouble is with doing the same thing with the bot is we would need to create a monitoring of those events which would put more load on the bot usage.
The game itself already monitors such events and makes it much easier to use an addon to deal with declining.
If there wasn't an addon then you could probably search memory for the pop and what causes it to monitor it without constantly sending macros to in game but since the addon already exists I would just use it.
Well... i'll prove, I must add the decline trade... and something little change. thanks for your help.
Re: translate of addon to bot
Posted: Sat Sep 17, 2011 12:31 am
by lisa
Of course you can always just change the addon to do what you want =)
Re: translate of addon to bot
Posted: Tue Nov 01, 2011 9:02 pm
by Ajoir
Hi again
I tried the addon... and dont like it. The sound does not work , It need on the game´s sound and sometime overlapping. I like try make it in bot. Could you help me, please?
Re: translate of addon to bot
Posted: Tue Nov 01, 2011 9:34 pm
by lisa
I can try but I would need to know exactly what you want to do and what was the addons name?
Re: translate of addon to bot
Posted: Thu Nov 03, 2011 7:49 am
by Ajoir
i want to make a function what activate it when someone will give me trade, duel and party. I want the same operation of the addon.
When someone give me:
- In a time oscilating between 3 and 10 second autodecline invite.
- give me an alarm sound.
I dont know make to the function detect the event. In the addon, used:
Code: Select all
if( event == "PARTY_INVITE_REQUEST" ) then
if( event == "TRADE_REQUEST" ) then
In the function i think i may use "eventmonitorcheck", but i dont know how to do it. The rest of the function, i think i can do it.
i send you the addon. The name is declineinvite
P.D.: I don't speak english too good, if someting it´s confusing, say me and I try to explain better.
Thank you in advance.
Re: translate of addon to bot
Posted: Thu Nov 03, 2011 9:32 am
by lisa
So you like the addon and what it does but you also want it to make sound and have a randomized delay before declining?
I still think the best thing is to just alter the addon itself.
Anything else you want the addon to do because those 2 things are very easy to implement.
Re: translate of addon to bot
Posted: Thu Nov 03, 2011 12:18 pm
by Ajoir
Yeah, its more easy, but the sound it´s the problem for me. An addon and the game share them the sound. there are any form to make the sound's addon work free how a bot?
Re: translate of addon to bot
Posted: Thu Nov 03, 2011 9:17 pm
by lisa
Ahh so what you really want is to play a sound independant of the game, I'll do some testing.
Re: translate of addon to bot
Posted: Thu Nov 03, 2011 10:37 pm
by lisa
Ok give this a test run and see what you think.
save the alarm.wav to
runes of magic/Interface/AddOns/declineInvite/Sound/alarm.wav
What I did was increase the volume of the alarm.wav and then when you get an invite it detects the master volume level and adjusts the interface volume so you hear the alarm sound at a nice volume, it then sets interface volume back to where it was previously.
So it still does what declineinvite always did but now you have a nice volume alarm and then interface volume goes back to where it was.
I couldn't find the actual addon on rom.curse anymore so I couldn't test or do much more then this.
If you post entire addon I could do more =)
Hmm it changes volume back before the sound has finished playing, need to work out how to add in a time delay and I have always had issue with that in addons =(
Re: translate of addon to bot
Posted: Fri Nov 04, 2011 7:40 am
by Ajoir
A new function... really it's imaginative. Don't worry, this it's enough for me. I want make some changes, but I think i can do it myself. Thank you really much.
Re: translate of addon to bot
Posted: Fri Nov 04, 2011 4:30 pm
by Ajoir
Anyway ... the perfect solution would be that the addon will run the sound file from any external program: Windows Media or similar. I send you the full addon; If you can do that and get it, great ... if you can don´t, nothing happens, already you've helped me enough.
Re: translate of addon to bot
Posted: Sat Nov 05, 2011 12:08 am
by lisa
If you still really want to do it via bot this is what you are after.
Code: Select all
function checkinvite()
-- invite popup static address is 0x9EB8B8 4.0.4.2456
if memoryReadInt(getProc(), 0x9EB8B8) == 1 then
yrest(2000)
RoMScript("StaticPopup_OnClick(StaticPopup1, 2)")
if playalarm then
playalarm()
end
end
end
Put this in your onload, WP or profile
Code: Select all
unregisterTimer("Checkforpopup");
registerTimer("Checkforpopup", secondsToTimer(5), checkinvite);
It will look for the popup every 5 seconds, if it detects a popup it will cancel it 2 seconds after it detects it, so in total can be random time of 2-7 seconds.
If you get the userfunction I made for playing an alarm it will play that sound.
http://www.solarstrike.net/phpBB3/viewt ... =27&t=3129
--=== Note ===--
This function has the address in it, so anytime there is a patch the address will need updating.
Re: translate of addon to bot
Posted: Sat Nov 05, 2011 7:05 am
by rock5
I'd say it's not a good idea to put a yrest in a timer event. You don't know when it's going to be triggered. Instead, I'd remember the time and do it later. That way the bot can continue doing what it's doing while waiting to decline the invite. Some thing like.
Code: Select all
function checkinvite()
-- invite popup static address is 0x9EB8B8 4.0.4.2456
if remembertime then
if os.time() - remembertime > 5 then
RoMScript("StaticPopup_OnClick(StaticPopup1, 2)")
remembertime = nil
end
elseif memoryReadInt(getProc(), 0x9EB8B8) == 1 then
if playalarm then
playalarm()
end
remembertime = os.time()
end
end
Re: translate of addon to bot
Posted: Sat Nov 05, 2011 7:57 am
by lisa
Good point, I would probably do 2 seconds as opposed to 5 though. with 5 second intervals in the event timer, it may have already been 4 seconds since someone tried to invite you.
Code: Select all
if os.time() - remembertime > 2 then
Re: translate of addon to bot
Posted: Sat Nov 05, 2011 9:01 am
by Ajoir
whou, you did it!!!. Thankyou very much for your work. Now I gonna test it. When finish I tell you.