Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Quests

Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 06-19-2004, 09:30 AM
animepimp
Dragon
 
Join Date: Jan 2004
Posts: 860
Default

Your problem is that you are using far too many braces. You should use one pair of braces to enclose the entire sub. Then you should use one and only one pair to enclose every line you want to associate with each if statement. Change
Quote:
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);} 
}
To
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);
  }
}
It may not be your whole problem, but its definitely a big mistake. Lines are seperated by a ; no need to seperate each one by {}s. Block of code such as if statements are seperated by {}s. I'd suggest looking at an introductory programming tutorial website. I don't know if you can find one for perl, but C++ or Java ones would help you out a lot because their syntax is very similar and they would teach you all you need to know to write basic quests.
Reply With Quote
  #3  
Old 06-19-2004, 09:33 AM
animepimp
Dragon
 
Join Date: Jan 2004
Posts: 860
Default

Oh and another mistake I jsut saw that is probably leading to it not being recognised by the server is that you have to use ~= not =~. You did this in the one you changed it to which is why it worked the way it should.
Reply With Quote
  #4  
Old 06-19-2004, 10:46 AM
nadr man
Sarnak
 
Join Date: Feb 2004
Posts: 37
Default

Thanks. I've read a learn C++ in 21 days and a 10 day C++ thing/book...in the end, i have trouble writing my own code, but can understand what already written code does. A big thing i've been trying to find on the web is how files connect to each other...the data, that is...it's a different story. One day i'll understand.

Thanks for all your help. It'll just take me a few tries to understand this perl script stuff.
Reply With Quote
  #5  
Old 06-19-2004, 04:31 PM
Swampdog
Hill Giant
 
Join Date: May 2004
Posts: 106
Default

Quote:
Originally Posted by animepimp
Oh and another mistake I jsut saw that is probably leading to it not being recognised by the server is that you have to use ~= not =~. You did this in the one you changed it to which is why it worked the way it should.
~= didn't work on my server.. I had to switch it around to get it to work. All of my quests use =~. I think the problem which was probably causing it not to load is all of the extra brackets. I was surprised not to see an error in his zone output though. I've always seen an error when it defaulted back to default.pl.
__________________
Kukthar
Discord Aftermath (alpha) LAN Party Server [Custom Legit] - Op/Dev
Temporarilly on hold due to time constraints
Damn rl interupting fun anyways.. :P
Reply With Quote
  #6  
Old 06-19-2004, 07:12 PM
wize_one
Dragon
 
Join Date: Jan 2004
Location: LasShithole, NV
Posts: 520
Default

could try running perl -c (filename.pl) perl will tell you if there are errors
__________________
Perfect quote from another site: it's immature pricks who refuse to read the numerous stickies in every forum pointing out what to do and what not to do that get flamed. Grow up and learn to do your fucking homework before opening your cake hole, junior. EQEmu doesn't like you anymore, and that's why you're getting errors. So go away.
__________________
Reply With Quote
  #7  
Old 06-20-2004, 04:02 AM
nadr man
Sarnak
 
Join Date: Feb 2004
Posts: 37
Default

i'm doing "perl -c 58017.pl" and perl says i'm missing an operator before .pl
Reply With Quote
  #8  
Old 06-20-2004, 12:19 PM
animepimp
Dragon
 
Join Date: Jan 2004
Posts: 860
Default

It probably adds the .pl automatically, try it with no extension.
Reply With Quote
  #9  
Old 06-20-2004, 01:24 PM
wize_one
Dragon
 
Join Date: Jan 2004
Location: LasShithole, NV
Posts: 520
Default

i ran :
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);
  }
}
it gave me:
perl -c test.pl
test.pl syntax OK

not sure how well this works on windows perl though
__________________
Perfect quote from another site: it's immature pricks who refuse to read the numerous stickies in every forum pointing out what to do and what not to do that get flamed. Grow up and learn to do your fucking homework before opening your cake hole, junior. EQEmu doesn't like you anymore, and that's why you're getting errors. So go away.
__________________
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 03:46 PM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3