Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 06-03-2003, 11:49 AM
loudent2
Sarnak
 
Join Date: Apr 2003
Posts: 95
Default

There are various versions of the code. 4.3, 4.4 and CVS. Whether you can use quotes or not is dependant on what version you're running. I use the latest CVS code and I've found that most of the quests out there simply do not work anymore. Eventually everyone will be one the same page enough where we won't have this confusion.
__________________
Ignorance is Bliss
Reply With Quote
  #3  
Old 06-11-2003, 03:51 AM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

also if your compiling on linux, the versions of gcc and glibc makes a large difference.
__________________
Lethal Encounter
Reply With Quote
  #4  
Old 06-11-2003, 11:06 AM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default

Quote:
Originally Posted by Edgar1898
also if your compiling on linux, the versions of gcc and glibc makes a large difference.
Please elaborate, if you can...I'm a rusty c/c++ programmer, and not familiar with the intricacies of linux or the various versions of gcc libraries and compilers. I could stand to learn a thing or two on this subject.

The man page on atoi states that it stops trying to convert at the first non-numeric, non-space, non-plus (+), or non-minus (-). Judging from the laundry list of standards that use this function, I would think that it's behavior would be highly predictable under most circumstances.

/shrug

Regards,

krich
Reply With Quote
  #5  
Old 06-12-2003, 04:45 AM
Edgar1898
Senior Member
Former EQEmu Developer
Current EQ2Emu Lead Developer
 
Join Date: Dec 2002
Posts: 1,065
Default

Well I was using an old version of gcc at first and everything compiled properly, but when I used quests I would have to take the quotes off. (Sorry not at home for the version numbers). Then, when I updated to a newer version of gcc I had to add the quotes back or it wouldnt work :P I also had a similiar time with glibc. Specifically it seems that it wasnt passing an int, ie it was passing "1001" instead of 1001 to atoi.
__________________
Lethal Encounter
Reply With Quote
  #6  
Old 06-12-2003, 06:45 AM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default

That's exactly what's happening to me. I'm using a pre-3 version of gcc (and presumably the old libraries along with it)

Gaaahhh! This is driving me crazy. The last thing I expected was to get bulldozered by a problem with good 'ole atoi.

Well, I'm not mentally ready to upgrade to gcc3 anytime soon. (I just don't have the patience for it.) And technically the quotes should be stripped before sending into atoi anyway, so perhaps I'll just submit more snippets if I see any more of these.

And yes, bulldozered is a word... I looked it up in Krich's Lexicon of Lexicological Oddities :lol:

Regards,

krich
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:45 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3