Equip, unequip

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Equip, unequip

Post by Poi »

How might i create 2 commands, one that unequips all tiems(.unequip) and one that equips the items you unequiped last?(.equip)
Mephisto
New User
Posts: 13
Joined: Mon Mar 06, 2006 10:28 pm

Post by Mephisto »

Do you want to unequip everything? armor, clothes, weapons, etc... all at once? Or just weapons/shields?
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Everything
qrak
Grandmaster Poster
Posts: 198
Joined: Sun Feb 05, 2006 4:35 pm

Post 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
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

It does not compile
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
kylee
New User
Posts: 6
Joined: Thu May 04, 2006 3:58 pm

Post by kylee »

Ya i need a .equip file too.. like the one poi is asking for
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Gnafu
Grandmaster Poster
Posts: 136
Joined: Thu Feb 02, 2006 7:29 am

Post 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...
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post 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!
kylee
New User
Posts: 6
Joined: Thu May 04, 2006 3:58 pm

Post by kylee »

yup.. thats more then i need.. thanks yukiko :D
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

I try.

Sometimes I wonder whather I am not more useful just posting here than trying to run a shard. :P
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Hehe either one you helped my shard alot so far.. Join my shard, and just get me a working website haha :D
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Post Reply