View Single Post
  #2  
Old 07-13-2009, 01:47 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

I should start by saying that I have limited experience with perl or regular expressions.

Something like that, but instead of using quotations:
Code:
$say = player text
quest::summonitem("$say");
It should be:
Code:
quest::summonitem($say);
You could simply enough have it check if the string the player said was an integer and then summon that. I think that would be the following:
Code:
if($text=~/\d{1,6}/) {
quest::summonitem($text);
}
Someone who has more regex experience than me should double check that, but I think that strips everything except for the integer digits (minimum 1 digit, max 6).

edit: not sure what would happen if someone said for example '10061 13001', I think it might call summonitem(10061 13001) which should return an error. Also, you probably want to check the return value of summonitem (if it has one) and see if it found the item or not, if not the npc could say that there was no item found.
Reply With Quote