[Orion] Attribute Accumulator (Items and Mobiles)

If you make a Client-side script you can publish it here for other players to use
Post Reply
MagicUser
Elder Scribe
Posts: 174
Joined: Mon Nov 03, 2014 2:24 pm
Location: PST

[Orion] Attribute Accumulator (Items and Mobiles)

Post by MagicUser »

I used to used UOSteam. One thing I disliked was that you could never get a reliable stat read from a player. Once I moved to Orion, I have obviously been able to play around quite a bit. I have gone back and forth tweaking various things and adding new features as I think of them, but I think this is pretty much about where I want it. I am very open to suggestions for additions, takeaways, or other critiques. Feel free to edit to your hearts content and be sure to let me know if you find anything that smells like a bug. I have tested it fairly well, but there is always at least one more hidden away.

Shout out to everyone in TC for just sitting there :D. Y'all made excellent targets for testing. Also for Fist confirming that he has an item without luck.

I am aware that if you try to use the script on your vendor, you will open up the contract options instead of the paperdoll. Nothing bad happens, you just don't get the attributes of the armor and weapon your vendor might be wearing.

Features:
  • Shows the player name.
  • Shows the name of the player's transformation graphic (Yes, even the Halloween costumes).
  • Shows the clothing stats (if there are any) in a sum by attribute name.
  • Shows a recommended cap (for example some players may want 25 DCI instead of the cap or the value that makes it so you can never go below cap, all caps are safe approximations that should be aimed for). -Note... Luck is listed at 1250. That's just been listed in the forums as a general goal above which there is rarely any point (besides bios).
  • Shows if under the recommended cap and by how much.
  • Shows Weapon stats (if there are any). Regardless of whether the weapon is one handed or twohanded.
  • Filters out the unnecessary information so you get what that armor/weapon is doing.
  • Handles non player mobiles (such as npcs, costumes, disguises, and even mobs even if its not very exciting).
  • Handles items, meaning you can use it on weapons and other items.
  • Using the script on a disguised player gives a funny message.
  • Using the script on an item (with no clothing or weapon attributes) just shows the name in your journal rather than clearing the text box.
  • Item selection results in showing the attribute name, value, and then cap for a leveled weapon (as a basis for how good it might be). - Note... Luck deeds can be used so I listed the item cap to be 400 instead of 150.
Code:

Code: Select all

//Item Selection.
function main() {
	//Tell the user to select something. Though it technically works on any target.
	Orion.Print('Select something.');
	//Set the Person.
	Orion.WaitForAddObject('item');
	while (!Orion.FindObject('item')) {
		Orion.WaitForAddObject('item');
	}
	
	//Get known player disguises.
	var disguises = getDisguiseInfo();
	
	//Check if object exists and its a mobile or a disguise.
	if (Orion.FindObject('item') && (Orion.FindObject('item').Mobile() || inList(Object.keys(disguises), Orion.FindObject('item').Graphic()))) {
		var mobile = 'item';
		//Write the clothing stats.
		writeClothingStats(mobile);
	}
	else if (Orion.FindObject('item') && !Orion.FindObject('item').Mobile()) {
		var item = 'item';
		//Write the item's stats.
		writeItemStats(item);
	}
}

//Write the item stats the TextWindow.
//Recieves: Item, the reference to the object (String).
function writeItemStats(item) {
	var clothingProps = relaventItemProps(Orion.FindObject(item));
	var weaponProps = relaventWeaponProps(Orion.FindObject(item));
	
	var indMax = defIndMax();
	
	if (clothingProps.length > 0 || weaponProps.length > 0) {
		//Clear the window.
		TextWindow.Clear();
		
		//Show the item name.
		write(Orion.FindObject(item).Properties().split('\n')[0]);
		
		//Check if there are clothing properties.
		if (clothingProps.length > 0) {
			//Title the clothing attributes.
			write('\nClothing attributes:');
			
			//Go through the clothing properties.
			for (var i = 0; i < clothingProps.length; i++) {
				//Get the name of the property.
				var prop = getFirstLetters(clothingProps[i]);
				
				//Check for resistances property (0/20 0/20 5/20 0/20 0/20).
				if (prop == 'Resistances:') {
					var str = '\t' + prop;
					
					var nums = listOfNums(clothingProps[i]);
					for (var j = 0; j < indMax[prop].length; j++) {
						str += ' ' + nums[j] + '/' + indMax[prop][j];
					}
					
					write(str);
				}
				//Write property (name value/max value that can be applied to a weapon).
				else
					write('\t' + removeChar(clothingProps[i], '%') + (indMax[prop] ? '/' + indMax[prop] : ''));
			}
		}
		
		//Check if there are weapon properties.
		if (weaponProps.length > 0) {
			write((clothingProps.length > 0 ? '\n' : String()) + 'Weapon attributes:');
			
			for (var i = 0; i < weaponProps.length; i++) {
				write('\t' + weaponProps[i]);
			}
		}
	}
	else {
		Orion.Print(Orion.FindObject(item).Properties().split('\n')[0]);
	}
}

function writeClothingStats(person) {
	//Check if the person exists.
	if (Orion.FindObject(person)) {
		//Attempt to open their paperdoll.
		Orion.RequestContextMenu(person);
		Orion.WaitContextMenuID(person, 0);
		
		//Wait for the paperdoll to open.
		Orion.Wait(500);
		
		//Get the list of relavent properties along with the accumulated value associated with them.
		var uniqueProps = getUniqueProps(person);
		var propValues = getStats(uniqueProps, person);
		
		//Remove the no longer necessary resistances tag.
		if (inList(uniqueProps, 'Resistances:'))
			uniqueProps.splice(indexOfKey(uniqueProps, 'Resistances:'), 1);
		
		//Get the serial - name pairs for player transformations.
		var graphics = getGraphicDictionary();
		//Get known player disguises.
		var disguises = getDisguiseInfo();
		//Check for disguises.
		
		if (!inList(Object.keys(disguises), Orion.FindObject(person).Graphic())) {
			TextWindow.Clear();
			//Header - "Player Name - Transformaton (graphic)".
			write(Orion.FindObject(person).Name() + ' - ' + graphics[Orion.FindObject(person).Graphic()] + ' (' + Orion.FindObject(person).Graphic() + ')');
			
			//Find if the player has stats on their clothing. Remove resistnaces when just the 5 resistances and the value is 0.
			var isStats = false;
			if (uniqueProps.length == 5) {
				for (var i = 0; i < uniqueProps.length; i++) {
					if (propValues[uniqueProps[i]] > 0)
						isStats = true;
					else
						uniqueProps.splice(indexOfKey(uniqueProps, uniqueProps[i--]), 1);
				}
			}
			else
				isStats = true;
			
			var max = defMax();
			
			if (isStats) {
				//Clothing Header - Prepares for clothing stats
				write('\nClothing Stats');
				//Write the clothing stats with their values.
				for (var i = 0; i < uniqueProps.length; i++) {
					var overVal = propValues[uniqueProps[i]] - max[uniqueProps[i]];
					
					var overString = '';
					if (overVal < 0)
						overString = ' (' + (-1 * overVal) + ' under suggested cap).';
					
					write('\t' + removeChar(uniqueProps[i], ':') + ': ' + propValues[uniqueProps[i]] + (max[uniqueProps[i]] ? '/' + max[uniqueProps[i]] + overString : ''));
				}
			}
			
			//Get the weapon properties.
			var weaponProps = getWeaponProps(person);
			
			if (weaponProps.length > 0) {
				//Weapon Header - Prepares for weapon stats or shows that the player doesn't have a weapon equiped (no dirty socks allowed).
				write('\nWeapon Stats');
				for (var i = 0; i < weaponProps.length; i++) {
					write('\t' + removeChar(weaponProps[i], ':'));
				}
			}
			
			//Close the paper doll if it isn't the player's paperdoll.
			if (Orion.GetSerial(person) != Orion.GetSerial(self))
				Orion.ClosePaperdoll(person);
		}
		else {
			//Funny message for disguises.
			Orion.Print('Huh, its a ' + disguises[Orion.FindObject(person).Graphic()] + '. Could it be a player disguised as a ' + disguises[Orion.FindObject(person).Graphic()] + '?');
		}
	}
	else
		Orion.Print('Individual not found.');
}

//Define the individual item max values.
//Returns: Dictionary[Key - Property Name: Value - Max Value]
function defIndMax() {
	var indMax = {};
	
	indMax['Defense Chance Increase'] = 50;
	indMax['Hit Chance Increase'] = 45;
	indMax['Damage Increase'] = 50;
	indMax['Swing Speed Increase'] = 40;
	indMax['Reflect Physical Damage'] = 15;
	
	indMax['Spell Damage Increase'] = 20;
	indMax['Faster Cast Recovery'] = 6;
	indMax['Faster Casting'] = 1;
	indMax['Lower Mana Cost'] = 10;
	indMax['Lower Reagent Cost'] = 20;
	indMax['Enhance Potions'] = 25;
	
	indMax['Hit Point Regeneration'] = 6;
	indMax['Stamina Regeneration'] = 10;
	indMax['Mana Regeneration'] = 6;
	indMax['Strength Bonus'] = 8;
	indMax['Dexterity Bonus'] = 8;
	indMax['Intelligence Bonus'] = 8;
	indMax['Hits Point Increase'] = 8;
	indMax['Stamina Increase'] = 8;
	indMax['Mana Increase'] = 8;
	
	indMax['Physical Resist'] = 20;
	indMax['Fire Resist'] = 20;
	indMax['Cold Resist'] = 20;
	indMax['Poison Resist'] = 20;
	indMax['Energy Resist'] = 20;
	
	indMax['Resistances:'] = [20, 20, 20, 20, 20];
	
	indMax['Luck'] = 400;
	
	return indMax;
}		

//Define the overall max values.
//Returns: Dictionary[Key - Property Name: Value - Max Value]
function defMax() {
	var max = {};
	
	max['Defense Chance Increase'] = 80;
	max['Hit Chance Increase'] = 70;
	max['Damage Increase'] = 100;
	max['Swing Speed Increase'] = 60;
	max['Faster Cast Recovery'] = 6;
	max['Faster Casting'] = 4;
	max['Lower Mana Cost'] = 40;
	max['Lower Reagent Cost'] = 100;
	max['Hit Point Regeneration'] = 55;
	max['Stamina Regeneration'] = 45;
	max['Mana Regeneration'] = 40;
	max['Luck'] = 1250;
	max['Physical Resist'] = 79;
	max['Fire Resist'] = 95;
	max['Cold Resist'] = 70;
	max['Poison Resist'] = 70;
	max['Energy Resist'] = 70;
	
	return max;
}

//Define possible disguises.
//Returns: Dictionary[Key - Graphic: Value - Name]
function getDisguiseInfo() {
	var diguises = {};
	
	//pumpkin disguise kit.
	diguises['0x16E7'] = 'Pumpkin';
	
	return diguises
}

//Returns a dictionary full of player graphics (Dictionary[Key - Graphics : Value - Name])
function getGraphicDictionary() {
	var dict = {};
	
	//Halloween Costumes.
	//Category: All Player
	dict['0x0023'] = 'Lizard Man';
	dict['0x0308'] = 'Minion';
	dict['0x0027'] = 'Mongbat';
	dict['0x0011'] = 'Orc';
	dict['0x0032'] = 'Skeleton';
	dict['0x0095'] = 'Succubus';
	dict['0x004C'] = 'Titan';
	dict['0x0035'] = 'Troll';
	dict['0x02F4'] = 'Exodus Overseer';
	dict['0x009A'] = 'Mummy';
	dict['0x0040'] = 'Panda Bear';
	dict['0x0018'] = 'Lich';
	dict['0x00F0'] = 'Kappa';
	dict['0x004A'] = 'Imp';
	dict['0x0004'] = 'Gargoyle';
	dict['0x00F7'] = 'Fan Dancer';
	dict['0x0080'] = 'Fairy';
	//John Warren's Fairy.
	dict['0x00B0'] = 'Fairy';
	dict['0x0012'] = 'Ettin';
	dict['0x000E'] = 'Earth Elemental';
	dict['0x004B'] = 'Cyclops';
	dict['0x0065'] = 'Centaur';
	
	//Category: 1 year vets
	dict['0x000F'] = 'Fire Elemental';
	dict['0x0056'] = 'Ophidian Warrior';
	dict['0x0048'] = 'Tarathan Matriarch';
	dict['0x0314'] = 'Sphinx';
	dict['0x0088'] = 'Tritan';
	dict['0x0039'] = 'Skeletal Knight';
	dict['0x005A'] = 'Bidpedal Cow';
	dict['0x00FC'] = 'Lady Of The Snow';
	dict['0x012F'] = 'Devourer Of Souls';
	dict['0x02F5'] = 'Exodus Minion';
	dict['0x0318'] = 'Chaos Daemon';
	dict['0x000D'] = 'Poison Elemental';
	dict['0x0010'] = 'Water Elemental';
	dict['0x0108'] = 'Irk';
	dict['0x0007'] = 'Orc Captain';
	
	//Category: 2 year vets
	dict['0x017D'] = 'Grim Reaper';
	dict['0x017E'] = 'Shadow Priestess';
	dict['0x010F'] = 'Satyr';
	dict['0x0089'] = 'Ignus';
	dict['0x00AB'] = 'Mushroom';
	dict['0x0310'] = 'Arcane Demon';
	dict['0x0300'] = 'Juggernaut';
	
	//Pumkin disguise kit
	dict['0x16E7'] = 'Pumpkin';
	
	//Werewolf
	dict['0x00B3'] = 'Were Wolf';
	
	//Human
	dict['0x0190'] = 'Male';
	dict['0x0191'] = 'Female';
	dict['0x0192'] = 'Ghost';
	
	//Animal Forms
	dict['0x0084'] = 'Kirin';
	dict['0x007A'] = 'Unicorn';
	dict['0x00F6'] = 'Bake-kitsune';
	dict['0x00E1'] = 'Wolf';
	dict['0x00DC'] = 'Llama';
	dict['0x00DA'] = 'Ostard';
	dict['0x0051'] = 'Bullfrog';
	dict['0x0015'] = 'Giant Serpant';
	dict['0x00D9'] = 'Dog';
	dict['0x00C9'] = 'Cat';
	dict['0x00EE'] = 'Rat';
	dict['0x00CD'] = 'Rabbit';
	
	//Polymorph Forms
	dict['0x00D0'] = 'Chicken';
	dict['0x00D6'] = 'Panther';
	dict['0x001D'] = 'Gorilla';
	dict['0x00D3'] = 'Black Bear';
	dict['0x00D4'] = 'Grizzly Bear';
	dict['0x00D5'] = 'Polar Bear';
	dict['0x0033'] = 'Slime';
	dict['0x0001'] = 'Ogre';
	dict['0x0009'] = 'Daemon';
	
	//Cleric Forms
	dict['0x007B'] = 'Angel';
	
	//Necro Forms
	dict['0x02EA'] = 'Horrific Beast';
	dict['0x02ED'] = 'Wraith';
	
	return dict;
}

//Retrieve a mobile's weapon properties.
//Recieves a serial (String).
//Returns a list of weapon property names List[String].
function getWeaponProps(person) {
	var weaponProps = [];
	
	//Gets weapon stats even if weapon is 2 handed (in shield slot).
	if (Orion.ObjAtLayer(1, person))
		weaponProps = relaventWeaponProps(Orion.ObjAtLayer(1, person));
	else if (Orion.ObjAtLayer(2, person) && Orion.Contains(Orion.ObjAtLayer(2, person).Properties(), 'Two-handed Weapon'))
		weaponProps = relaventWeaponProps(Orion.ObjAtLayer(2, person));
	
	return weaponProps;
}

//Retrieves a mobile's unique item property names.
//Receives a serial (String).
//Returns the relavent unique property names (List[String]).
function getUniqueProps(person) {
	var uniqueProps = [];
	
	//Go through all player slots.
	for (var i = 1; i <= 23; i++) {
		//Check if the player is wearing something in the slot.
		if (Orion.ObjAtLayer(i, person) && i != 11) {
			//Get the props of an item.
			var props = relaventItemProps(Orion.ObjAtLayer(i, person));
			
			//Go through the properties of the item (not the name).
			for (var j = 0; j < props.length; j++) {
				//Get the name associated with the property. Assumes that there is no numbers
				//	 in the name.
				var firstLetters = getFirstLetters(props[j]);				
				
				//If the name is unique and not empty, add it to the list.
				if (!inList(uniqueProps, firstLetters) && firstLetters.length > 0)
					uniqueProps.push(getFirstLetters(props[j]));
			}
		}
	}
	
	//Get necessary resists and ensure they are in the list.
	resists = getResistNames();
	for (var i = 0; i < resists.length; i++) {
		if (!inList(uniqueProps, resists[i]))
			uniqueProps.push(resists[i]);
	}
	//Make it so the list is in a similar orientation every time.
	uniqueProps.sort();
		
	return uniqueProps
}

//Gets the values associated with unique properties.
//		Resistances are split up into their proper names.
//Recieves the unique names of Properties (List[String])
//				  a serial (String).
//Returns a Dictionary[key - name of property : value - sum of found associated values].
function getStats(uniqueProps, person) {
	var dict = {};
	
	//Set up the default resistance values (to account for Resistances: -- -- 1% -- --).
	var resists = getResistNames();
	for (var i = 0; i < resists.length; i++) {
		dict[resists[i]] = 0;
	}
	
	//Go through all items a player is wearing.
	for (var i = 1; i <= 23; i++) {
		//Check if a player is wearing an item in that slot.
		if (Orion.ObjAtLayer(i, person) && i != 11) {
			//Strip the item of all the pretty stuff.
			var props = relaventItemProps(Orion.ObjAtLayer(i, person));
			
			//Go through the relavent properties of an item.
			for (var j = 0; j < props.length; j++) {
				//Ensure that there is a value setup before trying to add to it.
				if (!dict[getFirstLetters(props[j])])
					dict[getFirstLetters(props[j])] = 0;
				
				//Check if the property is the more complex Resistances property.
				//If not just add the first value listed for the property to the previously summed properties. (Val: 0 -> Val: 2 etc).
				if (Orion.Contains(getFirstLetters(props[j]), 'Resistances:')) {
					//Get the list of resitances.
					var list = listOfNums(props[j]);
					
					//Sort the resitances and sum them with their associated props (Fire Resist: 0 -> Fire Resist: 2).
					for (var k = 0; k < resists.length; k++) {
						dict[resists[k]] += list[k];
					}
				}
				else
					dict[getFirstLetters(props[j])] += listOfNums(props[j])[0];
			}
		}
	}
	
	return dict;
}

//Get the list of player resistances.
//Returns the player resistance names List[String].
function getResistNames() {
	return ['Physical Resist', 'Fire Resist', 'Cold Resist', 'Poison Resist', 'Energy Resist'];
}

//Get the relavent item properties.
//Recieves an item (Orion Object).
//Returns a list of filtered props (List[String]).
function relaventItemProps(item) {
	//Setup what a relavent prop is.
	var props = '';
	var relaventProps = [];
	var badProps = getNonClothingProps();
	
	//Check if the item exists.
	if (item) {
		//Get the item properties, but then split it by newline and remove anything in <>.
		props = parseString(item.Properties(), '\n', '<', '>');
		
		//Go through properties.
		for (var i = 1; i < props.length; i++) {
			if (listOfNums(props[i]).length > 0 && indexOfKey(badProps['Part'], props[i]) == -1 && !inList(badProps['Full'], getFirstLetters(props[i]))) {
				var prop = props[i];
				
				//Turn Resistances: -- -- 5% -- -- into Resistances: 0% 0% 5% 0% 0%.
				if (Orion.Contains(props[i], 'Resistances:') && Orion.Contains(props[i], '--'))
					prop = replaceDashes(props[i]);
				
				//Make sure nothing squirelly is going on.
				if (prop[0] != ' ' && prop[prop.length - 1] != ' ' && (Orion.Contains(props[i], 'Resistances:') || listOfNums(prop).length > 0 && listOfNums(prop)[0] > 0))
					relaventProps.push(prop);
			}
		}
	}
	
	return relaventProps;
}

//The non relavent clothing properties.
//Part - Partial Text.
//Full - Complete Text.
function getNonClothingProps() {
	return {'Part': ['Weapon Damage', 'Range', 'Spells', 'Items', 'Recall Rune'],
				'Full': ['Strength Requirement', 'Artifact Rarity', 'Hit Life Leech', 'Hit Stamina Leech', 'Hit Mana Leech', 'Hit Lower Attack', 'Hit Lower Defense', 'Hit Magic Arrow', 'Hit Harm', 'Hit Fireball', 'Hit Lightning', 'Hit Dispel', 'Hit Cold Area', 'Hit Fire Area', 'Hit Poison Area', 'Hit Energy Area', 'Hit Physical Area', 'Total Resist:', 'Physical Damage', 'Fire Damage', 'Poison Damage', 'Energy Damage', 'Cold Damage', 'Lower Requirements', 'Uses Remaining:', 'Self Repair', 'Durability', 'Charges:', 'Value:']};
}

//Get the relavent weapon properties.
//Recieves item (Orion Object).
//Returns relavent property names (List[String]).
function relaventWeaponProps(item) {
	//Setup what a relavent prop is.
	var props = '';
	var relaventProps = [];
	var goodProps = getWepProps();
	
	//Check if the item exists.
	if (item) {
		//Remove all the fancy stuff from the property list.
		props = parseString(item.Properties(), '\n', '<', '>');
		
		//go through props.
		for (var i = 0; i < props.length; i++) {
			//Check if the prop is listed and not empty.
			if (listOfNums(props[i]).length > 0 && (indexOfKey(goodProps['Part'], props[i]) > -1 || inList(goodProps['Full'], getFirstLetters(props[i])))) {
				var prop = props[i];
				
			   //Ensure no funny business.
				if (prop[0] != ' ' && prop[prop.length - 1] != ' ')
					relaventProps.push(prop);
			}
		}
	}
	
	return relaventProps;
}	

//The desired weapon props. Doesn't have to be full string, but should be unique. I.E. Damage would qualify for Damage Increase, Spell Damage Increase, Physical Damage, etc.
//Part - Partial Text.
//Full - Complete Text.
function getWepProps	() {
	return {'Part': ['Weapon Damage', 'Range', 'Strength Requirement'],
				'Full': ['Hit Life Leech', 'Hit Stamina Leech', 'Hit Mana Leech', 'Hit Lower Attack', 'Hit Lower Defense', 'Hit Magic Arrow', 'Hit Harm', 'Hit Fireball', 'Hit Lightning', 'Hit Dispel', 'Hit Cold Area', 'Hit Fire Area', 'Hit Poison Area', 'Hit Energy Area', 'Hit Physical Area', 'Physical Damage', 'Fire Damage', 'Poison Damage', 'Energy Damage', 'Cold Damage']};
}

//Get the numbers before a number.
//Recieves a string (String).
//Returns the string before a number (String).
function getFirstLetters(string) {
	var str = '';
	var found = false;
	var i = 0;
	
	//Get list of pieces between spaces.
	var props = string.split(' ');
	while (i < string.length && !found) {
		//Form the string based on first, 
		if (i == 0)
			str += props[i];
		else if (props[i] && Orion.Contains(String(Number(props[i].split('%')[0])), 'NaN'))
			str += ' ' + props[i];
		else
			found = true;
		
		i++;
	}
	
	return str;
}

//Replaces dashes with 0%.
//Recieves a string (String).
//Returns a string with all -- replaced as 0%.
function replaceDashes(string) {
	var str = '';
	
	if (Orion.Contains(string, '--')) {
		var props = string.split(' ');
		
		for (var i = 0; i < props.length; i++) {
			if (i == 0)
				str += props[i];
			else if (Orion.Contains(props[i], '%'))
				str += ' ' + props[i];
			else
				str += ' ' + '0%';
		}
	}
	
	return str;
}

//split string based on deliminator and then remove anything between open and close.
//Recieves string, to parse (String).
//				  delim, the deliminator to split upon (String).
//					open, e.g. '<' (String).
//					close, e.g. '>' (String).
function parseString(string, delim, open, close) {	
	var strings = string.split(delim);
	
	//Go over strings.
	for (var i = 0; i < strings.length; i++) {
		//Remove irrelevent contents between open and close.
		strings[i] = removeBrackets(strings[i], open, close);
	}
	
	return strings;
}

//remove contents between open and close. For example '<' and '>'.
//Recieves: string, the input string (String).
//					open, the opening character (String).
//					close, the closing character (String).
//Returns:	str, the string with the contents between open and close removed (String).
function removeBrackets(string, open, close) {
	var str = '';
	
	//Keep track of valid string and string to remove.
	var bracketed = false;
	//Go over string.
	for (var i = 0; i < string.length; i++) {
		//Flip visible string editing based on open and close. '<' -> invisible, '>' -> visible.	
		if (string[i] == open || string[i] == close)
				bracketed = !bracketed;
		
		//if visible and not the closing piece.
		if (!bracketed && string[i] != close)
			str += string[i];
	}
	
	return str;
}

//Get the list of numbers in the string.
//Recieves: string, the input string (String).
//Returns: numList, the list of numbers in string (List[Int]).
function listOfNums(string) {
	var numList = [];
	//Split around spaces as Number(' ') = 0.
	var splitString = string.split(' ');
	
	//Check each word for number (even around %) and add it to the list.
	for (var i = 0; i < splitString.length; i++) {
		var numString = splitString[i].split('%')[0].split(',')[0];
		
		if (!Orion.Contains(String(Number(numString)), 'NaN'))
			numList.push(Number(numString));
	}
	
	return numList;
}

//Show the index of where the key can be found in the list.
//Recieves: list, the list to check (List[Object]).
//				   key, the thing to find in the list (Object).
//Returns: index, the index where the key was found (Int).
function indexOfKey(list, key) {
	var index = 0;
	var found = false;
	
	//Go over list, until the index is found or the list has been analyzed completely.
	while (index < list.length && !found) {
		//If the key is in the list index at all.
		if (Orion.Contains(list[index], key) || Orion.Contains(key, list[index]))
			found = true;
		else
			index++;
	}
	
	//If not found - make the index an impossible value.
	if (!found)
		index = -1;
	
	return index;
}

//Is the key in the list.
//Recieves: list, the list to check (List[Object]).
//				   key, the key to look for (Object).
//Returns: found, whether the key was found (Boolean).
function inList(list, key) {
	var found = false;
	var i = 0;
	
	//Check if key was found or list has been traversed.
	while (i < list.length && !found) {
		found = list[i++] == key;
	}
	
	return found;
}

//Remove the character from the string.
//Recieves: string, the input string (String).
//					char, the char to look for (String).
//Returns: str, the string with all char removed (String).
function removeChar(string, char) {
	var str = '';
	
	//Go over string.
	for (var i = 0; i < string.length; i++) {
		//Only add chars that are the not the bad char.
		if (string[i] != char)
			str += string[i];
	}
	
	return str
}

//Print to TextWindow.
//Recieves: message, the message to print (String).
function write(message) {
	TextWindow.Open();
	TextWindow.Print(message);
}
Respectfully,
Paroxysmus ILV Master Spellcaster
MagicUser
Elder Scribe
Posts: 174
Joined: Mon Nov 03, 2014 2:24 pm
Location: PST

Re: [Orion] Attribute Accumulator (Items and Mobiles)

Post by MagicUser »

PlayerAccumulator.jpg
PlayerAccumulator.jpg (78.15 KiB) Viewed 3233 times
disguiseMessage.jpg
disguiseMessage.jpg (17.52 KiB) Viewed 3233 times
sphinx.jpg
sphinx.jpg (90.18 KiB) Viewed 3233 times
Item.jpg
Item.jpg (82.18 KiB) Viewed 3233 times
Respectfully,
Paroxysmus ILV Master Spellcaster
MagicUser
Elder Scribe
Posts: 174
Joined: Mon Nov 03, 2014 2:24 pm
Location: PST

Re: [Orion] Attribute Accumulator (Items and Mobiles)

Post by MagicUser »

Have at it :D.
npc_w_weapon.jpg
npc_w_weapon.jpg (42.02 KiB) Viewed 3232 times
npc_w_cloth.jpg
npc_w_cloth.jpg (49.14 KiB) Viewed 3232 times
misclick_stillAnItem.jpg
misclick_stillAnItem.jpg (50.11 KiB) Viewed 3232 times
AnyMobile.jpg
AnyMobile.jpg (22.95 KiB) Viewed 3228 times
Respectfully,
Paroxysmus ILV Master Spellcaster
Nick
Legendary Scribe
Posts: 515
Joined: Fri Sep 24, 2010 12:40 pm
Location: PA native, liveing in NC right now Moveing to TX in march

Re: [Orion] Attribute Accumulator (Items and Mobiles)

Post by Nick »

Can we get tile in TC that is really a polymorphed player running this script that just auto PMS you the results if you step on it/him/her? lol I don't have orion but this would be very nice to have
MagicUser
Elder Scribe
Posts: 174
Joined: Mon Nov 03, 2014 2:24 pm
Location: PST

Re: [Orion] Attribute Accumulator (Items and Mobiles)

Post by MagicUser »

Nick wrote:
Fri Oct 22, 2021 1:28 pm
Can we get tile in TC that is really a polymorphed player running this script that just auto PMS you the results if you step on it/him/her? lol I don't have orion but this would be very nice to have
Oh, you tempt me :D. I haven't gotten into pm gumps yet, but I know Zeee did something fancy with his so I intend to dive in as well sometime. Checking if a player is overlapping with a location wouldn't be difficult at all (I have had quite a bit of practice with object location). I think the most challenging part would be dealing with the pm buffer and then having someone who is always around :D. As a side note though... you might want to confirm that they actually want their results, because that could be considered spamming (especially in tc), or harassments otherwise.

Do you wish to have you stats pmed to you?
Yes.
Calculating.
Sent.

I don't know. I feel like it'd be easier to meet with someone and request that the results get pmed to you. I love this idea though. Having an NPC that you can find and will tell you your stats in a formal gump sounds like an amazing idea.... Should I make a suggestion to +C?
Respectfully,
Paroxysmus ILV Master Spellcaster
MagicUser
Elder Scribe
Posts: 174
Joined: Mon Nov 03, 2014 2:24 pm
Location: PST

Re: [Orion] Attribute Accumulator (Items and Mobiles)

Post by MagicUser »

Alternatively you could also change the write method so that it uses Orion.Say(message) instead of using the TextWindow. Then the person getting their stats viewed would be able to see the results in their journal.
Respectfully,
Paroxysmus ILV Master Spellcaster
Post Reply