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
➜ New item types
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
| Posted by
| Orik
USA (182 posts) Bio
|
| Date
| Reply #30 on Wed 22 Aug 2007 12:55 AM (UTC) |
| Message
| | The object itself writes correctly to the area file. And it loads correctly on startup. When I oinvoke the socket numbers are all 0, but when I check the area file they are the numbers that they need to be. So it needs to be in create_object I would think. | | Top |
|
| Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
| Date
| Reply #31 on Wed 22 Aug 2007 04:08 AM (UTC) |
| Message
| you might wanna do something like this:
if( !str_cmp( word, "#ENDOBJECT" ) )
{
if( !pObjIndex->description )
pObjIndex->description = STRALLOC( "" );
if( !pObjIndex->action_desc )
pObjIndex->action_desc = STRALLOC( "" );
if( !pObjIndex->sdesc1 )
pObjIndex->sdesc1 = STRALLOC( "" );
if( !pObjIndex->sdesc2 )
pObjIndex->sdesc2 = STRALLOC( "" );
if( !pObjIndex->sdesc3 )
pObjIndex->sdesc3 = STRALLOC( "" );
if( !pObjIndex->sdesc4 )
pObjIndex->sdesc4 = STRALLOC( "" );
if( !pObjIndex->sdesc5 )
pObjIndex->sdesc5 = STRALLOC( "" );
if( !pObjIndex->sdesc6 )
pObjIndex->sdesc6 = STRALLOC( "" );
....
and my guess is that your use of "Used Sockets" in the write and read procedure is whats messing you up. you are supposed to use a single word, in your case sscanf is messing up since your reading "Sockets 0 0 0 0 0 0". dump the space and make it "UsedSockets" and see if the problem persists. you would have noticed this problem from the beginning except since you are scanning the whole line, the surplus at the end of the line is discarded and the error warning does not come up since there is no extra words in the file. just for the record, in this case you should not be using sscanf, but instead just using fread_number() each time. i am actually surprised its even still being used, i figured when samson switched to this area format he would get rid of it and save/read every variable separately. | | Top |
|
| Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
| Date
| Reply #32 on Wed 22 Aug 2007 08:04 AM (UTC) Amended on Wed 22 Aug 2007 08:07 AM (UTC) by Gohan_TheDragonball
|
| Message
| only my suggestion but here is how i would have done this:
if( !str_cmp( word, "Socket" ) )
{
int x = fread_number(fp);
pObjIndex->socket[x] = fread_number(fp);
pObjIndex->usocket[x] = fread_number(fp);
break;
}
for ( sock = 0; sock < 6; sock++ )
fprintf( fpout, "Socket %d %d %d\n", sock, pObjIndex->socket[sock], pObjIndex->usocket[sock]);
cuts you down from around 40 lines to 8 and reduces you from 26 variables to 2. | | Top |
|
| Posted by
| Orik
USA (182 posts) Bio
|
| Date
| Reply #33 on Wed 22 Aug 2007 01:22 PM (UTC) |
| Message
| I believe that was the problem. One whole space caused me quite a bit of grief...heh. It loads the object with the socket values now.
Only thing now is that when I save my char, quit, and log back in, the used sockets don't load on the object, but I believe I know how to fix that so I'll just have to wait and do that once I get home from work tonight.
Thanks for the help guys. | | 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.
104,145 views.
This is page 3, subject is 3 pages long:
1
2
3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top