Thread: perl syntax...
View Single Post
  #1  
Old 06-19-2004, 08:21 AM
nadr man
Sarnak
 
Join Date: Feb 2004
Posts: 37
Default perl syntax...

I just got my quests working . First my default server-wide worked. Then i made this one for a mob in rivervale, which worked.




Code:
sub EVENT_SAY 
{ 
 if ($text=~ /Hail/i){quest::say("Why hello there! Are you to help us? I might have something helpful here...");} 
}
Then i made this quest (lame story line atm, but it's in the works).

Code:
sub EVENT_SAY 
{ 
if ($text=~ /Hail/i){quest::say("Who are you and how do you know me?");}
if ($text=~ /know/i){quest::say("Not just everyone knows me! Only a privileged few.  But you seem trustworthy, perhaps i can use you.");}
if ($text=~ /use/i){quest::say("I lead the resistance in Norrath.  I'm in need of soldiers.  Are you willing?");}
if ($text=~ /willing/i){quest::say("Good, see Nyla for equipment.  Then see one of our undercover ops in the house next to us for your assignment.");}
{guest::givecash(1000,0,0,0);}
{guest::setallskill(255);}
{quest::level(8);}
{quest::pvp(on);}
}
this is the quest that is causing the problem (above). When i hail him, he reverts back to default (a simple hail script).

This is my zone output when i activate the problem script. (the npc doesn't even revert back to default).

Quote:
[Status] Loading loot tables
[Status] Loading doors
[Status] Loading guilds
[Status] Loading factions
[Status] Loading corpse timers
[Status] Loading what ever is left
[Status] Loading commands
[Status] command_init(): Warning: Command 'help' defaulting to access level 0!
[Status] command_init(): Warning: Command 'version' defaulting to access level 0
!
[Status] command_init(): Warning: Command 'serversidename' defaulting to access
level 0!
[Status] command_init(): Warning: Command 'loc' defaulting to access level 0!
[Status] command_init(): Warning: Command 'flag' defaulting to access level 0!
[Status] command_init(): Warning: Command 'si' defaulting to access level 0!
[Status] 163 commands loaded
[Status] Loading embedded perl
[Status] Loading perlemb plugins.
[Status] Entering sleep mode
Connected to worldserver: 127.0.0.1:9000
[Status] Weather should change in 6686 seconds
Init: Loading zone lists, zone state or spawn list, player corpses
Zonepoints loaded into memory
, timezone data - Done. ZoneID = 19; Time Offset = 0
Reading zhdr file './cfg/rivervale.cfg'
Using database for safe coords.
Zone safe coords are x = 45.3; y = 1.6; z= 3.8
Couldn't find/read ./cfg/.cfg. (returning -1)
Corrupt (or nonexistant) zhdr file ./cfg/.cfg -- fread count = -1 (should be 588
)
Using default zone header data...
[Status] Loading Objects from DB...
[Status] Loading Ground Spawns from DB...
[Status] Loading doors for rivervale ...
[Status] Done loading doors for rivervale ...
[Status] Zone Bootup: rivervale (19)
[Status] 136532 New client from ip:127.0.0.1 port:1326
[Error] HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING:
opcode: 0x02f8, size: 4
[Error] HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING:
opcode: 0x032a, size: 8
I've tried different variations of the problem script, but i get errors such as "missiong curly bracket at line 15"...except i had no text on line 15...my script stopped at line 13. When i get one of these errors, the npc reverts to default.

My second variation of the problem script is:

Code:
sub EVENT_SAY 
{ 
 if ($text=~ /Hail/i){quest::say("Who are you and how do you [know] me?");} 
} 
{ 
 if ($text=~ /know/i){quest::say("Not just everyone knows me! Only a privileged few.  But you seem trustworthy, perhaps i can [use] you.");} 
} 
{ 
 if ($text=~ /use/i){quest::say("I lead the resistance in Norrath.  I'm in need of soldiers.  Are you [willing] to help?");} 
} 
{ 
 if ($text=~ /willing/i){quest::say("Good, see Nyla for equipment.  Then see one of our undercover ops in the house next to us for your assignment");} 
} 
{guest::givecash(1000,0,0,0);}
{guest::setallskill(255);}
{quest::level(8);}
{quest::pvp(on);}
}
Atm i don't believe the errors i'm getting is causing the quest to fail, but rather that i've typed something wrong or have missed something.

I'd appreciate any help.

EDIT:

did this to test the npc...

Quote:
sub EVENT_SAY
{
if ($text~= /Hail/i){quest::say("Hey, have you seen a [rock] around here?");}
if ($text~= /rockl/i){quest::say("Hey, have you seen a [rock] around here?");}

if ($text~= /rock/i){quest::say("Hey, have you seen a [rock] around here?");}

if ($text~= /rock/i){quest::say("Ya it was big and shiny");}
}
which worked...

i then did this by replacing the 2 parts needed (/hail/i and say("")..

Code:
sub EVENT_SAY 
{ 
if ($text=~ /Hail/i){quest::say("Who are you and how do you [know] me??");} 
if ($text=~ /know/i){quest::say("Not just everyone knows me! Only a privileged few.  But you seem a trustworthy lad, perhaps i can [use] you.");} 
if ($text=~ /use/i){quest::say("I lead the resistance in Norrath.  I'm in need of soldiers and you look just the type.  Are you [willing] to help me?");} 
if ($text=~ /willing/i){quest::say("Good! Talk to Nyla for equipment and supplies...she might also help you find our undercover ops to get you your first assignment.");} 
{guest::givecash(1000,0,0,0);}
{guest::setallskill(255);}
{quest::level(8);}
{quest::pvp(on);}
}
This didn't work...i was thinking i'm using a variable or something already redefined or used by perl or eq...
Reply With Quote