Page 1 of 1

multiple onload in the same file ?

Posted: Wed Jul 25, 2012 10:46 am
by s018mes
Can you use 2 different onload sections within the same waypoint file?

It doesn't seem to load the GMDetect or any of the options in the first onload. It only loads the function onload. I know you can also use the profile file to inject onload features.

But could you combine ProfileOptions and Functions within the same onload?

Like:

Code: Select all

   <onLoad>
   cprintf(cli.white, "DOD LET'S RUN THIS");
changeProfileOption("AUTO_ELITE_FACTOR", 2500);
changeProfileOption("COMBAT_DISTANCE", 75);
changeProfileOption("COMBAT_RANGED_PULL", false);
changeProfileOption("QUICK_TURN", false);
startGMDetect();
  </onLoad>

<onload>
function bossbuff()
   if player.Class1 == 4 and player.Class2 == 5 then -- mage/priest
      player:cast("MAGE_ENERGY_INFLUX")
      player:cast("MAGE_ELECTROSTATIC_CHARGE")      
      player:cast("MAGE_SOLDIERS_CHARGE")
      player:cast("MAGE_INTENSIFICATION")
      player:cast("MAGE_ELEMENTAL_CATALYST")
   end
   if inventory:itemTotalCount(206874) > 1 then
	useGoodie(206874)
   end
   if inventory:itemTotalCount(206890) > 1 then
	useGoodie(206890)
   end
end
</onload>

Re: multiple onload in the same file ?

Posted: Wed Jul 25, 2012 1:37 pm
by rock5
The onload probably just gets loaded twice and the second one overwrites the first one. You should be able to merge them into 1 onload.

Re: multiple onload in the same file ?

Posted: Wed Jul 25, 2012 6:58 pm
by lisa
having 2 onload is like defining a variable twice.

lollies = true
lollies = false

you overwrite the first bit of code with the second.

You should be able to have all that code you posted in a single onload and work fine.

Code: Select all

  <onLoad>
   cprintf(cli.white, "DOD LET'S RUN THIS");
changeProfileOption("AUTO_ELITE_FACTOR", 2500);
changeProfileOption("COMBAT_DISTANCE", 75);
changeProfileOption("COMBAT_RANGED_PULL", false);
changeProfileOption("QUICK_TURN", false);
startGMDetect();

function bossbuff()
   if player.Class1 == 4 and player.Class2 == 5 then -- mage/priest
      player:cast("MAGE_ENERGY_INFLUX")
      player:cast("MAGE_ELECTROSTATIC_CHARGE")      
      player:cast("MAGE_SOLDIERS_CHARGE")
      player:cast("MAGE_INTENSIFICATION")
      player:cast("MAGE_ELEMENTAL_CATALYST")
   end
   if inventory:itemTotalCount(206874) > 1 then
   useGoodie(206874)
   end
   if inventory:itemTotalCount(206890) > 1 then
   useGoodie(206890)
   end
end
</onload>

Re: multiple onload in the same file ?

Posted: Wed Jul 25, 2012 10:16 pm
by s018mes
I get the following error when trying the code Lisa suggested:


haltOnError: false
Did not find any crashed game clients.
10:13pm - wapypointlist.lua:24: XML Parse Error.
Line 26
Column: 3
Pos: 788
Message; mismatched tag

Re: multiple onload in the same file ?

Posted: Wed Jul 25, 2012 10:22 pm
by s018mes
AH.... It works now.

Both I and Lisa forgot to capitalize : </onLoad>

But,

I am not sure if GMdetect is activated. I thought it use to say GMDetect started or something in the Rombot.

Re: multiple onload in the same file ?

Posted: Wed Jul 25, 2012 10:49 pm
by lisa
s018mes wrote:AH.... It works now.

Both I and Lisa forgot to capitalize : </onLoad>

But,

I am not sure if GMdetect is activated. I thought it use to say GMDetect started or something in the Rombot.
onLoad or onload doesn't matter aslong as both the same it seems
<onload>
</onload>
or
<onLoad>
</onLoad>

You also need to have the GMdetect in the profile set aswell.

Code: Select all

		<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="" />  -- 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="playerDETECT"		value="true" /> -- enables the player detection userfunction