View Single Post
  #1  
Old 11-08-2012, 01:13 AM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default failure passing var to spawn2 or PEBCAK?

PLEASE let the answer be PEBCAK.

Ok so I have a script that spawn an npc based on a variable for the spawn ID

This causes a zone.exe crash everytime

When tested, @row[0] = 2700972
that value is the npc_id for that particular case, that I want to spawn..

Without posting all of my plugins and such... lets pretend that

(It does some work and produces a @ array, after searching the DB for some parameters using a db plugin)

This crashes zone.exe
Code:
my $var_to_test = @row[0]
quest::spawn2($var_to_test,0,0,$x,$y,$z,$h);
This also crashes zone.exe
Code:
quest::spawn2(@row[0],0,0,$x,$y,$z,$h);
HOWEVER
this does NOT crash zone.exe, and it works and spawns the npc - but is useless to me because i am hardcoding it in that case.
Code:
my $var_to_test = 2700972;
quest::spawn2($var_to_test,0,0,$x,$y,$z,$h);
WTF is perl doing when I transfer it from @ to $??????? I did some searches and couldnt figure it out

i tried
my ($var_to_test) = @row;
which supposedly takes the first value from row, but that didn't work - even though another variable test showed the right number again.

i also tried casting $var_to_test with int($var_to_test)

I saw something about "blessing" a variable.. is this something i need to do? (i couldn't understand what blessing meant)
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote