IS:ClickBoxerHelper

From Lavish Software Wiki
Revision as of 20:08, 30 October 2008 by Sylvisj (talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to navigation Jump to search

What is ClickBoxerHelper?

ClickBoxerHelper is a tweakable lavishscript object designed to overcome a few of the flaws in the current set of multiboxing tools as well as making things a bit more dynamic.

You need to customize a few things for use with this. Firstly, you need to make a method to load specific settings, and secondly you need to edit the switch block to call that method. I use two setups, one for Pyro and another for Blast, as such I have a switch block entry to check for Pyro and Blast as passed character names, and methods LoadPyroXML and LoadBlastXML to load their stuff. You will also want to change windowsnapper settings.

Features

  • More robust determining of multi-boxing sessions so as to enable these tools to work on other games (such as EVE Online) that have oddities to them in session number (EVE Online's loader is is1 and the actual game is is2).
  • Easy loading of separate settings, such as character-specific scripts and binds.
  • Enabling relaying to all multi-boxing sessions instead of all sessions or a specific session

Installing and Customizing ClickBoxerHelper

To obtain the code I use for ClickBoxerHelper, copy the following to a new ISS file (that is, make a new text file, save it as all files and .iss as the extension, and open that .iss file) and save it, in your InnerSpace\Scripts\ directory. I saved all of this as multi.iss. This is the up-to-date code I use.

/* Global (that is, global to all scrips in this session instance of the ClickBoxerHelper */
variable(global) ClickBoxerHelper CBH
function main(string Character)
{
	CBH:UpdateSessionsIndex
	while (${LavishScript.RunningTime} < ${CBH.LoadTimer})
	{
		echo "Loading scripts in ${Math.Calc[(${CBH.LoadTimer} - ${LavishScript.RunningTime}) / 1000]} seconds"
		wait 10
	}
	if (${CBH.MySessions.Used} == 0)
		CBH.Number:Set[1]
	else
		CBH.Number:Set[${CBH.GetAvailableNumber}]

	run windowsnapper -size 400x300 -pos -400,${Math.Calc[(${CBH.Number} - 1) * 300]}
	windowpos -viewable ${Display.DesktopX},${Display.DesktopY}
	windowsize -viewable 1280x960
	ui -load Interface/WoWSkin/WoWSkin
	ui -load -skin WoWSkin ClickerBoxer

	switch ${Character}
	{
		/* My first character */
		case Pyro
			echo "Loading Pyro XML"
			CBH:LoadPyroXML
			break
		/* My second character /
		case Blast
			echo "Loading Blast XML"
			CBH:LoadBlastXML
			break
		/* In case we're passed unhandled things */
		default
			echo "Unrecognized character, returning"
			return
	}

	/* Loop while the session is alive to prevent this script from ending */
	while (1==1)
	{
		CBH:UpdateSessionsIndex
		waitframe
	}
}

/* Atom executed as the script exits */
atom atexit()
{
	UIElement -kill clickerboxer
}

/* ClickBoxerHelper: Fix and enhance some of the issues with the current implemenation and running multiple games */
objectdef ClickBoxerHelper
{
	/*Which boxer session am I?*/
	variable int Number = 0
	/*What sessions are there?*/
	variable set MySessions
	/*and what are their numbers?*/
	variable collection:int SessionsNumbers
	/*Timer used for loading*/
	variable int LoadTimer = ${Math.Calc[${LavishScript.RunningTime} + 5000]}

	/* Easy way to relay a command (ex. keypresses, mouse movement) to all multiboxing sessions */
	method RelayToBoxers(string command)
	{
		if (${SessionsNumbers.FirstKey(exists)})
		{
			do
			{
				relay ${SessionsNumbers.CurrentKey} "${command}"
			}
			while (${SessionsNumbers.NextKey(exists)})
		}
	}

	/* Update the set of sessions */
	method UpdateSessionsIndex()
	{
		variable int i
		for (i:Set[1]; ${i} <= ${Sessions:Inc}; i:Inc)
		{
			if (!${MySessions.Contains[is${i}]})
				relay is${i} CBH:GetBoxerStatus[${Session}]
		}
	}

	/* Method another session will call to tell us if it's multiboxing */
	method SetBoxerStatus(string session, int number)
	{
		/* If we don't aleady have the session listed and the session isn't our current session and its number isn't 0 */
		if (!${MySessions.Contains[${session}]} && !${session.Equal[${Session}]} && ${number} != 0)
		{
			/* Add it and update the timer */
			MySessions:Add[${session}]
			SessionsNumbers:Set[${session}, ${number}]
			LoadTimer:Set[${LavishScript.RunningTime} + 5000]
		}
	}

	/* Have another session callback us and tell us if it's multiboxing */
	method GetBoxerStatus(string session)
	{
		relay ${session} "CBH:SetBoxerStatus[${Session}, ${Number}]"
	}

	/* Get the first available "Number" */
	member:int GetAvailableNumber()
	{
		variable int t = 1
		/* If we already have sessions... */
		if (${SessionsNumbers.FirstValue(exists)})
		{
			/* Find the first gap between sessions */
			do
			{
				if (${t} == ${SessionsNumbers.CurrentValue})
					t:Inc
				else
					return ${t}
			}
			while (${SessionsNumbers.NextValue(exists)})
			/* If there's no gap, add on to the end */
			if (!${SessionsNumbers.CurrentValue(exists)})
			{
				return ${t}
			}
		}
		/* Otherwise, just return 1 because it's the first boxing session */
		return 1
	}

	/* Load the ClickBoxer row for Pyro */
	method LoadPyroXML()
	{
		/* Set affinity for core 1 */
		proc 1 only
		/* Only pyro is running repeater */
		run repeater "mouse5"
		/* ClickBoxer additions for Pyro */
		UIElement[clickerboxer]:AddChild[frame, Pyro,\
			"<Frame name='Pyro'>\
				<Texture/>\
				<BackgroundColor/>\
				<Y>34</Y>\
				<Width>100%</Width>\
				<Height>20</Height>\
				<Children>\
					<text name='Pyro'>\
						<Text>Pyro</Text>\
						<Y>4</Y>\
						<Width>48</Width>\
						<Height>12</Height>\
						<Alignment>Right</Alignment>\
 					</text>\
 					<button name='tab'>\
 						<Text>Tab</Text>\
 						<X>50</X>\
 						<Y>2</Y>\
 						<Width>48</Width>\
 						<Height>16</Height>\
 						<OnLeftClick>\
 							<![CDATA[\
 								CBH:RelayToBoxers\[\"press tab\"\]\
 							]]>\
 						</OnLeftClick>\
 					</button>\
 					<button name='poly'>\
 						<Text>Polymorph</Text>\
 						<X>100</X>\
 						<Y>2</Y>\
 						<Width>48</Width>\
 						<Height>16</Height>\
 						<OnLeftClick>\
 							<![CDATA[\
 								CBH:RelayToBoxers\[\"press =\"\]\
 							]]>\
 						</OnLeftClick>\
 					</button>\
 				</Children>\
 			</Frame>", WoWSkin]
 	}
 
 	/* Load the ClickBoxer row for Blast */
 	method LoadBlastXML()
 	{
 		/* Set affinity to core 2 */
 		proc 2 only
 		/* ClickBoxer additions for Blast */
 		UIElement[clickerboxer]:AddChild[frame, Blast,\
 			"<Frame name='Blast'>\
 				<Texture/>\
 				<BackgroundColor/>\
 				<Y>34</Y>\
 				<Width>100%</Width>\
 				<Height>20</Height>\
 				<Children>\
 					<text name='Blast'>\
 						<Text>Blast</Text>\
 						<Y>4</Y>\
 						<Width>48</Width>\
 						<Height>16</Height>\
						<Alignment>Right</Alignment>\
					</text>\
					<button name='tab'>\
						<Text>Tab</Text>\
						<X>50</X>\
						<Y>2</Y>\
						<Width>48</Width>\
						<Height>16</Height>\
						<OnLeftClick>\
							<![CDATA[\
								CBH:RelayToBoxers\[\"press tab\"\]\
							]]>\
						</OnLeftClick>\
					</button>\
					<button name='poly'>\
						<Text>Polymorph</Text>\
						<X>100</X>\
						<Y>2</Y>\
						<Width>48</Width>\
						<Height>16</Height>\
						<OnLeftClick>\
							<![CDATA[\
								CBH:RelayToBoxers\[\"press =\"\]\
							]]>\
						</OnLeftClick>\
					</button>\
				</Children>\
			</Frame>", WoWSkin]
	}	
}

Tweaking and Customizing

Make your own Load methods and update the switch block to use them. Example: The switch block:

	switch ${Character}
	{
		case Sephiroph:
			echo "Loading Sephiroph settings"
			CBH:LoadSephirophSetting
	}

The method:

	method LoadSephirophSetting()
	{
		/* Set processor affinity to 1 so this session only uses core 1 of the cpu */
		proc 1 only
		/* Start repeater with mouse4 as the toggle bind */
		run repeater "mouse4"
		/* I don't need any custom xml, so I'm done */
	}

So on. Customize to your heart's content. I am using my right monitor as my main monitor with WoW fake fullscreened, and windowsnapper snapping windows to the left monitor (hence the negative point). You will most likely wish to change this. I am also using a very tweaked ClickBoxer named ClickerBoxer, you will want to change it to clickboxer if using that.

Launching and Using ClickBoxerHelper

For ClickBoxerHelper to work, you need an instance of it. The code I have above already has an instance we can use. To start this script (after tweaking and customizing, mind you) type:

run <scriptname> <charactername>

Example:

run multi Pyro

This will start the script, which will eventually check <charactername> (Pyro) against the entries in the switch block. In my case, it finds one and calls that method (LoadPyroXML). With ClickBoxerHelper running, you can use CBH:RelayToBoxers["<command>"] to relay a command to all multiboxing sessions running ClickBoxerHelper. Example: In one of pyro's xml buttons, I use:

CBH:RelayToBoxers\[\"press tab\"\]\

This is the character-escaped equivalent of:

CBH:RelayToBoxers["press tab"]

which, as you can guess, relays "press tab" to all multiboxing sessions. You can use this in any bind for that session so long as ClickBoxerHelper is running. You could even use something like:

CBH:RelayToBoxers["press f1;press alt+a;press escape"]

to target a party member, follow, then clear target, though this would break the "one repeated action per hardware action" rule.