Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
Yandex, AhrefsBot, Google

Members: 0
Guests: 5
Stats
Files
Topics
Posts
Members
Newest Member
489
3,794
19,649
596
Elwood

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » AFKMud Support & Development » Connect code not working
Forum Rules | Mark all | Recent Posts

Connect code not working
< Newer Topic :: Older Topic > I believe...

Pages:<< prev 1 next >>
Post is unread #1 Jan 11, 2007 4:37 pm   
Go to the top of the page
Go to the bottom of the page

Lazerous

GroupMembers
Posts79
JoinedAug 10, 2005

 
obj #1 is a iron rod
type piece
value0 is set for next item, value1 is set for completed item

obj #2 is a iron ring
type piece
value0 is set for obj#1, value1 is set for completed item

When I use connect on these, nothing is echo'd back, and
no item is removed nor placed into inventory.

As my internet is down for at least a day, I will periodically
check back using my land lords wireless to see if this has
been seen by others and if anyone has any sugestions.

I was kinda hoping to make players piece together their
first set of gear from various items in my newbie area,
following notes left from some mobs on how to create
the final items....

Post is unread #2 Jan 12, 2007 11:26 am   Last edited Jan 12, 2007 11:26 am by tphegley
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

 
Hey Ryan,

I noticed the connect code had an error in it as well. I haven't put in the error to Samson yet. Basically the error is when the if statement is reading the value types. It reads the wrong value types for each object.

Bear with me, I don't have the code in front of me and I'm trying to remember it.

It says something like if obj value 1 of first object equal object value 1 of second object and both value 3's are equal then create else don't create.

If you go with what the help file says
object 1: v1 = object 2 v0
object 2: v0 = object 1 v1
object 3 v3 of both object one and two

Then you would have
if obj value 1 of first object equal object value 0 of second object and both value 3's are equal then create else don't create.

I'll give the actual code once I get home if this doesn't help.

Post is unread #3 Jan 12, 2007 11:41 am   
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

 
Here:

  if ( ( first_ob->value[0] == second_ob->pIndexData->vnum )
  && ( second_ob->value[0] == first_ob->pIndexData->vnum )
  && ( first_ob->value[1] == second_ob->value[1]  )
  && ( first_ob->pIndexData->vnum != second_ob->pIndexData->vnum ) )
  /* good connection  */


Turns into this:

  if ( ( first_ob->value[1] == second_ob->pIndexData->vnum )
  && ( second_ob->value[0] == first_ob->pIndexData->vnum )
  && ( first_ob->value[2] == second_ob->value[2]  )
  && ( first_ob->pIndexData->vnum != second_ob->pIndexData->vnum ) )
  /* good connection  */


I believe that's it. I just downloaded the snippet and looked it over real quick. Let me know if that works.

Post is unread #4 Jan 12, 2007 1:11 pm   
Go to the top of the page
Go to the bottom of the page

Lazerous

GroupMembers
Posts79
JoinedAug 10, 2005

 
Heh, ya I am so new to this codebase, I really have no idea where the connect is, I am still trying to figure out grep.
It's very ambiguous by its man files. Could you tell which file has to be modified please. Also if you could give me a basic
grep search that would be awesome as well.

Example: I want to search for "piece" in all files in my src folder with it giving out line locations in the files for the found string.

Post is unread #5 Jan 12, 2007 1:13 pm   
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

 
You have put in the item connection snippet correct?

Post is unread #6 Jan 12, 2007 1:15 pm   Last edited Nov 25, 2007 8:58 pm by Samson
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

 
After looking back over your post, is your code a stock code that you just downloaded? If you haven't put in the item connection snippet from this site then go to this link and download the files.

http://smaugmuds.afkmods.com/index.php?a=files&s=viewfile&fid=60

After you put in everywhere it needs to be put in, then make the change in do_connect where it needs changed.

The stock code I don't believe has this snippet in it. SMAUGFUSS1.7 doesn't anyways. i don't know about afkmud.

Post is unread #7 Jan 12, 2007 2:12 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
AFKMud comes with the item connection code built in. But I'll look into the problem when I get a chance.

Post is unread #8 Jan 12, 2007 3:11 pm   
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

 
Here it is in misc.cpp on the 2.0 version I believe.

   /*
    * check to see if the pieces connect 
    */
   if( first_ob->value[0] == second_ob->pIndexData->vnum && second_ob->value[0] == first_ob->pIndexData->vnum )
   {
      /*
       * good connection  
       */
      if( !( new_ob = get_obj_index( first_ob->value[2] )->create_object( ch->level ) ) )
      {
         log_printf( "create_object: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ );
         return;
      }


It's showing that first object's v0 has to be the vnum of the second object and the second objects v0 has to be the vnum of the first object. v1 is not used in this part, but v2 is the vnum of the object that you want it to create. So this is in affect, working correctly. I don't see how you didn't get any type of output when you tried to connect something?

Post is unread #9 Jan 12, 2007 4:00 pm   
Go to the top of the page
Go to the bottom of the page

Lazerous

GroupMembers
Posts79
JoinedAug 10, 2005

 
K well no I didnt add it in, its an afkud 2.0 I am using.
Samson said he will look into, that's enough for me, but could someone give me the
syntax on the grep command as per what I asked on it?

Post is unread #10 Jan 12, 2007 4:28 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Basic grep for this situation:

While in src,
grep do_connect *.c

The output should show anywhere that do_connect shows up in text. It may not necessarily be right because there might be a comment somewhere that mentions it, but it should be obvious when that happens.

Post is unread #11 Jan 12, 2007 5:47 pm   
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

 
And if you want it to show line numbers for each file as well, try it as:
grep do_connect -n *
while you're at it, another command that could be immensely helpful would be:
man grep

Post is unread #12 Jan 12, 2007 7:46 pm   
Go to the top of the page
Go to the bottom of the page

Lazerous

GroupMembers
Posts79
JoinedAug 10, 2005

 
Thanks for the info, but conner, as I said above, the man file was ambiguous at best, was hardly any help.
It was not written very clearly. That was why I asked such a dumb question. I did a search on google, but
well it was less then helpfull.

Post is unread #13 Jan 12, 2007 11:19 pm   
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

 
The man file is most useful for seeing what the options are, but basically the grep command uses the syntax of:
grep 'search term'

Post is unread #14 Jan 13, 2007 12:15 am   
Go to the top of the page
Go to the bottom of the page

Lazerous

GroupMembers
Posts79
JoinedAug 10, 2005

 
Here is the stats for the 3 objects, this is for trouble shooting.
When I looked at the code, nothing stood out to me.
That doesn't say much, I am used to "C++" not "C"

First Item:
|Name : iron rod
|Short : a small odd looking iron rod
|Long : a small odd looking iron rod lies here.
|Area : Institute of the Novice
|Vnum : 1018 |Type : piece |Count : 001 |Gcount: 001
|Number : 01/01 |Weight: 0001/0001 |Wear_loc : -01 |Layers: 0
|Cost : 0 |Ego* : -2 |Ego : 0 |Timer: 0
|In room: 0 |In obj: (NONE) |Level : 1 |Limit: 9999
|On map : (NONE)
|Object Coords: -1 -1
|Wear flags : take
|Extra flags : glow
|Carried by : Lazerous
|Prizeowner : (NONE)
|Seller : (NONE)
|Buyer : (NONE)
|Current bid : 0
|Scheduled donation date: (NONE)
|Index Values : 1019 1020 0 0 0 0 0 0 0 0 0
|Object Values: 1019 1020 0 0 0 0 0 0 0 0 0
|Primary description keywords: 'rod '.
|Objprogs : None

Additional Object information:
Value[0] - Obj Vnum for Other Half: 1019Value[1] - Obj Vnum for Combined Object: 1020

Second Item:
|Name : iron ring
|Short : a small odd looking iron ring
|Long : a small odd looking iron ring lies here.
|Area : Institute of the Novice
|Vnum : 1019 |Type : piece |Count : 001 |Gcount: 001
|Number : 01/01 |Weight: 0001/0001 |Wear_loc : -01 |Layers: 0
|Cost : 0 |Ego* : -2 |Ego : 0 |Timer: 0
|In room: 0 |In obj: (NONE) |Level : 1 |Limit: 9999
|On map : (NONE)
|Object Coords: -1 -1
|Wear flags : take
|Extra flags : glow
|Carried by : Lazerous
|Prizeowner : (NONE)
|Seller : (NONE)
|Buyer : (NONE)
|Current bid : 0
|Scheduled donation date: (NONE)
|Index Values : 1018 1020 0 0 0 0 0 0 0 0 0
|Object Values: 1018 1020 0 0 0 0 0 0 0 0 0
|Primary description keywords: 'ring '.
|Objprogs : None

Additional Object information:
Value[0] - Obj Vnum for Other Half: 1018Value[1] - Obj Vnum for Combined Object: 1020

Final Item:
|Name : iron small key
|Short : a small iron key
|Long : a small iron key
|Area : Institute of the Novice
|Vnum : 1020 |Type : key |Count : 001 |Gcount: 001
|Number : 01/01 |Weight: 0001/0001 |Wear_loc : -01 |Layers: 0
|Cost : 0 |Ego* : -2 |Ego : 0 |Timer: 0
|In room: 0 |In obj: (NONE) |Level : 1 |Limit: 9999
|On map : (NONE)
|Object Coords: -1 -1
|Wear flags : take
|Extra flags : glow
|Carried by : Lazerous
|Prizeowner : (NONE)
|Seller : (NONE)
|Buyer : (NONE)
|Current bid : 0
|Scheduled donation date: (NONE)
|Index Values : 1023 0 0 0 0 0 0 0 0 0 0
|Object Values: 1023 0 0 0 0 0 0 0 0 0 0
|Objprogs : None

Additional Object information:
Value[0] - Lock #: 1023
Value[4] - Durability: 0
Value[5] - Container Lock Number: 0

Again, no rush on this, just trying to supply as much info as I can on this.

Post is unread #15 Jan 13, 2007 4:37 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Fix posted.

Post is unread #16 Jan 13, 2007 5:06 pm   
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

 
ryan_rae said:

Here is the stats for the 3 objects, this is for trouble shooting.
When I looked at the code, nothing stood out to me.
That doesn't say much, I am used to "C++" not "C"


Are you sure you'd looked at the code? I ask because one of the whole points of AFKMud 2.0 was that it'd been converted to C++ and no longer is written in C.

Pages:<< prev 1 next >>