target_NPC command

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

target_NPC command

#1 Post by ZZZZZ »

I have been trying to find where the function is located to look at it and edit it, but when using search in function.lua i cannot find it, can anyone point me to it? thanks.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: target_NPC command

#2 Post by lisa »

player.lua line 3638

Why would you need to edit it?

As a little more info, any functions that have
player:

will be found in the player.lua in classes folder.
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: target_NPC command

#3 Post by rock5 »

If you think you will have the need for it in the future, I recommend FileSeek http://www.fileseek.ca/ for searching in files located in a folder.

But with that said, most bot functions, that are not micromacro commands, are organized in classes which are organized 1 class per file named after the class. The functions that are not part of a class are mostly found in functions.lua but there are a lot of functions all over the place.

Examples:
  • player:taregt_NPC is found in \classes\player.lua
    mob:hasBuff is found in \classes\pawn.lua
    inventory:getItemCount is found in classes\inventory.lua
    bagitem:use() is found in \classes\inventoryitem.lua
    waitForLoadingScreen is found in functions.lua
A few things to note:
  • 1. The objects created by the class doesn't necessarily have the same or similar name as the class. Some class objects always have the same name eg. player, inventory, bank, guild. Other class objects have temporary names and can be anything, eg. pawns, inventory items, etc. To work out which class it is you need to know what the object is.
    2. Some classes have subclasses eg. 'player' is based on the pawn class so it shares all the pawn functions and values. So if you are looking for a player function, eg. player:hasBuff, you might find it in the pawn class file. Also inventoryitem, bankitem and guilditem all use the item class as a base class.
    3. There are exceptions to these rules.
Lisa beat me but I'm posting anyway. :)
  • 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
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: target_NPC command

#4 Post by BlubBlab »

@ZZZZZ
Do you refer to http://www.solarstrike.net/phpBB3/viewt ... =21&t=5507 ?

I can give you my modification as a userfunction but I didn't added all mailboxes so if you have trouble you need add some more ID's ind target_NPC.

I also must warn you :

This will work basically every time with the new fast target_NPC

Code: Select all

player:target_NPC("118020");
sendMacro("ChoiceOption(1);");
waitForLoadingScreen();
This not:

Code: Select all

player:target_NPC("118020");
sendMacro("ChoiceOption(2);");
sendMacro("ChoiceOption(2);");
waitForLoadingScreen();
The reason is the first the new fast target_NPC did take care that the menu windows is opened after you pressed it one time nobody does, so the second time you can press buttons in the air.(This sadly apply also without any modification)

2 solutions:

Code: Select all

repeat
	player:target_NPC("118020");
	yrest(500);
	sendMacro("ChoiceOption(2);");
	sendMacro("ChoiceOption(2);");
until waitForLoadingScreen(10);
I also wrote a new function PressMenu(_option) which take care but I haven't tested it until now(I added it to the file)

Code: Select all

player:target_NPC("118020");
PressMenu(2)
PressMenu(2)
waitForLoadingScreen();
Please make some yrest between the code because it would see inhuman and very botish otherwise.
Attachments
userfunction_mixed.lua
(16.84 KiB) Downloaded 99 times
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: target_NPC command

#5 Post by ZZZZZ »

Basically I want to try something along the lines of

Code: Select all

		-- target NPC
		repeat
		self:target(npc.Address)
		Attack(); yrest(50); Attack(); -- 'click' again to be sure
		yrest(500);
		until RoMScript("SpeakFrame:IsVisible()");
My net isnt always stable, so I am wanting to change the target_NPC function so that I don't have to worry about it targeting the designated and 'talking' before the Speak Frame even appears. Yeh, you could say "Put a larger yrest between target and choice option" but most of mine already have yrest(1000) after targets, even 2000 on some, and it still misses when my net is being temperamental.

I'll check out your userfunction too Blubblub and see if I can get something working, thanks.

Also thanks R5, i'll keep that noted so I have an idea of where to look if I am after something else
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: target_NPC command

#6 Post by ZZZZZ »

Blubblab, with your function why don't you just do something along the lines of

Code: Select all

		repeat
		RoMScript("CloseWindows()");
		self:target(npc.Address)
		Attack(); yrest(50); Attack(); -- 'click' again to be sure
		yrest(500);
		until RoMScript("SpeakFrame:IsVisible()") or RoMScript("MailFrame:IsVisible()");


So far that has worked wonders for me when using the target_NPC function. I just changed the main 1 in player.lua.
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: target_NPC command

#7 Post by BlubBlab »

I do take a lock in the code.

I added exceptions for the mailbox because with UMM I have no speakframe -> I would end in a infinite loop.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Post Reply