Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 11-08-2012, 06:32 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

PEBKAC

to access an element via index, you want to use
Code:
$array_name[$index]
not
Code:
@array_name[$index]
don't worry about bless() unless you're writing custom classes.

also note that if you are declaring a variable with 'my' and assigning a value to it inside of a loop, it won't be available outside of that loop.
Reply With Quote
  #3  
Old 11-08-2012, 08:27 PM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default

its still failing with $

i tried passing it to another $ and i tried putting it directly into spawn2

it crashes zone either way.... i even tried closing the db connection - no dice.
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote
  #4  
Old 11-08-2012, 08:45 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Well, I'd advise using the debugger to see what gets passed into the c++ side and also where it crashes.
Reply With Quote
  #5  
Old 11-08-2012, 09:22 PM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default

ok lerxst2112,.. ill check into that if i can't find something useful in the logs

i think it might be somethign to do with teh mysql server actually.. sometimes it doesnt crash but a #dbspawn 2700947 or whatever will crash teh zone

i'll do some more research.. i may be doing something bad to the db :P
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote
  #6  
Old 11-09-2012, 12:38 AM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default

nevermind about this, it was a poor method of delivery.. i have devised an even less efficient method well see how it plays out ;o
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:58 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3