Page 1 of 1

Crash Window Killer

Posted: Mon Dec 02, 2013 2:58 am
by Bot_romka
Stand alone function for kill Crash Window.

I know this function is in Bot but when i farm any dungeon its not always work, i don't know why and i write this small function.

For run use Start_CrashWindowKiller.bat after start its scan for Crash Window and kill it.

For automatic restart client after crash and autostart CrashWindowKiller add this code in profile:

Code: Select all

	<onLoad>
		-- onClientCrash
		local currAcc = RoMScript("LogID");
		local currChar = RoMScript("CHARACTER_SELECT.selectedIndex");
		local dirPath = string.gsub( getExecutionPath()," ","\" \"" );
		local currPath = __WPL.FileName;
		local Clientlink = false;			-- specify you client shortcut links name if it not contains *client*

		if( Clientlink == false ) then
			local romdir = getDirectory(dirPath);
			for i,v in pairs(romdir) do
				local match = string.match(string.lower(v), "client(.*)%.lnk")
				if( match ~= nil ) then
					Clientlink = v
					break
				end
			end
		end;
		cprintf(cli.white, "Current Acc: %s, Char: %s, Path: %s, dirPath: %s, Client: %s\n\n", currAcc, currChar, currPath, dirPath, Clientlink)

		function onClientCrash()
			yrest(5000)
			if( not windowValid(getAttachedHwnd()) ) then
				-- write Crash Log
				local filename = ""..dirPath.."/logs/CrashLog.log";
				local file, err = io.open(filename, "a+");
				if file then
					file:write("Account: "..currAcc.." \tName: " ..string.format("%-10s",player.Name ).." \tDate: "..os.date().." \tPath: "..currPath.." \n")
					file:close()
				end
				-- Restart client and Bot
				os.execute("START "..dirPath.."/../../micromacro.exe "..dirPath.."/login acc:"..currAcc.." char:"..currChar.." client:"..Clientlink.." path:"..currPath.."")
				os.exit()
			end
		end;

		if( Clientlink ) then
			atError(onClientCrash)
		end;

		-- Start Crash Window Killer
		local a,b,c = os.execute("START "..dirPath.."/../../micromacro.exe "..dirPath.."/CrashWindowKiller.lua")
		if not a then
			error("Trouble executing file. Values returned were: "..(a or "nil")..", "..(b or "nil")..", "..(c or "nil"))
		end;
	</onLoad>
Autorestart client after crash need Automatic 'login' script
http://www.solarstrike.net/phpBB3/viewt ... =27&t=4663
and rock5's "fastLogin Revisited"
http://www.solarstrike.net/phpBB3/viewt ... t=loginxml


For another language with another Crash Window name not "Crash Report" use my modified update.inf file.
If you version of client different open file update.inf with any archiver its simply ZIP archive and in archive open version.ini and change version number. My version update.inf without password but if you need Password: tarubK2Vy5gT8Xo6

If on you server started special Event open update.inf and in file localization.ini add necessary event.
You can try to started event from another server 8-)
And in localization.ini you can change ROM window name.

Re: Crash Window Killer

Posted: Mon Dec 02, 2013 7:48 am
by kuripot
can you explain this?? it will automatic relog and start bot when you crashed??

Re: Crash Window Killer

Posted: Tue Dec 03, 2013 1:14 am
by Bot_romka
kuripot wrote:can you explain this?? it will automatic relog and start bot when you crashed??
Yes code for profile onload automatic restart client and bot, but function CrashWindowKiller only for kill Crash Window.

Re: Crash Window Killer

Posted: Tue Dec 03, 2013 10:34 am
by runegod
the code you said to put in our profile onload doesnt seem to be working for me
keep getting this error

The game client did not crash.
9:29am - scripts\rom/bot.lua:660: onLoad error: [string "..."]:29: bad argument
#1 to 'pairs' (table expected, got nil)

Re: Crash Window Killer

Posted: Tue Dec 03, 2013 10:55 pm
by Bot_romka
runegod wrote:the code you said to put in our profile onload doesnt seem to be working for me
keep getting this error

The game client did not crash.
9:29am - scripts\rom/bot.lua:660: onLoad error: [string "..."]:29: bad argument
#1 to 'pairs' (table expected, got nil)
This Error because you maybe not have
rock5's "fastLogin Revisited"
http://www.solarstrike.net/phpBB3/viewt ... xml#p53841

Re: Crash Window Killer

Posted: Wed Dec 04, 2013 2:56 am
by kuripot
where do i put a file??

Re: Crash Window Killer

Posted: Wed Dec 04, 2013 3:11 am
by kuripot
found out.. i dont know if this will work.. i put in rom folder of MM.. when i run MM automatic Crah Window Killer [v0.1] started.. and i waiting to crash to test

Re: Crash Window Killer

Posted: Wed Dec 04, 2013 5:55 am
by kuripot
after an hour my character crash

Code: Select all

MicroMacro v1.03
SolarStrike Software
http://www.solarstrike.net
Opening CrashWindowKiller.lua...
Starting script execution - Press CTRL+C to exit.
Press CTRL+L to cancel execution and load a new script.
---------------------------------------------------------
Press the (F6) key to stop/pause the script.
You can resume with the (F5) key.

    Crash Window Killer. Version v0.1

Found window [Crash Report/#32770]. Date: 12/04/13 18:52:
SUCCESS: The process with PID 14108 has been terminated.

Code: Select all

MicroMacro v1.03
SolarStrike Software
http://www.solarstrike.net
Opening CrashWindowKiller.lua...
Starting script execution - Press CTRL+C to exit.
Press CTRL+L to cancel execution and load a new script.
-------------------------------------------------------------
Press the (F6) key to stop/pause the script.
You can resume with the (F5) key.

    Crash Window Killer. Version v0.1

Found window [Crash Report/#32770]. Date: 12/04/13 18:52:57
SUCCESS: The process with PID 14108 has been terminated.
Found window [Crash Report/#32770]. Date: 12/04/13 19:32:24
SUCCESS: The process with PID 3376 has been terminated.


then??? i thought it will re start again??


my profile

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<profile>
	<options>
		<!-- Try the bot with a new char mage                   -->
		<!-- At the pioneer village. Use demo.xml waypoint file -->

		<!-- GM detection options -->
		<option name="GMDETECT"			value="true" /> -- enables the GM detection userfunction
		<option name="GMnearbylogout"		value="true" /> -- If a GM is close to the character it will log out.
		<option name="PAUSEONGM"		value="600" />  -- Pauses when GM whispers for value in seconds. ie 300 = 5 minutes
		<option name="RECALL"			value="true" /> -- if in combat while pausing it will use recall and whisper/logout

		<option name="HP_LOW"			value="85" />
		<option name="MP_LOW_POTION"		value="50" />
		<option name="HP_LOW_POTION"		value="50" />
		<option name="USE_HP_POTION"		value="best" />			<!-- potion select strategy: best|minstack -->
		<option name="USE_MANA_POTION"		value="best" />			<!-- potion select strategy: best|minstack -->
		<option name="USE_PHIRIUS_POTION"	value="true" /> 		<!-- false | true if you want to use the Phirus Potions -->
		<option name="PHIRIUS_MP_LOW"		value="40" />
		<option name="PHIRIUS_HP_LOW"		value="40" />

		<!-- Rest if HP or Mana is below that level -->
		<option name="HP_REST" 			value="15" />
		<option name="MP_REST" 			value="15" />

		<!-- Shopping options, how many of what do you want to keep in your inventory -->
		<option name="HEALING_POTION" 		value="99" />
		<option name="MANA_POTION" 		value="99" />			<!-- set to "0" if not required to buy -->
		<option name="ARROW_QUIVER" 		value="2" /> 			<!-- set to "0" if not required to buy -->
		<option name="THROWN_BAG" 		value="2" />			<!-- set to "0" if not required to buy -->
		<option name="POISON" 			value="30" />			<!-- set to "0" if not required to buy -->

		<!-- either false or arrow or thrown -->
		<option name="RELOAD_AMMUNITION" 	value="false" />		<!-- false|arrow|thrown -->

		<!-- Combat options -->
		<option name="COMBAT_TYPE"        	value="" />				<!-- leave empty or choose ranged/melee if not using class default -->
		<option name="COMBAT_RANGED_PULL" 	value="false" /> 		<!-- only important for melees -->
		<option name="COMBAT_DISTANCE"    	value="200" />
		<option name="MAX_FIGHT_TIME"     	value="15" />			<!-- Max time without damage before break -->
		<option name="DOT_PERCENT"        	value="90" />
		<option name="ANTI_KS"            	value="true" />
		<option name="MAX_TARGET_DIST"    	value="225" />

		<!-- Attack monsters 3 levels above or 10 below your level -->
		<option name="TARGET_LEVELDIF_ABOVE" value="10" />
		<option name="TARGET_LEVELDIF_BELOW" value="54" />

		<!-- Waypoint and movement settings -->
		<option name="WAYPOINTS"		value="" />  			<!-- leave empty to show a list -->
		<option name="RETURNPATH"		value="" />
		<option name="PATH_TYPE"		value="waypoints" />	<!-- waypoints | wander -->
		<option name="WANDER_RADIUS"		value="500" />
		<option name="WAYPOINT_DEVIATION"	value="0" />
		<option name="QUICK_TURN" 		value="true" />

		<!-- Loot settings -->
		<option name="LOOT"               	value="true" />
		<option name="LOOT_ALL"			value="true" />  		<!-- Loot all nearby dead mobs after combat -->
		<option name="LOOT_IN_COMBAT"     	value="true" />
		<option name="LOOT_DISTANCE"      	value="250" />
		<option name="LOOT_PAUSE_AFTER"   	value="0" />			<!-- probability in % for a short rest -->

		<!-- Auto selling options when used with player:merchant -->
		<option name="INV_AUTOSELL_ENABLE"	value="false" />		<!-- true | false -->
		<option name="INV_AUTOSELL_FROMSLOT" 	value="1" /> 			<!-- 1 = bag 1 slot 1 -->
		<option name="INV_AUTOSELL_TOSLOT"	value="60" /> 			<!-- 30 = last slot bag 1 -->
		<option name="INV_AUTOSELL_QUALITY"	value="white,green" /> 	<!-- white,green,blue,purple  -->

		<!-- Harvest options -->
		<option name="HARVEST_DISTANCE"		value="120" />
		<option name="HARVEST_WOOD"		value="true" /> 		<!-- Choose which types to harvest. -->
		<option name="HARVEST_HERB"		value="true" /> 		<!-- "true" = harvest, "false" = do not harvest -->
		<option name="HARVEST_ORE"		value="true" />

		<!-- Eggpet options -->
		<option name="EGGPET_ENABLE_CRAFT"	value="false" />		<!-- If using same slot for assist and craft, onlt 1 can be enabled. -->
		<option name="EGGPET_CRAFT_SLOT"	value="1" />
		<option name="EGGPET_ENABLE_ASSIST"	value="false" />
		<option name="EGGPET_ASSIST_SLOT"	value="1" />
		<option name="EGGPET_CRAFT_RATIO"	value="1:1:1" /> 		<!-- mining:woodworking:herbalism ratio to produce. -->
		<option name="EGGPET_CRAFT_INDEXES"	value="" /> 	 		<!-- override auto craft index for mining,woodworking,herbalism eg. "2,,"-->


		<!-- Log out and resurrect settings -->
		<option name="LOGOUT_TIME" 		value="0" />			<!-- in minutes, 0 = timer disabled -->
		<option name="LOGOUT_SHUTDOWN"		value="false" />
		<option name="LOGOUT_WHEN_STUCK"	value="true" />
		<option name="CLOSE_WHEN_STUCK"		value="true" />
		<option name="RES_AFTER_DEATH" 		value="true" />
		<option name="MAX_DEATHS" 		value="1" /> 			<!-- Log out after this many deaths -->

		<!-- Party Bot options  -->
		<option name="PARTY"			value="false" />
		<option name="PARTY_ICONS"		value="false" />
		<option name="PARTY_INSTANCE"		value="false" />

		<!-- Healing options -->
		<!-- <option name="HEALER_FIGHT"	value="true" /> --> 	<!-- Not implemented yet, coming soon -->


		<!-- For more options and documentation see the RoM Bot Wiki:  -->
		<!-- http://www.solarstrike.net/wiki/index.php5?title=RoM_Bot  -->

	</options>

	<friends>
		<!-- names of friends we help fighting or enemys we don't want to attack -->
		<!-- for umlauts use \129 (ue),\132 (ae),\148 (oe) e.g. K\132fer         -->
		<friend name="Mutated Wolf" />
		<friend name="Dark Rite Warlock" /> <!-- Elite, avoid him -->
		<friend name="Dark Rite Instructor" /> <!-- Elite, avoid him -->
		<friend name="Dark Rite Mage" /> <!-- Elite, avoid him -->
		<friend name="Dark Rite Acolyte" /> <!-- Elite, avoid him -->
		<friend name="Spirit Core" /> <!-- Elite, avoid him -->
		<friend name="Misty Rotwrom" />
		<friend name="Iron Teeth Sentry" />
		<friend name="Puppet Shaman" />
		<friend name="Hindiakopinoy" />
		<friend name="Drifting Javias" />
		<friend name="Hare" />
		<friend name="Foul Maggot" />
	</friends>

	<mobs>
		<!-- names of mobs we want to attack 				-->
		<!-- if no names defined we will attack all mobs	-->
		<mob name="" />
		<mob name="" />
		<mob name="" />
	</mobs>

	<hotkeys>
    	<!-- to communicate with the RoM API / define ingame dummy macro at place 1 -->
		<hotkey name="MACRO"          key="VK_0" />
	</hotkeys>

	<!-- define your skills depending from your actual primary class -->
	<!-- see the example for a priest/mage                           -->
	<!-- delete skills you don't have or don't want to use.          -->
	<!-- For more skills to use see /database/skills.xml             -->
	<!-- demo skills for LvL 1 character for all classes             -->
	<!-- to use a specific key instead of MACRO then use hotkey="VK_1" this example is for hotkey 1 -->
	<skills_priest>
		<skill name="PRIEST_SOUL_SOURCE"     	hotkey="MACRO" priority="110" inbattle="true" hpper="15" />
		<skill name="PRIEST_URGENT_HEAL"     	hotkey="MACRO" priority="100" hpper="50"  />
		<skill name="PRIEST_REGENERATE"      	hotkey="MACRO" priority="90"  hpper="80" />
		<skill name="PRIEST_RISING_TIDE"     	hotkey="MACRO" priority="80" />
		<skill name="PRIEST_WAVE_ARMOR"      	hotkey="MACRO" priority="40"  inbattle="true" />
		<skill name="PRIEST_AMPLIFIED_ATTACK" 	hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
		<skill name="PRIEST_GRACE_OF_LIFE" 		hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
		<skill name="PRIEST_HOLY_AURA"       	hotkey="MACRO" priority="100" inbattle="true" hpper="24" />
		<!--skill name="PRIEST_SOUL_BOND"     	hotkey="MACRO" priority="30" /> -->
		<!--skill name="PRIEST_MAGIC_BARRIER" 	hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" /> -->
	</skills_priest>

	<skills_warrior>
		<skill name="WARRIOR_SLASH"          	hotkey="MACRO" priority="90" />
		<skill name="WARRIOR_TACTICAL_ATTACK"   hotkey="MACRO" priority="70" />
		<skill name="WARRIOR_PROBING_ATTACK" 	hotkey="MACRO" priority="80" />
		<skill name="WARRIOR_OPEN_FLANK"      	hotkey="MACRO" priority="70" />
		<skill name="WARRIOR_SURPRISE_ATTACK"   hotkey="MACRO" priority="70" pullonly="true" />
		<skill name="WARRIOR_FRENZY"  			hotkey="MACRO" priority="30" inbattle="true" />
		<skill name="WARRIOR_THUNDER"     	  	hotkey="MACRO" priority="70" />
		<skill name="WARRIOR_MOON_CLEAVE"     	hotkey="MACRO" priority="70" />
		<skill name="WARRIOR_BLASTING_CYCLONE"  hotkey="MACRO" priority="70" />
	</skills_warrior>

	<skills_scout>
		<skill name="SCOUT_SHOT"          		hotkey="MACRO" priority="90" />
		<skill name="SCOUT_AUTOSHOT"      		hotkey="MACRO" priority="80" />
		<skill name="SCOUT_WIND_ARROWS"   		hotkey="MACRO" priority="70" />
		<skill name="SCOUT_VAMPIRE_ARROWS" 		hotkey="MACRO" priority="70" />
		<skill name="SCOUT_COMBO_SHOT"        	hotkey="MACRO" priority="95" />
		<skill name="SCOUT_ARROW_OF_ESSENCE"    hotkey="MACRO" priority="90" maxhpper="60" inbattle="true"/>
	</skills_scout>

	<skills_rogue>
		<skill name="ROGUE_SHADOWSTAB"    		hotkey="MACRO" priority="90" />
		<skill name="ROGUE_LOW_BLOW"      		hotkey="MACRO" priority="80" />
		<skill name="ROGUE_HIDE"    			hotkey="MACRO" priority="10" autouse="false" />
		<skill name="ROGUE_INFORMER"    		hotkey="MACRO" priority="80" />
		<skill name="ROGUE_ASSASSINS_RAGE"    	hotkey="MACRO" priority="60" />
		<skill name="ROGUE_WOUND_ATTACK"    	hotkey="MACRO" priority="80" />
	</skills_rogue>

	<skills_mage>
		<skill name="MAGE_PURGATORY_FIRE"    	hotkey="MACRO" priority="100" autouse="false" />
		<skill name="MAGE_FLAME"                hotkey="MACRO" priority="80" />
		<skill name="MAGE_FIREBALL"          	hotkey="MACRO" priority="70" />
		<skill name="MAGE_LIGHTNING"         	hotkey="MACRO" priority="80" />
		<skill name="MAGE_ENERGY_INFLUX" 	  	hotkey="MACRO" priority="30" inbattle="true" />
		<skill name="MAGE_ELEMENTAL_CATALYSIS"   hotkey="MACRO" priority="30" inbattle="true" />
		<skill name="MAGE_ENERGY_WELL" 		  	hotkey="MACRO" priority="30" inbattle="true" />
	</skills_mage>

	<skills_knight>
		<skill name="KNIGHT_HOLY_STRIKE"    	hotkey="MACRO" priority="90" />
		<skill name="KNIGHT_HOLY_SHIELD"    	hotkey="MACRO" priority="80" inbattle="true" hpper="15" />
		<skill name="KNIGHT_HOLY_SEAL"      	hotkey="MACRO" priority="70" />
		<skill name="KNIGHT_PUNISHMENT"     	hotkey="MACRO" priority="60" />
		<skill name="KNIGHT_ENHANCED_ARMOR"   	hotkey="MACRO" priority="90" />
		<skill name="KNIGHT_MANA_RETURN"   	  	hotkey="MACRO" priority="60" />
		<skill name="KNIGHT_RESOLUTION"   	  	hotkey="MACRO" priority="60" />
		<skill name="KNIGHT_DISARMAMENT"   	  	hotkey="MACRO" priority="70" />
	</skills_knight>

	<skills_warden>
		<skill name="WARDEN_CHARGED_CHOP"	  	hotkey="MACRO" priority="90" />
		<skill name="WARDEN_ENERGY_ABSORB"	  	hotkey="MACRO" priority="80" inbattle="true" hpper="25" />
	</skills_warden>

	<skills_druid>
		<skill name="DRUID_RECOVER"          	hotkey="MACRO" priority="90" hpper="30" />
		<skill name="DRUID_EARTH_ARROW"      	hotkey="MACRO" priority="80" />
	</skills_druid>

	<onLoad><![CDATA[
      -- onClientCrash
      local currAcc = RoMScript("LogID");
      local currChar = RoMScript("CHARACTER_SELECT.selectedIndex");
      local dirPath = string.gsub( getExecutionPath()," ","\" \"" );
      local currPath = __WPL.FileName;
      local Clientlink = false;         -- specify you client shortcut links name if it not contains *client*

      if( Clientlink == false ) then
         local romdir = getDirectory(dirPath);
         for i,v in pairs(romdir) do
            local match = string.match(string.lower(v), "client(.*)%.lnk")
            if( match ~= nil ) then
               Clientlink = v
               break
            end
         end
      end;
      cprintf(cli.white, "Current Acc: %s, Char: %s, Path: %s, dirPath: %s, Client: %s\n\n", currAcc, currChar, currPath, dirPath, Clientlink)

      function onClientCrash()
         yrest(5000)
         if( not windowValid(getAttachedHwnd()) ) then
            -- write Crash Log
            local filename = ""..dirPath.."/logs/CrashLog.log";
            local file, err = io.open(filename, "a+");
            if file then
               file:write("Account: "..currAcc.." \tName: " ..string.format("%-10s",player.Name ).." \tDate: "..os.date().." \tPath: "..currPath.." \n")
               file:close()
            end
            -- Restart client and Bot
            os.execute("START "..dirPath.."/../../micromacro.exe "..dirPath.."/login acc:"..currAcc.." char:"..currChar.." client:"..Clientlink.." path:"..currPath.."")
            os.exit()
         end
      end;

      if( Clientlink ) then
         atError(onClientCrash)
      end;

      -- Start Crash Window Killer
      local a,b,c = os.execute("START "..dirPath.."/../../micromacro.exe "..dirPath.."/CrashWindowKiller.lua")
      if not a then
         error("Trouble executing file. Values returned were: "..(a or "nil")..", "..(b or "nil")..", "..(c or "nil"))
      end;

	]]></onLoad>

	<onDeath><![CDATA[

	]]></onDeath>

	<onLeaveCombat><![CDATA[

	]]></onLeaveCombat>

	<onLevelup><![CDATA[

	]]></onLevelup>

	<onSkillCast><![CDATA[

	]]></onSkillCast>

	<onHarvest><![CDATA[

	]]></onHarvest>

	<onUnstickFailure><![CDATA[

	]]></onUnstickFailure>
</profile>