I don't think that would do it. Lemme give you a better example of whats being run here.
$item1=$ARGV[0];
$item2=$ARGV[1];
$item3=$ARGV[2];
$item4=$ARGV[3];
$myscript=$ARGV[3];
my $TheQuest="";
sub WriteIt {
$TheQuest.=$_[0]."\n";
}
sub exp {
WriteIt("<br><font color=yellow>You gain experience!!</font>");
}
sub summonitem {
WriteIt("<br><b>".$myscript." gives you : </b><a href=$main::root_url"."item.php?id=$_[0]>".$_[0]."</a>");
}
eval "require '$myscript'";
EVENT_ITEM();
print $TheQuest;
exit;
}
ok, so i've got the like 4000 files that this gets run on, and the contents will vary greatly. There really isn't any way for me to predict what item numbers are going to be in the game characters file. So i'll give two scenarios.
The player wants to simmulate giving items to King Tormax to see if his quest is working. So they come to my site, and "give" him 3 items to see if his quest is working. The php calls my perl with all the arguments as follow. "'questparser.pl' '7880' '7879' '5192' '0' 'King_Tormax.pl'"
This will end up including the King_Tormax file, which will have the EVENT_ITEM in it, and the calls to item1-item4. In this situation the items are set in the correct order for king tormax's quest file. which is as follows
sub EVENT_ITEM {
if($item1=="7880" && $item2=="7879" && $item3=="5192"){
quest::summonitem(4199);
quest::exp(85); }
}
had they typed the items in a different oder, 7879, 7880, 5192, then the conditional in king tormax's file wouldnt go off. In the actual game the items are handed in all at once, so order is not a factor, and a user wouldnt expect it to be a factor on my site. Furthermore the quest files for each game character aren't written with the arguments in any kind of order. In this example they are in descending order, but its pure coincidence.
Another example is Veltar,
sub EVENT_ITEM {
if($item1=="356" && $item2=="685"){
quest::say("Very well mortal...");
quest::summonitem(376);
quest::exp(1000); }
elseif($item1=="2296" && $item2=="686"){
quest::say("You have done well for me!");
quest::summonitem(377);
quest::exp(1000); }
as you can see, its very chaotic what to expect from the quest files. In game im really not sure how they do it. When you give the items to the game character a window opens up with 4 slots, and you hand the items in, in any order. So i'm not sure how the game server, which is written in c++, calls the perl so that these items are in order. Naturally the say, summonitem, exp functions are all provided by the game server in that case. These are the things i'm simmulating by writing my own functions that output html.
I was wondering if there was some kind of regular expression that could be used to do this. I've never really messed with the stuff, but i've seen items in []'s before. Would something like
$item1="/[".$ARGV[0].",".$ARGV[1].",".$ARGV[2].",".$ARGV[3]."]/"
$item2="/[".$ARGV[0].",".$ARGV[1].",".$ARGV[2].",".$ARGV[3]."]/"
$item3="/[".$ARGV[0].",".$ARGV[1].",".$ARGV[2].",".$ARGV[3]."]/"
$item4="/[".$ARGV[0].",".$ARGV[1].",".$ARGV[2].",".$ARGV[3]."]/"
so when the conditional of $item1=="7880" fires it will check "/[7880,5192,7879,0]/=="7880"
I know none of that is syntactically correct im shooting in the dark =P