View Single Post
  #1  
Old 06-03-2003, 11:37 AM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default Herein lies the conundrum - Summoning Items in Quest Scripts

I see posts from people claiming they can summon items in quest scripts by saying the following somewhere in the script:

summonitem("11000")

In fact, I read a post that says that you must use the quotation marks in order for it to work.

Well, it just flat out doesn't work for me. I can only get this to work if I remove the quotation marks.

Soooo...being on the Bug Hunt that I am today, I dive into the code to see if it's just me or what (I've been known to have a severe case of anal-cranium interlock in the past).

Looking in void Parser::CommandEx(char * command, int32 npcid, Mob* other, Mob* mob) I see that, in my case, atoi("11000") is failing to convert to 11000, rather returning 0 as it should.

Now, this explains why I can't use quotation marks, but herein lies the conundrum...who are these other people that CAN use quotation marks?

(Windoze? Say it isn't so! )

Some code snippets that snarf (in a rather brutal and ruthless way) the leading quotation mark, inserted where atoi is failing (that I have found, so far):

Code:
else if (strstr(strlwr(arglist[0]),"summonitem")) {
       if (arglist[1][0] == '\"') { memset(strstr(arglist[1], "\""), 32, 1); }  //ADD THIS
       mob->CastToClient()->SummonItem(atoi(arglist[1]));
}
else if (strstr(strlwr(arglist[0]),"castspell")) {
        if (arglist[1][0] == '\"') { memset(strstr(arglist[1], "\""), 32, 1); }  //ADD THIS
        other->CastSpell(atoi(arglist[2]), atoi(arglist[1]));
}

Regards,

Krich
Reply With Quote