PDA

View Full Version : $itemcount problem


Fyrre
07-14-2003, 08:48 AM
I have an armor quest, and the item turn in isn't functioning as I want it to. The spell being cast on the user summons the specified item. The problem is that ANY turn in attempts to cast all the spells in the code on the user.

EVENT_ITEM {
if ($itemcount("210") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your chestplate. Congratulations!") castspell("$userid","523") }
if ($itemcount("211") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your leggings. Congratulations!") castspell("$userid","637") }
if ($itemcount("212") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your bracer. Congratulations!") castspell("$userid","638") }
if ($itemcount("213") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your helm. Congratulations!") castspell("$userid","639") }
if ($itemcount("214") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your armplates. Congratulations!") castspell("$userid","751") }
if ($itemcount("215") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your boots. Congratulations!") castspell("$userid","852") }
if ($itemcount("216") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your gauntlets. Congratulations!") castspell("$userid","887") }
if ($itemcount("220") && $itemcount("217") && $itemcount("218") && $itemcount("219") { say("Here is your mask. Congratulations!") castspell("$userid","888") }
}

Could someone please correct me on this code? I'm sure something isn't right.

dcl
07-14-2003, 09:47 AM
I believe you need to set the $itemcount = to something...

ie.

if ($itemcount("210") == 1 && $itemcount("217") == 1 && $itemcount("218") == 1 && $itemcount("219") == 1 ){ say("Here is your chestplate. Congratulations!") castspell("$userid","523") }


You were also missing a ) after the last $itemcount

killspree
07-14-2003, 03:48 PM
Yeah, try $itemcount("id") == 1, also try without quotes, and make sure to add in that last parentheses. ;)

Fyrre
07-14-2003, 05:27 PM
Thanks, it works like a charm.

mamba666
07-16-2003, 09:37 AM
Using 4.4 I used $itemcount without the quotes and it worked. With Quotes did not work for me.

krich
07-20-2003, 12:15 PM
The simple explanation is that Windows likes quotes, Linux does not (has to do with the atoi function). I think this might have been fixed, but not sure. Check my rantings about atoi in the dev forum for more info (and cussing).

Regards,

krich

Bigpull
07-20-2003, 01:17 PM
itemcount is a variable, variables do not require quotes, functions are what require quotes.