Page 1 of 1

Equip, unequip

Posted: Fri Apr 21, 2006 2:35 pm
by Poi
How might i create 2 commands, one that unequips all tiems(.unequip) and one that equips the items you unequiped last?(.equip)

Posted: Sat Apr 22, 2006 5:53 pm
by Mephisto
Do you want to unequip everything? armor, clothes, weapons, etc... all at once? Or just weapons/shields?

Posted: Sun Apr 23, 2006 5:11 am
by Poi
Everything

Posted: Sun Apr 23, 2006 5:16 am
by qrak
.unequip

Code: Select all

use uo;
use os;

include "include/client";

program unequip(me, text)
	set_critical(1);
	if (me.dead)
		return;
	endif

	case (lower(text))
	"jewel":
		foreach thing in ListEquippedItems(me)
			if (RemoveJewl( me, thing))
				MoveItemToContainer(thing, me.backpack);
			endif
		endforeach
	"jewelry":
		foreach thing in ListEquippedItems(me)
			var jewl := 0;
			if (RemoveIt(me,thing,jewl))
				MoveItemToContainer(thing, me.backpack);
			endif
		endforeach
	default:
		foreach thing in ListEquippedItems(me)
			var jewl := 1;
			if (RemoveIt(me,thing,jewl))
				MoveItemToContainer(thing, me.backpack);
			endif
		endforeach
	endcase

endprogram

function RemoveIt(me, it, jewl)
	var ring := GetEquipmentByLayer( me, LAYER_RING );
	if (it.serial == ring.serial)
		return jewl;
	endif

	var bracelet := GetEquipmentByLayer( me, LAYER_WRIST );
	if (it.serial == bracelet.serial)
		return jewl;
	endif

	var earrings := GetEquipmentByLayer( me, LAYER_EARS );
	if (it.serial == earrings.serial)
		return jewl;
	endif

	var neck := GetEquipmentByLayer( me, LAYER_NECK );
	if (it.serial == neck.serial)
		if (IsNecklace(it))
			return jewl;
		endif
	endif

	var beard := GetEquipmentByLayer( me, LAYER_BEARD );
	if (it.serial == beard.serial)
		return 0;
	endif

	var hair := GetEquipmentByLayer( me, LAYER_HAIR );
	if (it.serial == hair.serial)
		return 0;
	endif

	var mount :=  GetEquipmentByLayer( me, LAYER_MOUNT );
	if (it.serial == mount.serial)
		return 0;
	endif

	if (it.objtype == 0x204e)
		return;
	endif

	var mypack := me.backpack;
	if (it.serial == mypack.serial)
		return 0;
	endif

	return 1;
endfunction

function RemoveJewl(me, it)
	if (it.objtype == 0x204e)
		return;
	endif

	var ring := GetEquipmentByLayer( me, LAYER_RING );
	if (it.serial == ring.serial)
		return 1;
	endif

	var bracelet := GetEquipmentByLayer( me, LAYER_WRIST );
	if (it.serial == bracelet.serial)
		return 1;
	endif

	var earrings := GetEquipmentByLayer( me, LAYER_EARS );
	if (it.serial == earrings.serial)
		return 1;
	endif

	var neck := GetEquipmentByLayer( me, LAYER_NECK );
	if (it.serial == neck.serial)
		if (IsNecklace(it))
			return 1;
		endif
	endif
endfunction

function IsNecklace(item)
	case (item.graphic)
		0x1085:
			return 1;
		0x1088:
			return 1;
		0x1089:
			return 1;
		0x1f05:
			return 1;
		0x1f08:
			return 1;
		0x1f0a:
			return 1;
		default:
			return 0;
	endcase
	return;
endfunction

Posted: Sun Apr 23, 2006 10:24 am
by Poi
It does not compile

Posted: Sun Apr 23, 2006 9:12 pm
by CWO
give the compile error so we can help. It compiled fine here using the 1-18-2006 Ecompile. And I havent picked out anything in that script that can be very new to POL.

Posted: Thu May 04, 2006 4:40 pm
by kylee
Ya i need a .equip file too.. like the one poi is asking for

Posted: Fri May 05, 2006 12:29 pm
by Yukiko
The World of Dreams and I think Sanctuary shard scripts have .dress amd .undress commands in them. Let me try to find them and post them. Thoise do what you want.

Posted: Fri May 05, 2006 1:16 pm
by Yukiko
Here are the arm and disarm scripts from World of Dreams. These are basically what you are asking for. They provide three sets of equip and unequip user defined items. There is even a text file with user instructions included. I cannot provide support for them. They may need tweaking to compile under POL 96.


Use at your own risk. Not responsible for damage from fire, flood or power supply explosions etc.

Posted: Sat May 06, 2006 12:39 am
by Gnafu
I think you better put all the unequipped items into a container created by the script , so it will be a little bit simple to re-equip all the items...

Posted: Sat May 06, 2006 5:11 am
by Poi
Thank you yukiko! These scripts are veryc lose to what i need and if i cannot modify them to unequip all things then arm and disarm will work. Thanks a ton!

Posted: Sat May 06, 2006 5:49 am
by kylee
yup.. thats more then i need.. thanks yukiko :D

Posted: Sat May 06, 2006 1:09 pm
by Yukiko
I try.

Sometimes I wonder whather I am not more useful just posting here than trying to run a shard. :P

Posted: Sun May 07, 2006 2:59 pm
by Poi
Hehe either one you helped my shard alot so far.. Join my shard, and just get me a working website haha :D

Posted: Mon May 08, 2006 2:39 pm
by Yukiko
I am in the process of switching to an HTML main page and then using the stand-alone PHP-BBS system like they have done here with the POL website. I am not "nuke" savvy enough to create a nice looking site in PHPNuke.