PDA

View Full Version : Event_item_click


c0ncrete
11-23-2012, 01:17 AM
what's the difference between EVENT_ITEM_CLICK and EVENT_ITEM_CLICK_CAST? i understand that the former requires SoF+, but i'm not sure why the latter would lock up SoD.

i created a script_8556.pl for use with the bloodmoon pick axe while running some tests, and when i used EVENT_ITEM_CLICK_CAST instead of EVENT_ITEM_CLICK, i was stuck in "you can't use that command while casting" mode.

i hadn't altered anything in the database for the item in question, and it was working with the other event. does something else have to be set for the item's entry that i am unaware of?

this is what i was testing:
sub EVENT_ITEM_CLICK_CAST
{
if ($itemid == 35096)
{
return if !validLoc();
quest::doanim(87);
}
}

my %testArea = (
189 => [
{
x => 125,
y => 48,
z => -222
},
{
x => -655,
y => -428,
z => 2
}
]
);

sub validLoc
{
return 0 if !exists($testArea{$zoneid});
foreach $loc (@{$testArea{$zoneid}}) {
return 1 if (
$loc->{'x'} == $client->GetX() &&
$loc->{'y'} == $client->GetY() &&
$loc->{'z'} == $client->GetZ()
);
}
0;
}

c0ncrete
11-23-2012, 02:56 AM
after looking more closely at the source code, i sorted out that this was happening because i wasn't making a call to CastSpell() within my script, so it never finished the process. now that i've added it, it doesn't lock me up anymore.