Script not working

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
Galbuu
UOX3 Neophyte
Posts: 45
Joined: Mon Jul 05, 2004 9:20 am
Location: Orlando, FL
Has thanked: 0
Been thanked: 0
Contact:

Script not working

Post by Galbuu »

Can anyone figure out why this script isn't working? It's supposed to give you a new name and if you double click the item again it resets your name to your old one. Right now it always gives you a new name.

Code: Select all

function onUse(pUser, iUsed)
{
	if(pUser.gender == 0)
	{
	var randomNum = RollDice( 1, 30, 0 );
	var vName = "";
	switch( randomNum )
		{
		case 1: vName = "Johan"; break;
		case 2: vName = "Joshua"; break;
		case 3: vName = "Ben"; break;
		case 4: vName = "Mervin"; break;
		case 5: vName = "Scali"; break;
		case 6: vName = "Chadwick"; break;
		case 7: vName = "Jamel"; break;
		case 8: vName = "Reid"; break;
		case 9: vName = "Jarret"; break;
		case 10: vName = "Mitchel"; break;
		case 11: vName = "Zane"; break;
		case 12: vName = "Alphonse"; break;
		case 13: vName = "Batala"; break;
		case 14: vName = "Morton"; break;
		case 15: vName = "Wylburn"; break;
		case 16: vName = "Myles"; break;
		case 17: vName = "Anderson"; break;
		case 18: vName = "Randell"; break;
		case 19: vName = "Weicht"; break;
		case 20: vName = "Galavorn"; break;
		case 21: vName = "Major"; break;
		case 22: vName = "Tenebar"; break;
		case 23: vName = "Claudio"; break;
		case 24: vName = "Lazaro"; break;
		case 25: vName = "Kennith"; break;
		case 26: vName = "Forrest"; break;
		case 27: vName = "Carmine"; break;
		case 28: vName = "Morton"; break;
		case 29: vName = "Johny"; break;
		case 30: vName = "Augustine"; break;
		}
	}
	else
	{
	var randomNum = RollDice( 1, 30, 0 );
	var vName = "";
	switch( randomNum )
		{
		case 1: vName = "Ashlea"; break;
		case 2: vName = "Dodie"; break;
		case 3: vName = "Tenebres"; break;
		case 4: vName = "Shiloh"; break;
		case 5: vName = "Amera"; break;
		case 6: vName = "Yuette"; break;
		case 7: vName = "Eladia"; break;
		case 8: vName = "Estefana"; break;
		case 9: vName = "Fidelia"; break;
		case 10: vName = "Christia"; break;
		case 11: vName = "Dakota"; break;
		case 12: vName = "Elsy"; break;
		case 13: vName = "Concha"; break;
		case 14: vName = "Charlsie"; break;
		case 15: vName = "Toccara"; break;
		case 16: vName = "Denise"; break;
		case 17: vName = "Katerine"; break;
		case 18: vName = "Catherine"; break;
		case 19: vName = "Elizabeth"; break;
		case 20: vName = "Shandi"; break;
		case 21: vName = "Delilah"; break;
		case 22: vName = "Eula"; break;
		case 23: vName = "Lola"; break;
		case 24: vName = "Rose"; break;
		case 25: vName = "Kallie"; break;
		case 26: vName = "Evita"; break;
		case 27: vName = "Fidelia"; break;
		case 28: vName = "Carylon"; break;
		case 29: vName = "Felucca"; break;
		case 30: vName = "Janyce"; break;
		}
	}

	if(pUser.GetTag("dkit") == null || pUser.GetTag("dkit") == 0)
	{
		if(pUser.GetTag("hrobe") == 1)
		{
		pUser.SysMessage("You can not use a disguise kit while wearing a hooded robe.");
		}
		else
		{
		pUser.SetTag("dname", pUser.name);
		pUser.SysMessage("You select a new identity.");
		pUser.name = vName;
		pUser.SetTag("dkit", 1);
		}
	}
	else if(pUser.GetTag("dkit") == 1)
	{
	var vOldName = pUser.GetTag("dname");
	pUser.name = vOldName;
	pUser.SetTag("dkit", 0);
	}

return false;
}
The reference to hrobe is from another script of mine so don't worry about it (unless it's causing the problem, which I doubt).
mrboris
UOX3 Neophyte
Posts: 28
Joined: Wed Jun 30, 2004 4:00 am
Has thanked: 0
Been thanked: 0
Contact:

Post by mrboris »

it all works for me, gives old name back and everything, maybe you should send another sysmessage that your name has be changed back, otherwise the only way to tell is ot reopen your paperdoll or click yourself.


if anything, set it up as a timer as soon as timers works, cause i think xuri said that they dontw ork right, and if they do they are buggy *shrugs*
Galbuu
UOX3 Neophyte
Posts: 45
Joined: Mon Jul 05, 2004 9:20 am
Location: Orlando, FL
Has thanked: 0
Been thanked: 0
Contact:

Post by Galbuu »

Well I'll be damned...

I guess the char I was testing on had some messed up tags or something. Tried it with another char and it worked.
Post Reply