Page 1 of 2

code to switch characters.

Posted: Mon Dec 09, 2013 1:39 am
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?

Re: code to switch characters.

Posted: Mon Dec 09, 2013 2:58 am
by BlubBlab
Sure:

Code: Select all

	sendMacro("SendChatMessage(\'"..message.."\', 'WHISPER', 0, \'"..recipient.."\');");

Re: code to switch characters.

Posted: Mon Dec 09, 2013 1:47 pm
by Lamkefyned
no, I say switch accounts

Re: code to switch characters.

Posted: Mon Dec 09, 2013 2:02 pm
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.

Re: code to switch characters.

Posted: Tue Dec 10, 2013 11:05 pm
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?

Re: code to switch characters.

Posted: Thu Dec 12, 2013 6:23 pm
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.

Re: code to switch characters.

Posted: Thu Dec 12, 2013 6:59 pm
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.

Re: code to switch characters.

Posted: Thu Dec 12, 2013 9:43 pm
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.

Re: code to switch characters.

Posted: Sat Dec 14, 2013 12:30 pm
by Lamkefyned
as I can put it in one script but if not repeat the full 2.xml?

Re: code to switch characters.

Posted: Sun Dec 15, 2013 3:32 pm
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

Re: code to switch characters.

Posted: Sun Dec 15, 2013 5:16 pm
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

Re: code to switch characters.

Posted: Mon Dec 16, 2013 3:41 pm
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

Re: code to switch characters.

Posted: Mon Dec 16, 2013 11:33 pm
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.

Re: code to switch characters.

Posted: Tue Dec 17, 2013 11:25 am
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?

Re: code to switch characters.

Posted: Tue Dec 17, 2013 12:01 pm
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.

Re: code to switch characters.

Posted: Tue Dec 17, 2013 12:42 pm
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-)

Re: code to switch characters.

Posted: Tue Dec 17, 2013 3:41 pm
by Lamkefyned
Thank you again. I use http://translate.google.es/

Re: code to switch characters.

Posted: Tue Dec 17, 2013 3:44 pm
by Lamkefyned
And to make the game close when finished?

Re: code to switch characters.

Posted: Tue Dec 17, 2013 10:21 pm
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")

Re: code to switch characters.

Posted: Wed Dec 18, 2013 1:26 pm
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>