code to switch characters.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

code to switch characters.

#1 Post by Lamkefyned »

Hello, I have this script

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<waypoints>
	<!-- Updated>28/07/2013 20:00 PM PST<-->
	<onLoad><![CDATA[
		DQ1 = GetIdName(424181);
		DQNPC12 = "Robbie Carnicero";
		function tgtInRange(_target, _range)
			if not _range then
				_range = 300;
			end
			local objectList = CObjectList();
			objectList:update();
			player:update();
			local objSize = objectList:size();
			cprintf(cli.lightgreen,"Checking if any %s are in range.\n",_target)
			local _closest = 1000;
			for i = 0,objSize do 
				obj = objectList:getObject(i);
				if obj.Name == _target then
					local _tmpDist = distance(obj.X,obj.Z,player.X,player.Z);
					if _closest > _tmpDist then
						_closest = _tmpDist
					end
				end
			end
			if _range >= _closest then
				cprintf(cli.lightgreen,"%s in range.\n",_target)
				return true;
			else
				cprintf(cli.lightgreen,"%s NOT in range.\n",_target)
				return false;
			end
		end
		function getDailyComplete()
			return RoMScript("Daily_count();");
		end
		function checkDQCount()
			local _tmpQC = getDailyComplete();
			cprintf(cli.lightblue,"%s quests completed.\n",tostring(_tmpQC));
			if (_tmpQC == 10) then
				cprintf(cli.lightblue,"Completed max number of daily quests, logging out.\n");
				player:logout();
			end
		end
		
		settings.profile.friends = {"Ogest","Kupferg\132rtner",105293,105292,105291,105290,105299,105412};
		changeProfileOption("EGGPET_ENABLE_ASSIST",false);
		changeProfileOption("LOOT_ALL",false);
		changeProfileOption("TARGET_LEVELDIF_BELOW",30)
startGMDetect()
	]]></onLoad>
<!-- #  1 --><waypoint x="6449" z="5438" y="174">	
		__WPL:setForcedWaypointType("RUN")
		dailyQuest1 = getQuestStatus(DQ1);
		if (dailyQuest1 == "complete") then
			checkDQCount();
			player:target_NPC(DQNPC12);
			CompleteQuestByName(DQ1);
		end
		checkDQCount();
		player:target_NPC(DQNPC12);
		AcceptQuestByName(DQ1);
		cprintf(cli.lightblue,"Quests accepted, moving to objective.\n");
player:mount() 
</waypoint>
<!-- #  2 --><waypoint x="6376" z="4945" y="185">__WPL:setForcedWaypointType("TRAVEL")  </waypoint>
<!-- #  3 --><waypoint x="6541" z="3878" y="207">	</waypoint>
<!-- #  4 --><waypoint x="6389" z="3229" y="191">	</waypoint>
<!-- #  5 --><waypoint x="6401" z="2776" y="184">	</waypoint>
<!-- #  6 --><waypoint x="6226" z="2730" y="184">	</waypoint>
<!-- #  7 --><waypoint x="6196" z="2850" y="185">	</waypoint>
<!-- #  8 --><waypoint x="6079" z="2825" y="184">	</waypoint>
<!-- #  9 --><waypoint x="6129" z="2562" y="185">__WPL:setForcedWaypointType("NORMAL")	</waypoint>
<!-- # 10 --><waypoint x="6248" z="2352" y="183">	</waypoint>
<!-- # 11 --><waypoint x="6525" z="1108" y="168">__WPL:setForcedWaypointType("TRAVEL")
player:mount() 
</waypoint>
<!-- # 12 --><waypoint x="6062" z="2829" y="184">	</waypoint>
<!-- # 13 --><waypoint x="6187" z="2849" y="185">	</waypoint>
<!-- # 14 --><waypoint x="6220" z="2752" y="185">	</waypoint>
<!-- # 15 --><waypoint x="6402" z="2770" y="184">	</waypoint>
<!-- # 16 --><waypoint x="6376" z="3276" y="193">	</waypoint>
<!-- # 17 --><waypoint x="6594" z="3785" y="179">	</waypoint>
<!-- # 18 --><waypoint x="6374" z="4926" y="185">	</waypoint>
</waypoints>
and I want you when I'm done talking another character.

can be done?
If you think something is right just because everyone else believes,you're not thinking.
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: code to switch characters.

#2 Post by BlubBlab »

Sure:

Code: Select all

	sendMacro("SendChatMessage(\'"..message.."\', 'WHISPER', 0, \'"..recipient.."\');");
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
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#3 Post by Lamkefyned »

no, I say switch accounts
If you think something is right just because everyone else believes,you're not thinking.
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: code to switch characters.

#4 Post by BlubBlab »

Ah I was confused I thought you want to talk.
Take a look here http://www.solarstrike.net/phpBB3/viewt ... =27&t=1245
That userfunction does what you want.
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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: code to switch characters.

#5 Post by rock5 »

With that installed you only need to do

Code: Select all

ChangeChar(1,3) -- changes to character 1 on account 3
loadProfile() -- if needed
loadPaths("XPATH")
instead of

Code: Select all

player:logout();
But if you are having 2 characters do the same waypoint file then you will need to add a check for if you are already the last character. How many characters do you want to do? What are their account and character numbers?
  • 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
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#6 Post by Lamkefyned »

Error

Codes:
1.xml
(2.17 KiB) Downloaded 145 times
2.xml
(1.36 KiB) Downloaded 132 times
3.xml
(591 Bytes) Downloaded 149 times
Image:
Error 1.png
if you can help me I really appreciate it.
If you think something is right just because everyone else believes,you're not thinking.
noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: code to switch characters.

#7 Post by noobbotter »

The part you had highlighted indicated that it was forced waypoint type "TRAVEL" so I'm assuming you didn't want that? in your 3.xml file:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload> player:mount()	</onload>
	<!-- # 15 --><waypoint x="-2852" z="-8993">	</waypoint>
	<!-- # 16 --><waypoint x="-3154" z="-8839">	</waypoint>
	<!-- # 17 --><waypoint x="-3380" z="-8729">	</waypoint>
	<!-- # 18 --><waypoint x="-3492" z="-8737">	</waypoint>
		<!-- # 19 --><waypoint x="-3684" z="-8678" y="249">
			player:target_NPC(110482) -- Leighton
		CompleteQuestByName(420467); -- Control the Wolf Population
	<!-- # 20 --><waypoint x="-3772" z="-8634" y="223">
		loadPaths("1");
	</waypoint>
</waypoints>
The first line has <waypoints type="TRAVEL">. In TRAVEL, the character will only travel and will not engage in combat. If you need it to engage in combat you can change TRAVEL to either RUN, which will only engage in combat when first engaged by an enemy, or NORMAL which will engage in any enemies that are not in your friends list.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: code to switch characters.

#8 Post by rock5 »

If you look at the waypoints, you'll see it never reached waypoint file 3.xml.

"Forced waypoint type" means it was changed by a command. There are setForcedWaypointType commands in waypoint 2 but they are all type "RUN". Also if you look at that message it happens before it goes to waypoint #1. What I think is, there is some code in a profile event that changes the waypoint type. Check there.
  • 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
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#9 Post by Lamkefyned »

as I can put it in one script but if not repeat the full 2.xml?
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#10 Post by Lamkefyned »

it, and wanted to put this script in the code but I have a problem.
X.xml
(3.34 KiB) Downloaded 210 times
Sin título.png
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: code to switch characters.

#11 Post by Bill D Cat »

Line 95 has a missing closing bracket.

Code: Select all

<!-- #  9 --><waypoint x="31849" z="4686" __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));	</waypoint>
should be

Code: Select all

<!-- #  9 --><waypoint x="31849" z="4686"> __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));	</waypoint>
And just a suggestion, but your code at waypoint #5 could be simplified to this with the same results.

Code: Select all

if getQuestStatus(422340) == "incomplete" then
	repeat
		player:target_Object(112976,500)
		yrest(3000)
	until getQuestStatus(422340) == "complete"
end
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#12 Post by Lamkefyned »

hello!!!!!

I have a problem as I can do to finish 10 daily when you load another script or npc and make the loop accounts.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<waypoints>
	<!-- Updated>15/12/2013 9:00 AM PST<-->
	<onLoad>
		DQ1 = (422340);
		DQNPC1 = (112794);
		function tgtInRange(_target, _range)
			if not _range then
				_range = 300;
			end
			local objectList = CObjectList();
			objectList:update();
			player:update();
			local objSize = objectList:size();
			cprintf(cli.lightgreen,"Checking if any %s are in range.\n",_target)
			local _closest = 1000;
			for i = 0,objSize do 
				obj = objectList:getObject(i);
				if obj.Name == _target then
					local _tmpDist = distance(obj.X,obj.Z,player.X,player.Z);
					if _closest > _tmpDist then
						_closest = _tmpDist
					end
				end
			end
			if _range >= _closest then
				cprintf(cli.lightgreen,"%s in range.\n",_target)
				return true;
			else
				cprintf(cli.lightgreen,"%s NOT in range.\n",_target)
				return false;
			end
		end
		function getDailyComplete()
			return RoMScript("Daily_count();");
		end
		function checkDQCount()
			local _tmpQC = getDailyComplete();
			cprintf(cli.lightblue,"%s quests completed.\n",tostring(_tmpQC));
			if (_tmpQC == 10) then
				cprintf(cli.lightblue,"Completed max number of daily quests, logging out.\n");
ChangeChar(2,2) -- changes to character 1 on account 3
loadProfile() -- if needed
loadPaths("X")
			end
		end
	        settings.profile.options.WAYPOINT_DEVIATION = 5
	        settings.profile.options.MAX_TARGET_DIST = 5
__WPL:setForcedWaypointType("TRAVEL")
</onLoad>
	<!-- #  1 --><waypoint x="31857" z="4586" tag ='Main'>
		dailyQuest1 = getQuestStatus(DQ1);
		if (dailyQuest1 == "complete") then
			checkDQCount();
			player:target_NPC(DQNPC1);
			CompleteQuestByName(DQ1);
		end
		checkDQCount();
		player:target_NPC(DQNPC1);
		AcceptQuestByName(DQ1);
        	</waypoint>
	<!-- #  2 --><waypoint x="31862" z="4635" y="9">	</waypoint>
	<!-- #  3 --><waypoint x="31804" z="4887" y="1">	</waypoint>
	<!-- #  4 --><waypoint x="31656" z="5154" y="-16">	</waypoint>
	<!-- #  5 --><waypoint x="31417" z="5712" tag = "Item">
if getQuestStatus(422340) == "incomplete" then
   repeat
      player:target_Object(112976,500)
      yrest(3000)
   until getQuestStatus(422340) == "complete"
end
		</waypoint>
	<!-- #  6 --><waypoint x="31711" z="5062" y="-10">	</waypoint>
	<!-- #  7 --><waypoint x="31796" z="4883" y="4">	</waypoint>
	<!-- #  8 --><waypoint x="31826" z="4793" y="0">	</waypoint>
        <!-- #  9 --><waypoint x="31849" z="4686"> __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));   </waypoint>
</waypoints>
and Thanks
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: code to switch characters.

#13 Post by Bill D Cat »

ambolia wrote:hello!!!!!

I have a problem as I can do to finish 10 daily when you load another script or npc and make the loop accounts.
I realize that English is not your native language, but I could not figure out what you were asking here. Can you just ask again in Spanish and I'll be able to understand what you want.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#14 Post by Lamkefyned »

Hola,jajajaj con 13 años no se mucho ingles pero la imformatica se me da bien.Al cambiar a la cuenta 2 personaje 2 repite todo el rato el mismo personaje.

ejemplo:

ChangeChar(2,2) -- changes to character 1 on account 3
ChangeChar(2,3) -- changes to character 1 on account 3
ChangeChar(2,4) -- changes to character 1 on account 3
ChangeChar(2,5) -- changes to character 1 on account 3
ChangeChar(2,6) -- changes to character 1 on account 3
ChangeChar(2,7) -- changes to character 1 on account 3
ChangeChar(2,8) -- changes to character 1 on account 3
ChangeChar(3,1) -- changes to character 1 on account 3
ChangeChar(3,2) -- changes to character 1 on account 3
ChangeChar(3,3) -- changes to character 1 on account 3
ChangeChar(3,4) -- changes to character 1 on account 3
ChangeChar(3,5) -- changes to character 1 on account 3
ChangeChar(3,6) -- changes to character 1 on account 3
ChangeChar(3,7) -- changes to character 1 on account 3
ChangeChar(3,8) -- changes to character 1 on account 3
loadProfile() -- if needed
loadPaths("X")

Esto funcionaria?
If you think something is right just because everyone else believes,you're not thinking.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: code to switch characters.

#15 Post by rock5 »

I don't speak Spanish but I think this is what you want.

Code: Select all

		SetCharList({
			{account=2, chars= {2,3,4,5,6,7,8}},
			{account=3, chars= {1,2}},
		})
		LoginNextChar()
		loadProfile
		loadPaths("x")
Make sure the first character you log in with is also in the list.
  • 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
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: code to switch characters.

#16 Post by Bill D Cat »

rock5 wrote:I don't speak Spanish but I think this is what you want.

Code: Select all

		SetCharList({
			{account=2, chars= {2,3,4,5,6,7,8}},
			{account=3, chars= {1,2}},
		})
		LoginNextChar()
		loadProfile
		loadPaths("x")
Make sure the first character you log in with is also in the list.
Yeah, I thought that he hadn't defined the list properly, and therefore it was just using the information it had which was only the current character.

My Spanish is adequate, though not fluent. http://www.bing.com/translator is my tool of choice online. 8-)
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#17 Post by Lamkefyned »

Thank you again. I use http://translate.google.es/
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#18 Post by Lamkefyned »

And to make the game close when finished?
If you think something is right just because everyone else believes,you're not thinking.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: code to switch characters.

#19 Post by rock5 »

LoginNextChar leaves you at the character selection screen when it reaches the last character. If this is not good enough, you need to check if you are at the last character before doing LoginNextChar. Actually it looks like LoginNextChar has an option for that, Quit_Game. If set to "true" it shuts down the game when it reaches the last character.

Code: Select all

		SetCharList({
			{account=2, chars= {2,3,4,5,6,7,8}},
			{account=3, chars= {1,2}},
		})
		Quit_Game = "true"
		LoginNextChar()
		loadProfile
		loadPaths("x")
  • 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
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: code to switch characters.

#20 Post by Lamkefyned »

Error 7:21pm - .../micromacro - tiers/scripts/rom/classes/waypointlist.lua:83: Failed to compile and run Lua code for waypointlist onload event.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<waypoints>
	<!-- Updated>15/12/2013 9:00 AM PST<-->
	<onLoad>
		DQ1 = (422340);
		DQNPC1 = (112794);
		function tgtInRange(_target, _range)
			if not _range then
				_range = 300;
			end
			local objectList = CObjectList();
			objectList:update();
			player:update();
			local objSize = objectList:size();
			cprintf(cli.lightgreen,"Checking if any %s are in range.\n",_target)
			local _closest = 1000;
			for i = 0,objSize do 
				obj = objectList:getObject(i);
				if obj.Name == _target then
					local _tmpDist = distance(obj.X,obj.Z,player.X,player.Z);
					if _closest > _tmpDist then
						_closest = _tmpDist
					end
				end
			end
			if _range >= _closest then
				cprintf(cli.lightgreen,"%s in range.\n",_target)
				return true;
			else
				cprintf(cli.lightgreen,"%s NOT in range.\n",_target)
				return false;
			end
		end
		function getDailyComplete()
			return RoMScript("Daily_count();");
		end
		function checkDQCount()
			local _tmpQC = getDailyComplete();
			cprintf(cli.lightblue,"%s quests completed.\n",tostring(_tmpQC));
			if (_tmpQC == 10) then
				cprintf(cli.lightblue,"Completed max number of daily quests, logging out.\n");
      SetCharList({
         {account=2, chars= {2,3,4,5,6,7,8}},
         {account=3, chars= {1,2}},
      })
      Quit_Game = "true"
      LoginNextChar()
      loadProfile
      loadPaths("Tier")
			end
		end
	        settings.profile.options.WAYPOINT_DEVIATION = 5
	        settings.profile.options.MAX_TARGET_DIST = 5
__WPL:setForcedWaypointType("TRAVEL")
</onLoad>
	<!-- #  1 --><waypoint x="31857" z="4586" tag ='Main'>
		dailyQuest1 = getQuestStatus(DQ1);
		if (dailyQuest1 == "complete") then
			checkDQCount();
			player:target_NPC(DQNPC1);
			CompleteQuestByName(DQ1);
		end
		checkDQCount();
		player:target_NPC(DQNPC1);
		AcceptQuestByName(DQ1);
        	</waypoint>
	<!-- #  2 --><waypoint x="31862" z="4635" y="9">	</waypoint>
	<!-- #  3 --><waypoint x="31804" z="4887" y="1">	</waypoint>
	<!-- #  4 --><waypoint x="31656" z="5154" y="-16">	</waypoint>
	<!-- #  5 --><waypoint x="31417" z="5712" tag = "Item">
if getQuestStatus(422340) == "incomplete" then
   repeat
      player:target_Object(112976,500)
      yrest(3000)
   until getQuestStatus(422340) == "complete"
end
		</waypoint>
	<!-- #  6 --><waypoint x="31711" z="5062" y="-10">	</waypoint>
	<!-- #  7 --><waypoint x="31796" z="4883" y="4">	</waypoint>
	<!-- #  8 --><waypoint x="31826" z="4793" y="0">	</waypoint>
        <!-- #  9 --><waypoint x="31849" z="4686"> __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));   </waypoint>
</waypoints>
If you think something is right just because everyone else believes,you're not thinking.
Post Reply