Trouble with StaticEffect in a gump

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:

Trouble with StaticEffect in a gump

Post by Galbuu »

Code: Select all

function onUse(pUser, iUsed)
{
mySock = pUser.socket;

	var myGump = new Gump;
	myGump.AddPage( 0 );
	myGump.AddGump( 29, 263, 10412 );
	myGump.AddGump( 88, 39, 1419 );
	myGump.AddGump( 164, 23, 1417 );
	myGump.AddGump( 44, 61, 2600 );
	myGump.AddGump( 320, 61, 2602 );
	myGump.AddGump( 44, 240, 2606 );
	myGump.AddGump( 320, 240, 2608 );
	myGump.AddTiledGump( 44, 105, 44, 135, 2603 );
	myGump.AddTiledGump( 320, 105, 44, 135, 2605 );
	myGump.AddTiledGump( 88, 240, 232, 44, 2607 );
	myGump.AddTiledGump( 88, 107, 232, 133, 2604 );
	myGump.AddPicture( 172, 54, 3624 );
	myGump.AddGump( 332, 4, 10410 );
	myGump.AddGump( -6, 116, 10401 );
	myGump.AddPage( 1 );
	myGump.AddText( 64, 112, 657, "Tobacco" );
	myGump.AddText( 64, 128, 657, "Swamp Weed" );
	myGump.AddText( 64, 144, 657, "Orcish Mudgrass" );
	myGump.AddText( 64, 160, 657, "Salvia Divinorum" );
	myGump.AddButton( 205, 117, 2223, 1, 0, 1 );
	myGump.AddButton( 205, 132, 2223, 1, 0, 2 );
	myGump.AddButton( 205, 148, 2223, 1, 0, 3 );
	myGump.AddButton( 205, 165, 2223, 1, 0, 4 );
	myGump.AddText( 115, 236, 0, "You must have the required" );
	myGump.AddText( 152, 250, 0, "plant in your bag." );
//	myGump.NoClose();
//	myGump.Dispose();
//	myGump.NoMove();
//	myGump.NoResize();
	myGump.Send( mySock );
	myGump.Free();

return false
}




function onGumpPress(mySock, myButton)
{
var myChar = mySock.currentChar;
	switch (myButton) {
	case 1: myChar.CustomTarget(0, "Select your tobacco."); break;
	case 2: myChar.CustomTarget(1, "Select your swamp weed."); break;
	case 3: myChar.CustomTarget(2, "Select your orcish mudgrass."); break;
	case 4: myChar.CustomTarget(3, "Select your salvia divinorum."); break;
	}
}

function onCallback0(pUser, myTarget)
{
	if(myTarget.id == 0x1aa2 && myTarget.colour == 0x850)
	{
	pUser.SysMessage("You smoke your tobacco.");
	pUser.SoundEffect(33, true);
	pUser.StaticEffect( 0x3735, 9, 5 );
	}
	else
	{
	pUser.SysMessage("That is not tobacco.");
	}
}
I get the error StaticEffect is not a function when I click the tobacco button and click some tobacco. The system message and sound effect do happen, though.

Note: I haven't scripted the other buttons yet.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

onCallback uses socket as argument, not character.
-= Ho Eyo He Hum =-
Post Reply