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

06-13-2007, 01:57 PM
|
Forum Guide
|
|
Join Date: Sep 2003
Location: California
Posts: 1,474
|
|
In my quest editor there's an example where an npc walks around the zone randomly and returns to original spot. This is like a patrol, but is generated in a random manner. See the script example
GeorgeS
|
 |
|
 |

06-14-2007, 03:52 AM
|
Dragon
|
|
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
|
|
Thank you GeorgeS  I wound up looking through most of the quest files included with that, and came across one (#2  that gave me an idea. I realized that I was perhaps putting too much thought into this.
I used a ChooseRandom with numbers 1-10, and just wrote ifs for each number. I stored the chosen value in the $a variable (since I wanted to test it with one that I knew would be recognized).
Well, I went a little further than that, and found that it will in fact let me use variables that I create myself (and thus aren't in the list here). I'm still new to writing in PERL, so I thought there were limitations from somewhere on what variables you could work with.
Anyway, here's what I wound up with, and it works pretty well. I'll be using this for every mob that I have aggro /say for, and it will have them give their standard aggro message along with a second one roughly 2/3 of the time. If they have a standard one that goes off each time (Frrroooaaakkk!), I'll just drop that at the top. Thank you so much for the help, both of you
Code:
sub EVENT_AGGRO{
my $Phrase = quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,0,0,0,0,0);
quest::say('Frrroooaaakkk!');
if ($Phrase =~/1/) {
quest::say("Your faithless devotion to a false god leaves me no choice.");
}
if ($Phrase =~/2/) {
quest::say("I shall rid the land of another infamous villain.");
}
if ($Phrase =~/3/) {
quest::say("Your foul deeds have earned my contempt.");
}
if ($Phrase =~/4/) {
quest::say("Your beliefs are an insult to us all!");
}
if ($Phrase =~/5/) {
quest::say("Your actions and history are a personal affront to all I stand for.");
}
if ($Phrase =~/6/) {
quest::say("${race}s like you are better left dead than alive.");
}
if ($Phrase =~/7/) {
quest::say("It's ${race}s like you who have ruined your own lands, You'll not ruin mine!");
}
if ($Phrase =~/8/) {
quest::say("It's time for you to take your blasphemy into the next realm.");
}
if ($Phrase =~/9/) {
quest::say("Your intolerable reputation insults all in this realm.");
}
if ($Phrase =~/10/) {
quest::say("${class}s like you are better left dead than alive.");
}
}
#Submitted by: Jim Mills
(Note: Again, the board seems to be adding an extra space where it doesn't really belong inside of my code block. There are no spaces after the string of zeroes in the ChooseRandom when I enter this in, but they appear each time I preview my post. Quirky.)
|
 |
|
 |

06-14-2007, 10:13 PM
|
Fire Beetle
|
|
Join Date: Oct 2003
Posts: 20
|
|
The way you had it written first works fine. You need to declare your variables first though. So if you write it like this:
Code:
sub EVENT_AGGRO {
my $Phrase1 = "Your faithless devotion to a false god leaves me no choice.";
my $Phrase2 = "I shall rid the land of another infamous villain.";
my $Phrase3 = "Your foul deeds have earned my contempt.";
my $Phrase4 = "${race}s like you are better left dead than alive.";
my $Phrase5 = "It's ${class}s like you who have ruined your own lands, You'll not ruin mine!";
my $Phrase6 = "Heathen! Unbeliever! Norrath must be cleansed!";
my $Phrase = quest::ChooseRandom($Phrase1, $Phrase2, $Phrase3, $Phrase4, $Phrase5, $Phrase6);
quest::say("Frrroooaaakkk!");
quest::say("$Phrase");
}
The mob will say the first message then say the randomly picked message. Looks much nicer and cleaner in your quest script.
Last edited by Budaworm; 06-15-2007 at 06:15 AM..
Reason: typos
|

06-15-2007, 12:55 AM
|
Dragon
|
|
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
|
|
Haha, F. I didn't think about that =) No wonder all the /says were coming up as empty, it's because the variables were empty with the order it was executing. Doh =X
Okay, I think I'll go back to the way I was trying it originally, just because it's more compact. Thanks so much for all the help and ideas, all of you =)
|

06-15-2007, 04:58 AM
|
Hill Giant
|
|
Join Date: Oct 2006
Posts: 248
|
|
if you stuff them into a list, and just randomize the index, the code would be more modular and reusable across other mobs (you could even turn it into a plugin.pl type mod).
== sfisque
|

06-15-2007, 08:36 AM
|
Sarnak
|
|
Join Date: Aug 2006
Posts: 35
|
|
Quote:
Originally Posted by Budaworm
The way you had it written first works fine. You need to declare your variables first though. So if you write it like this:
The mob will say the first message then say the randomly picked message. Looks much nicer and cleaner in your quest script.
|
Cleaner solution:
Code:
sub EVENT_AGGRO {
my @Phrases = (
"Your faithless devotion to a false god leaves me no choice.",
"I shall rid the land of another infamous villain.",
"Your foul deeds have earned my contempt.",
"${race}s like you are better left dead than alive.",
"It's ${class}s like you who have ruined your own lands, You'll not ruin mine!",
"Heathen! Unbeliever! Norrath must be cleansed!"
);
my $Phrase = quest::ChooseRandom(@Phrases);
quest::say("Frrroooaaakkk!");
quest::say("$Phrase");
}
I think that'll work, and you can add phrases to the list, and it automatically includes it in the random phrase pick.
|

06-15-2007, 11:22 PM
|
Fire Beetle
|
|
Join Date: Oct 2003
Posts: 20
|
|
The method above looks even more compact but you gotta write it as
Code:
sub EVENT_AGGRO {
my @Phrases = (
"Your faithless devotion to a false god leaves me no choice.",
"I shall rid the land of another infamous villain.",
"Your foul deeds have earned my contempt.",
"${race}s like you are better left dead than alive.",
"It's ${class}s like you who have ruined your own lands, You'll not ruin mine!",
"Heathen! Unbeliever! Norrath must be cleansed!"
);
quest::say("Frrroooaaakkk!");
quest::say("$Phrases[int(rand($#Phrases+1))]");
}
to get it to work.
|
 |
|
 |

06-23-2007, 03:54 PM
|
Dragon
|
|
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
|
|
Dammit. I had all of Guk working fine until I upgraded to the 1002 build, now I'm getting errors and no response from the frogs. Here's what I'm seeing in the error log:
Quote:
---------------------------------------------
[06.23. - 22:25:01] Starting Log: logs/eqemu_quest_zone_5488.log
[06.23. - 22:25:01] Tying perl output to eqemu logs
[06.23. - 22:25:01] Creating EQEmuIO=HASH(0x39d603c)
[06.23. - 22:25:01] Creating EQEmuIO=HASH(0x39efe60)
[06.23. - 22:25:01] Loading perlemb plugins.
[06.23. - 22:25:01] Loading perl commands...
[06.23. - 23:41:22] Useless use of a constant in void context at quests/poknowledge/#Yeril_Imsin.pl line 24.
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 8, near """Your"
[06.23. - 23:47:41] (Missing operator before Your?)
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 9, near "my $Phrase8 = "Your"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 
[06.23. - 23:47:41] (Do you need to predeclare my?)
[06.23. - 23:47:41] Unquoted string "stand" may clash with future reserved word at quests/gukbottom/a_ghoul_sentinel.pl line 9.
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 10, near "my $Phrase9 = "Your"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 9)
[06.23. - 23:47:41] (Do you need to predeclare my?)
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 11, near "my $Phrase10 = "It's"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 10)
[06.23. - 23:47:41] (Do you need to predeclare my?)
[06.23. - 23:47:41] Unquoted string "the" may clash with future reserved word at quests/gukbottom/a_ghoul_sentinel.pl line 11.
[06.23. - 23:47:41] Scalar found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 12, near "my $Phrase11 = "${race}"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 11)
[06.23. - 23:47:41] (Do you need to predeclare my?)
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 12, near "s like you are better left dead than alive"
[06.23. - 23:47:41] (Do you need to predeclare s?)
[06.23. - 23:47:41] Unquoted string "ve" may clash with future reserved word at quests/gukbottom/a_ghoul_sentinel.pl line 12.
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 14, near "quest::say("Rrrrrrrrooooaaakkk"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 12)
[06.23. - 23:47:41] Scalar found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 15, near "quest::say("$Phrase"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 14)
[06.23. - 23:47:41] String found where operator expected at quests/gukbottom/a_ghoul_sentinel.pl line 15, at end of line
[06.23. - 23:47:41] (Missing semicolon on previous line?)
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_wan_ghoul_knight.pl line 8, near """Your"
[06.23. - 23:47:41] (Missing operator before Your?)
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_wan_ghoul_knight.pl line 9, near "my $Phrase8 = "Your"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 
[06.23. - 23:47:41] (Do you need to predeclare my?)
[06.23. - 23:47:41] Unquoted string "stand" may clash with future reserved word at quests/gukbottom/a_wan_ghoul_knight.pl line 9.
[06.23. - 23:47:41] Bareword found where operator expected at quests/gukbottom/a_wan_ghoul_knight.pl line 10, near "my $Phrase9 = "Your"
[06.23. - 23:47:41] (Might be a runaway multi-line "" string starting on line 9)
|
What'd we do wrong here?
|
 |
|
 |

06-23-2007, 06:03 PM
|
Fire Beetle
|
|
Join Date: Apr 2007
Posts: 10
|
|
Seems to be some differances in how you declare a parameter in te new version.
Check out how it has been changed in the changelog.
Maybe the string declaration (or what it now is) has ben changed to
$phrase8 := "yada yada";
Or similar. Check it out. There is the trouble it seems anyway since it errors on each of those code snipps...
|

06-26-2007, 05:22 PM
|
Developer
|
|
Join Date: Jul 2004
Posts: 773
|
|
Quote:
Originally Posted by Budaworm
The method above looks even more compact but you gotta write it as
Code:
quest::say("$Phrases[int(rand($#Phrases+1))]");
}
to get it to work.
|
Just to prevent confusion, this is exactly what ChooseRandom was written to avoid... its just too ugly, and shouldent be nescesary.
Also, nothing changed about quests recently that I am aware of... maybe you upgraded perl versions?
|

06-26-2007, 11:26 PM
|
Dragon
|
|
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
|
|
Hrm. Nope. Only moved from 992 to 1002.
I'm out of town and pretty busy until at least after the 4th, so I haven't had a chance to delve into this any further. My main goal is just to go back to a method that works so that I can at least edit all the files that I dropped into the PEQ quest submission area. I was running trains of screaming frogloks before, so I know it worked at that point.
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 06:35 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |