KnightRyder 77 Posted October 13, 2015 Share Posted October 13, 2015 Is there a way to setup something in a profile (or maybe fight class?) to routinely check to see if a clickable in game object is nearby? I had this old profile when I used Cybot a couple years ago where it would fly around dread wastes looking for certain items. I could set it to look for ID 213964 which is Malik's Stalwart Spear http://www.wowhead.com/object=213964 and if it found it I could set it to preform certain functions, like to loot it, whisper someone, or my personal favorite, play a sound file.I don;t personally see how to add something like this to a profile, so I was thinking fightclass, but I am not good with the programming and such to thought I would ask here. Any suggestions on how to do this? Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/ Share on other sites More sharing options...
KnightRyder 77 Posted October 18, 2015 Author Share Posted October 18, 2015 Is there a way to adapt the way it looks for timber to harvest to look for a different item or id? Just throwing out an idea... Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11168 Share on other sites More sharing options...
Droidz 2738 Posted October 21, 2015 Share Posted October 21, 2015 Hello,You can add custom objects to harvest in advanced general settings tab "Farming..." (or in profile/product settings if you use product gatherer/quester/automaton/custom).You can also use tab "Map" and search the object by name (use radar 3d to show it in game).It is possible to create an plugin that stop bot/play soung/... when the object is near. Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11198 Share on other sites More sharing options...
KnightRyder 77 Posted October 22, 2015 Author Share Posted October 22, 2015 I have no clue how to start making a plugin that would do this. Tried looking at http://wrobot.eu/forums/topic/213-how-to-create-plugin-developer-only/ but only got more confused. Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11211 Share on other sites More sharing options...
Droidz 2738 Posted October 22, 2015 Share Posted October 22, 2015 You can found some others source code here: http://wrobot.eu/files/category/26-plugins/I have write sample code (no tested):using System.Collections.Generic; using System.Threading; using System.Windows.Forms; using robotManager.Helpful; using robotManager.Products; using wManager.Plugin; using wManager.Wow.Helpers; using Timer = robotManager.Helpful.Timer; public class Main : IPlugin { private List<string> Names = new List<string> { "ObjNpc Name 1", "ObjNpc Name 2", "ObjNpc Name ...", }; private bool _isLaunched; public void Initialize() { _isLaunched = true; var timer = new Timer(1500); timer.ForceReady(); Logging.Write("[Search Objects] Loadded."); while (_isLaunched && Products.IsStarted) { try { if (timer.IsReady && Conditions.ProductIsStartedNotInPause) { foreach (var o in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWUnit()) { try { if (o.IsValid && !string.IsNullOrEmpty(o.Name) && Names.Contains(o.Name)) { // Code here where NPC found: MessageBox.Show("Npc found: " + o.Name); } } catch {} } foreach (var o in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWGameObject()) { try { if (o.IsValid && !string.IsNullOrEmpty(o.Name) && Names.Contains(o.Name)) { // Code here where object found: MessageBox.Show("Object found: " + o.Name); } } catch { } } timer.Reset(); } } catch { } Thread.Sleep(300); } } public void Dispose() { _isLaunched = false; Logging.Write("[Search Objects] Disposed."); } public void Settings() { MessageBox.Show("[Search Objects] No settings for this plugin."); } } (replace "ObjNpc Name ..." line 15 by object or npc name (case sensitivity)) Pudge 1 Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11229 Share on other sites More sharing options...
KnightRyder 77 Posted October 29, 2015 Author Share Posted October 29, 2015 Ok, thanks for this, I got it working almost perfectly. How can I get it to make noise, play a sound file, or play in game sound file? Like sending macro/text in game like: /console Sound_EnableSFX 1 /script PlaySoundFile("Sound\\Creature\\Rotface\\IC_Rotface_Aggro01.ogg") I would imagine I would put it in the line where it says "code here where object/npc found?" Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11272 Share on other sites More sharing options...
Droidz 2738 Posted October 29, 2015 Share Posted October 29, 2015 To run lua code: Lua.LuaDoString("PlaySoundFile('Sound\\Creature\\Rotface\\IC_Rotface_Aggro01.ogg')"); To run lua macro: Lua.RunMacroText("/console Sound_EnableSFX 1"); To run lua code and get value: var luaValue = Lua.LuaDoString<string>("return GetUnitName('target');"); To play sound with WRobot (in c#): var myPlayer = new System.Media.SoundPlayer { SoundLocation = Application.StartupPath + "\\Data\\newWhisper.wav" }; var tPlay = new robotManager.Helpful.Timer(1000 * 5); // 5 sec = 5000 ms while (!tPlay.IsReady) { myPlayer.PlaySync(); } myPlayer.Stop(); Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11274 Share on other sites More sharing options...
KnightRyder 77 Posted October 30, 2015 Author Share Posted October 30, 2015 I still can't get it to make any sounds. I've tried: Lua.LuaDoString("PlaySoundFile('Sound\\Creature\\Rotface\\IC_Rotface_Aggro01.ogg')"); Lua.LuaDoString("PlaySoundFile('Sound\\Creature\\Rotface\\IC_Rotface_Aggro01.ogg'"); Lua.LuaDoString("PlaySoundKitID(16986)"); Lua.RunMacroText("/script PlaySoundKitID(16986)"); and a couple more variations. If i type the /script i have from a macro, sound files do play and work. I even tried to add in the code to play sound in WRobot. I didn't have a newWhisper.wav file, so I went and made one. Doesn't seem to play it. Any more suggestions? Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11283 Share on other sites More sharing options...
Droidz 2738 Posted October 30, 2015 Share Posted October 30, 2015 Wow seem play game sound only when window is on foreground. If you want use default wrobot alarm sound use: var myPlayer = new System.Media.SoundPlayer(wResources.Resource.NewWhisper); var tPlay = new robotManager.Helpful.Timer(1000 * 5); // 5 sec = 5000 ms while (!tPlay.IsReady) { myPlayer.PlaySync(); } myPlayer.Stop(); Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11287 Share on other sites More sharing options...
KnightRyder 77 Posted October 31, 2015 Author Share Posted October 31, 2015 That sound isn't working either. I've attached the plugin if you want to take a look to see if there is something i'm missing. I've stolen some code from the Wait Party plugin to try and get it to pause when it gets near, it kinda works. I'm just trying to get the sound thing to work first. Also attached a simple profile that flies outside the horde garrison as a test profile to get the plugin to detect the Frozen Fury npc. Search.cs test.xml Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11292 Share on other sites More sharing options...
Droidz 2738 Posted October 31, 2015 Share Posted October 31, 2015 Try it: using System.Collections.Generic; using System.Threading; using System.Windows.Forms; using robotManager.Helpful; using robotManager.Products; using wManager.Plugin; using wManager.Wow.Helpers; using Timer = robotManager.Helpful.Timer; public class Main : IPlugin { private List<string> Names = new List<string> { "Frozen Fury", "Warsong Initiate", "", }; private bool _isLaunched; public void Initialize() { _isLaunched = true; var timer = new Timer(1500); timer.ForceReady(); Logging.Write("[Search Objects] Loaded."); while (_isLaunched && Products.IsStarted) { try { if (timer.IsReady && Conditions.ProductIsStartedNotInPause) { foreach (var o in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWUnit()) { try { if (o.IsValid && !string.IsNullOrEmpty(o.Name) && Names.Contains(o.Name)) { Logging.Write("NPC found: " + o.Name); ObjectFound(); } } catch { } } foreach (var o in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWGameObject()) { try { if (o.IsValid && !string.IsNullOrEmpty(o.Name) && Names.Contains(o.Name)) { Logging.Write("Object found: " + o.Name); ObjectFound(); } } catch { } } timer.Reset(); } } catch { } Thread.Sleep(300); } } public void ObjectFound() { // Pause bot: Products.InPause = true; Fight.StopFight(); MovementManager.StopMove(); LongMove.StopLongMove(); // Play sound In Game //Lua.RunMacroText("/console Sound_EnableSFX 1"); Lua.LuaDoString(@"PlaySoundFile('Sound\\Creature\\Rotface\\IC_Rotface_Aggro01.ogg')"); // Play sound from WRobot var myPlayer = new System.Media.SoundPlayer(wResources.Resource.NewWhisper); var tPlay = new Timer(1000 * 5); // 5 sec = 5000 ms while (!tPlay.IsReady) { myPlayer.PlaySync(); } myPlayer.Stop(); // Wait during bot in pause while (_isLaunched && Products.InPause && Products.IsStarted) { Thread.Sleep(10); } } public void Dispose() { _isLaunched = false; Logging.Write("[Search Objects] Disposed."); } public void Settings() { MessageBox.Show("[Search Objects] No settings for this plugin."); } } (Sound is played in method(function) ObjectFound()) Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11296 Share on other sites More sharing options...
KnightRyder 77 Posted October 31, 2015 Author Share Posted October 31, 2015 Ok this is working a lot better to what I am going for.. Is there a way to change how long it is paused for or to wait X ms before unpausing? all of the timers i see are short already Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11301 Share on other sites More sharing options...
Droidz 2738 Posted November 1, 2015 Share Posted November 1, 2015 Yes, replace // Wait during bot in pause while (_isLaunched && Products.InPause && Products.IsStarted) { Thread.Sleep(10); } By: // Wait during bot in pause var pauseTime = new Timer(1000 * 5); // 5 sec = 5000 ms while (!pauseTime.IsReady && _isLaunched && Products.InPause && Products.IsStarted) { Thread.Sleep(10); } Products.InPause = false; Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11305 Share on other sites More sharing options...
KnightRyder 77 Posted November 1, 2015 Author Share Posted November 1, 2015 omg perfect. thank you thank you thank you thank you thank you thank you Droidz 1 Link to comment https://wrobot.eu/forums/topic/2418-possible-to-search-for-object/#findComment-11312 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now