Page 1 of 1

Trouble with StaticEffect in a gump

Posted: Thu Jul 08, 2004 1:32 am
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.

Posted: Thu Jul 08, 2004 2:05 am
by Xuri
onCallback uses socket as argument, not character.