PDA

View Full Version : Zone Crash on quest execute.


Charmy
05-13-2004, 06:03 PM
When i load this script and hand in anything but 100pp zone.exe crashes. any ideas on why? i have a feeling its in


if(($myplatinum = 100) && ($mygold = 0) && ($mysilver = 0) && ($mycopper = 0))



sub EVENT_SAY
{
if($mname=~ /^Soulbinder/i)
{
if($text=~/Hail/i)
{
quest::say("Greetings $name. When a hero of our world is slain their soul returns to the place it was last bound and the body is reincarnated. As a member of the Order of Eternity it is my duty to [bind your soul] to this location if that is your wish. If you are an adventurer and are in need of a heal, perhaps you could help to fill my coin purse in exchange for heal? Nothing to extreme just give me a [Healing emblem] and i shall heall all your wounds.");
}
if($text=~/bind my soul/i)
{
quest::say("Binding your soul. You will return here when you die.");
quest::castspell($userid,2049);
}
if($text=~/Healing Emblem/i)
{
quest::say("Yes, yes a healing emblem, don't have have one? well.. for a small fee i can give you one, nothing to much, lets say 100pp per emblem, only in platinum please? No? well fine you can make the trip to the nexus then, our leader resides there he sells the emblems, go buy one from him, otherwise you have to pay my price.")
}
}
}

sub EVENT_ITEM
{
if($mname=~ /^Soulbinder/i)
{
if($itemcount{18700} && $itemcount{18700} == 1)
##changed item to tome of discord incase anyone wants to try it on their server to try to debug.
{
quest::say("A Healing Emblem? Very well got one heal comming your way!");
quest::castspell($userid,13);
}
$myplatinum = ($platinum);
$mygold = ($gold);
$mysilver = ($silver);
$mycopper = ($copper);
if(($myplatinum = 100) && ($mygold = 0) && ($mysilver = 0) && ($mycopper = 0))
{
quest::say("Very good, here you are, One Healing Emblem, just hand it back to me when you

are in need of a heal");
quest::summonitem(18700,1);
}
else
{
quest::say("I said 100 platinum, in Platinum coins only, Here take back your money");
quest::givecash($mycopper,$mysilver,$mygold,$mypla tinum);
}
}
}


Handing him 100 pp results in the item, and handing the item results in a CH, this part works. but if i hand in any other coin combo it should say no and hand back the money, but zone is crashing, just wondering if anyone has any ideas on why its crashing, and secondly , i used the new may 12th code and the EVENT_ITEM section of this script didn't work in anyway, the text did but handing in any items didn't result in anything, any ideas on this as well? Thanks all for the help =)

gandar
05-13-2004, 07:21 PM
Just a thought...
if(($myplatinum = 100) && ($mygold = 0) && ($mysilver = 0) && ($mycopper = 0))
Should be:
if(($myplatinum == 100) && ($mygold == 0) && ($mysilver == 0) && ($mycopper == 0))
Again, that's just my guess... Be sure to let me know! :P

Charmy
05-13-2004, 08:23 PM
hmm again i forget how important a syntax is.. strange though, i didn't get any compiling errors when starting zone.exe, however iw ill try this edit and report back to ya =)

Charmy
05-13-2004, 08:28 PM
aswome it worked, thanks, however for some reason when i am giving the item in i still get the message saying i only asked for 100pp so i need to change the code around a bit, hmm anyway thanks for the help =)


What is the syntax for somthing does not equal, like if $variable1 *doesnot equal* 100, how would i do this? perhaps i could make it work for me!

animepimp
05-14-2004, 12:15 AM
It is syntavtiavlly correct to do it with jsut = like you had,but it will not do what you want and was crashing because of how you used the single =. != == not equals :)

Dave987
05-14-2004, 03:56 AM
What I always do before putting a quest on , is open a cmd window , go to the directory of quests, and type *.pl

Start > Run > cmd
dir EQEmu\quests
questname.pl


That checks to make sure the quest works ... yummy

m0oni9
05-14-2004, 04:07 AM
= is the assignment operator, == is the equality operator

It's somewhat common to write:
if(($myplatinum == 100) && ($mygold == 0) && ($mysilver == 0) && ($mycopper == 0))
as:
if((100 == $myplatinum) && (0 == $mygold) && (0 == $mysilver) && (0 == $mycopper))
so that if you make a typo (ie: 100 = $myplatinum) it will give an error.

Not too sure why it was crashing. Your if-statement should have always evaluated to false, and executed the "quest::givecash($mycopper,$mysilver,$mygold,$mypla tinum);" part, I think. Maybe $mysilver and $mycopper were undef, and passing those back caused the crash?

gandar
05-14-2004, 04:53 AM
I also thought that the code should have evaluated to false. That's why I was unsure if my suggestion would actually fix it since it was (sorta) working.

= assigns a value
== checks equality
!= not equal

I agree with M0oni9 - by reversing the variable and value, you can easily make sure that it your code is correct because you can never assign a value to a number. $mygold = 100 maybe a typo, but might not be flagged as an error, where 100 = $mygold is both a typo AND an error.

I also agree with Dave987 - always run the Perl script from the command line to check for bugs - easier to spot and fix there.

About your turn in code: if($itemcount{18700} && $itemcount{18700} == 1) could be changed to if($itemcount{18700} == 1) When learning to work with the quest system, most of the quests that were already completed use the second example and that's what I've been using while setting up my custom quests.

Anyway, good luck! 8)
~Gandar

Charmy
05-14-2004, 11:44 AM
Cool thanks all for the info, it doesn't crash now, only part i am having issue with is i keep getting the msg saying i only want 100pp in plat take back you money when i hand in the item, i am going to try using a statment where if something doesn't equal this, i.e if((100 != $myplatinum)){quest::say("i only want 100pp in Plat only, take back your money); problem is i need to make it so it will ignore any item turn ins, becuase even using this will still return the fact that i am giving him 0 plat and 0 != 100 so... hmm

gandar
05-14-2004, 12:15 PM
Hmm - another suggestion...

That else at the end seems to be catching everything, including your item turn in (because it's not 100 pp! ) try changing it to elsif.

I'm going to load your script onto my Soulbinder and test it pretty quick - I'll let you know if it doesn't work.

Wish me luck! :P
~Gandar

Edit: Nevermind - I'll still test it, though, and see if I can figure it out - elsif isn't the way to go, I'm not sure what I was thinking

Charmy
05-14-2004, 01:13 PM
hehe tried it, got same problem, i need to find a way to make it so it says


if i give you 100pp
give me item
If i don't give you 100pp but i give you this item then
heal me and stfu
if i don't give you 100pp but i give you 100gp, then
give back my 100gp say you want 100pp
etc....


however i am getting


if i give you 100pp then
you give me item
if i don't give you 100pp but i give you item then
you take item heal me then say you want 100pp
if i don't give you 100pp but give you 100gp then
you give me my 100gp back and say you want 100pp


Go IF/Then Statments!

m0oni9
05-14-2004, 01:49 PM
I haven't checked the accuracy of this, but the variables ($platinum, etc) may be undefined. If that is true, the following may help you out (replace your current four lines). It will assure that none of the $myMONEY variables are undefined.

$myplatinum = (defined($platinum) ? $platinum : 0);
$mygold = (defined($gold) ? $gold : 0);
$mysilver = (defined($silver) ? $silver : 0);
$mycopper = (defined($copper) ? $copper : 0);

edit: I didn't thoroughly read your problem! I think that all you should need to do is add a condition (on the "if ($itemcount.." line) to see if they handed any money also. After you've healed then, you could just return from the sub.