Page 1 of 1

onLoad event error with latest Release

Posted: Thu Jun 13, 2013 2:52 pm
by Buster99
I recently updated to MM 1.3 and Revision 758 but now I am having an error while trying to run Romka's Malatina's Goblin script. Error reads:

"...micromacro/scripts/rom/classes/waypointlist.lua:83 Failed to compile and run Lua code for waypointlist onLoad event.

I have looked at the waypointlist but can't figure out why there is this new error.

the Onload for the file is:

Code: Select all

   <onLoad>
	MainLevel = 78		<!-- Level of character which kill mobs -->
	NumTwinks = 5		<!-- Number of characters. For solo = 0, up to 5 in full Party. -->

	----------------------------------------------------------------------------------------
	repeat zoneid=RoMScript("GetZoneID()"); until zoneid
	repeat npcname=RoMScript("TEXT('Sys112651_name')"); until npcname
	repeat dgnname=RoMScript("TEXT('ZONE_DGN_BORSBURS')"); until dgnname
	repeat zonename=RoMScript("TEXT('ZONE_ASLAN')"); until zonename
	repeat curzone=RoMScript("GetZoneName()"); until curzone
	RoMScript("DEFAULT_CHAT_FRAME:AddMessage('|cffffff00Malatinas: "..player.Name.." You are in "..curzone..".|r')")

	--  Check zone
	if(zoneid ~= 4 and zoneid ~= 352) then
		RoMScript("DEFAULT_CHAT_FRAME:AddMessage('|cffffff00Malatinas: "..player.Name.." You are too far from " ..zonename.. ".|r')")
		error("\a\a\Malatinas: "..player.Name.." You are too far from "..zonename..".")
	end;

	--  Check zone and distance to NPC for Main character
	if(zoneid ~= 352 and player.Level >= MainLevel and distance(player.X,player.Z,-5874,3315) > 50) then
		RoMScript("DEFAULT_CHAT_FRAME:AddMessage('|cffffff00Malatinas:Main "..player.Name.." You are too far from NPC " ..npcname.. ".|r')")
		error("\a\a\Malatinas: Mainchar " ..player.Name.. " You are too far from NPC "..npcname..".")
	end

	--  Check Main character or  character
	if(player.Level >= MainLevel) then
		if(NumTwinks ~= 0 and NumTwinks+1 > sendMacro('GetNumPartyMembers()')) then
			RoMScript("DEFAULT_CHAT_FRAME:AddMessage('|cffffff00Malatinas: Mainchar "..player.Name.." Stop near Goblins Malatinas. Ivite all characters.|r')")
			printf("Malatinas: Mainchar "..player.Name.." Stop near Goblins Malatinas. Ivite all characters.\n");
			repeat
				yrest(1000);   
			until RoMScript('GetNumPartyMembers()') >= NumTwinks+1
		end
		player:target_NPC(npcname); yrest(1000);
		RoMScript("ChoiceOption(1);"); yrest(1000);
		RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");
		repeat yrest(5000);loggedin = RoMScript("UnitName('player');"); until loggedin
		player:update();
		repeat zoneid = RoMScript("GetZoneID()"); until zoneid
		if (zoneid ~= 352) then error("\a\a\"Malatinas: Mainchar " ..player.Name.. " You are too far from "..dgnname..".") end;
	else
		printf("Malatinas:character " ..player.Name.. " wait for Ivite.\n")
		while not RoMScript("UnitExists('party1')") do
			RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");
			yrest(1000)
		end
		printf("Malatinas:character " ..player.Name.. " wait for enter to "..dgnname..".\n")
		while (zoneid ~= 352) do
			RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");
			yrest(1000); player:update();
			zoneid = RoMScript("GetZoneID()"); 
		end
	end

	--  Function open chest for several character in party
	function getTreasureChest()
		EventMonitorStart("TreasureChest", "PLAYER_BAG_CHANGED")
		local retry_count = 0;
		while(retry_count<7)do
			player:target_Object(113137,7000,nil,true)
			local time, moreToCome, msg = EventMonitorCheck("TreasureChest", "1")
			if msg ~= nil then
				EventMonitorStop("TreasureChest")
				break
			end
			retry_count = retry_count + 1;
		end
		printf("Chest opens. continuing.\n")
	end

	--  Function whait for command to character 
	function PauseTwink()
		EventMonitorStart("PausePARTY", "CHAT_MSG_PARTY")
		repeat
			local time, moreToCome, name, msg = EventMonitorCheck("PausePARTY", "4,1")
			if time ~= nil then
				if string.find(msg,"All Ok") then
					break
				end
			end
			yrest(5)
		until false
	end

	-- Change Profile Option
	changeProfileOption("RES_AUTOMATIC_AFTER_DEATH", false)
	changeProfileOption("TARGET_LEVELDIF_BELOW", 70)
	changeProfileOption("LOOT_IN_COMBAT", false)
	changeProfileOption("AUTO_ELITE_FACTOR", 70)
	changeProfileOption("LOOT_ALL", true)
   </onLoad>
Any ideas?

Re: onLoad event error with latest Release

Posted: Thu Jun 13, 2013 3:14 pm
by rock5
If you put the code in an lua file then 'include' it, it shows where the errors are. I got this,

Code: Select all

16: invalid escape sequence near '\M'
for a couple of lines.

'\M' is an invalid escape sequence. The reason you might not have gotten an error before is because lua 5.1 was lax in maintaining the rules. Lua 5.2, which Micromacro 1.3 uses, is more strict.

Just remove the '\' before the 'M' and that should fix it.