Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Help with object saving problem.

Help with object saving problem.

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Gtr   (38 posts)  Bio
Date Thu 17 Jun 2004 08:00 AM (UTC)

Amended on Thu 17 Jun 2004 08:10 AM (UTC) by Gtr

Message
Hey guys, heres my problem, I have everything set up for some new object varibles. I added acc, ra, di, fi, they work fine, but they just dont save, oset it and it shows on the ostat, I foldarea, reboot and it sets back to 0. I have the folda code dealing with objects below. I have such a headache over this..well thanks for helping if you can.

    

               /* save objects */
    fprintf( fpout, "#OBJECTS\n" );
    for ( vnum = tarea->low_o_vnum; vnum <= tarea->hi_o_vnum; vnum++ )
    {
	if ( (pObjIndex = get_obj_index( vnum )) == NULL )
	  continue;
	if ( install )
	  xREMOVE_BIT( pObjIndex->extra_flags, ITEM_PROTOTYPE );
	fprintf( fpout, "#%d\n",	vnum				);
	fprintf( fpout, "%s~\n",	pObjIndex->name			);
	fprintf( fpout, "%s~\n",	pObjIndex->short_descr		);
	fprintf( fpout, "%s~\n",	pObjIndex->description		);
	fprintf( fpout, "%s~\n",	pObjIndex->action_desc		);
	if ( pObjIndex->layers )
	  fprintf( fpout, "%d %s %d %d\n",	pObjIndex->item_type,
				print_bitvector(&pObjIndex->extra_flags),
						pObjIndex->wear_flags,
						pObjIndex->layers	);
	else
	  fprintf( fpout, "%d %s %d\n",	pObjIndex->item_type,
			print_bitvector(&pObjIndex->extra_flags),
					pObjIndex->wear_flags		);

	val0 = pObjIndex->value[0];
	val1 = pObjIndex->value[1];
	val2 = pObjIndex->value[2];
	val3 = pObjIndex->value[3];
	val4 = pObjIndex->value[4];
	val5 = pObjIndex->value[5];
	switch ( pObjIndex->item_type )
	{
	case ITEM_PILL:
	case ITEM_POTION:
	case ITEM_SCROLL:
	    if ( IS_VALID_SN(val1) ) 
          {
		if ( AREA_VERSION_WRITE == 0 ) val1 = skill_table[val1]->slot;
		else	val1 = HAS_SPELL_INDEX;
          }
	    if ( IS_VALID_SN(val2) ) 
          {
		if ( AREA_VERSION_WRITE == 0 ) val2 = skill_table[val2]->slot;
		else	val2 = HAS_SPELL_INDEX;
          }
	    if ( IS_VALID_SN(val3) ) 
          {
		if ( AREA_VERSION_WRITE == 0 ) val3 = skill_table[val3]->slot;
		else	val3 = HAS_SPELL_INDEX;
          }
	    break;
	case ITEM_STAFF:
	case ITEM_WAND:
	    if ( IS_VALID_SN(val3) ) 
          {
		if ( AREA_VERSION_WRITE == 0 ) val3 = skill_table[val3]->slot;
		else  val3 = HAS_SPELL_INDEX;
          }
	    break;
	case ITEM_SALVE:
	    if ( IS_VALID_SN(val4) ) 
          {
		if ( AREA_VERSION_WRITE == 0 ) val4 = skill_table[val4]->slot;
		else  val4 = HAS_SPELL_INDEX;
          }
	    if ( IS_VALID_SN(val5) ) 
          {
		if ( AREA_VERSION_WRITE == 0 ) val5 = skill_table[val5]->slot;
		else  val5 = HAS_SPELL_INDEX;
          }
	    break;
	}
	if ( val4 || val5 )
	  fprintf( fpout, "%d %d %d %d %d %d\n",val0, 
						val1,
						val2,
						val3,
						val4,
						val5 );
	else
	fprintf( fpout, "%d %d %d %d\n",	val0,
						val1,
						val2,
						val3 );

  fprintf( fpout, "%d %d %d %d\n",  pObjIndex->acc,
           pObjIndex->ra,
           pObjIndex->da,
           pObjIndex->fi    );
	fprintf( fpout, "%d %d %d\n",	pObjIndex->weight,
					pObjIndex->cost,
					pObjIndex->rent ? pObjIndex->rent :
				 (int) (pObjIndex->cost / 10)		);

        if ( AREA_VERSION_WRITE > 0 )
    	switch ( pObjIndex->item_type )
    	{
    	case ITEM_PILL: 
    	case ITEM_POTION:
    	case ITEM_SCROLL:
           	fprintf( fpout, "'%s' '%s' '%s'\n",
                	IS_VALID_SN(pObjIndex->value[1])?
			skill_table[pObjIndex->value[1]]->name:"NONE",
			IS_VALID_SN(pObjIndex->value[2])?
			skill_table[pObjIndex->value[2]]->name :"NONE",
			IS_VALID_SN(pObjIndex->value[3])? 
			skill_table[pObjIndex->value[3]]->name:"NONE" );
        	break;
    	case ITEM_STAFF:
    	case ITEM_WAND:
            	fprintf( fpout, "'%s'\n",
                        IS_VALID_SN(pObjIndex->value[3])?  
                	skill_table[pObjIndex->value[3]]->name:"NONE" );
	
        	break;
    	case ITEM_SALVE:
            	fprintf( fpout, "'%s' '%s'\n",
                        IS_VALID_SN(pObjIndex->value[4])?  
                	skill_table[pObjIndex->value[4]]->name:"NONE",
			IS_VALID_SN(pObjIndex->value[5])?
                	skill_table[pObjIndex->value[5]]->name:"NONE" );
        break;
    	}

	for ( ed = pObjIndex->first_extradesc; ed; ed = ed->next )
	   fprintf( fpout, "E\n%s~\n%s~\n",
			ed->keyword, strip_cr( ed->description )	);

	for ( paf = pObjIndex->first_affect; paf; paf = paf->next )
	   fprintf( fpout, "A\n%d %d\n", paf->location,
	     ((paf->location == APPLY_WEAPONSPELL
	    || paf->location == APPLY_WEARSPELL
	    || paf->location == APPLY_REMOVESPELL
	    || paf->location == APPLY_STRIPSN
	    || paf->location == APPLY_RECURRINGSPELL)
	    && IS_VALID_SN(paf->modifier))
	    ? skill_table[paf->modifier]->slot : paf->modifier		);

	if ( pObjIndex->mudprogs )
	{
	  for ( mprog = pObjIndex->mudprogs; mprog; mprog = mprog->next )
		fprintf( fpout, "> %s %s~\n%s~\n",
				mprog_type_to_name( mprog->type ),
				mprog->arglist, strip_cr(mprog->comlist) );
	  fprintf( fpout, "|\n" );	  
	}
    }
    fprintf( fpout, "#0\n\n\n" );
    if ( install && vnum < tarea->hi_o_vnum )
      tarea->hi_o_vnum = vnum - 1; 
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Thu 17 Jun 2004 03:17 PM (UTC)
Message
Did you remember to add it to fread_obj? (Or something of that sort of function)

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #2 on Thu 17 Jun 2004 03:37 PM (UTC)
Message
Don't forget to add it to create_object as well. This set the values on the object index onto the specific instances of those objects. This is often forgotten when people add new variables.

You also want to add it to make_object if your copying vnums through "ocreate <name> <vnum> <copyvnum>".

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #3 on Fri 18 Jun 2004 01:11 AM (UTC)
Message
I added it to fread_ob, create_ob, and make_ob, and it still doesnt save when I folda and reboot. Stressing heh.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #4 on Fri 18 Jun 2004 05:06 AM (UTC)
Message
Ok, well, check this: Is it writing it to the area files or not? If it is, we can rule that part of it out, if not, we know where to look.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #5 on Fri 18 Jun 2004 05:14 AM (UTC)
Message
It's not writing to the file.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #6 on Fri 18 Jun 2004 05:58 AM (UTC)
Message
K, well that narrows it down. Are other changes to that same object being saved?

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #7 on Fri 18 Jun 2004 06:03 AM (UTC)

Amended on Fri 18 Jun 2004 06:07 AM (UTC) by Gtr

Message
Yes just not the varibles I added.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #8 on Fri 18 Jun 2004 06:07 AM (UTC)
Message
Ummm, did you recompile? Try a "make clean" then "make". Were there any errors or warnings?

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #9 on Fri 18 Jun 2004 06:08 AM (UTC)

Amended on Fri 18 Jun 2004 06:32 AM (UTC) by Gtr

Message
I did both a few times since the changes, and I have no errors, or warnings.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #10 on Fri 18 Jun 2004 06:21 AM (UTC)
Message
Can you maybe show a complete sequence of what your doing? Is ther area assigned to you? Is the object set with the prototype flag when your setting it? Is the objects vnum within the boundries that area? do you have a specific instance on your character, or are you targetting it globally? When you foldarea, do you get the log message saying that it was saved? If you modify that specific objects weight with the prototype flag on, then foldarea and reboot, does the change to thte weight stick?

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #11 on Fri 18 Jun 2004 06:42 AM (UTC)
Message
Ok, I loadup the object I created in the area I assign my self, and set it to prototype, I change the new values to 50 50 50 50, and I change a few other things just to see if they save I take the prototype flag off and foldarea then reboot. All the other options on the item that I set are still there except for the new ones. So the weight I changed and some of the v's that I changed all saved..but my new varibles didnt..


So then I tried this, I had the object while not in prototype mode, and changed the indivigual objects weight, and one of my created values. Then I saved my idivigual charecter and rebooted. The weight was still changed when it started up again but the new value didnt save.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #12 on Fri 18 Jun 2004 06:47 AM (UTC)
Message
Can you paste the object that you saved and are changing from the area file?

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #13 on Fri 18 Jun 2004 07:00 AM (UTC)
Message
#101
&wA Test~
&wA Test~
&wA Test has been left here.~
~
65 0 8192
20 0 20 0 0 1
10 10 10 10
1 0 0
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #14 on Fri 18 Jun 2004 07:16 AM (UTC)

Amended on Fri 18 Jun 2004 07:31 AM (UTC) by Greven

Message
Is this not the appropriate lines?

#101
&wA Test~
&wA Test~
&wA Test has been left here.~
~
65 0 8192
20 0 20 0 0 1
10 10 10 10
1 0 0

Looks like its being written... can you paste your oset code appropriate to these values?

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


61,336 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.