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 needed

help needed

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


Pages: 1  2 

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #15 on Sun 08 Jul 2007 12:26 AM (UTC)
Message
What are the contents of 'word'? How big is the 'sql' buffer?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #16 on Sun 08 Jul 2007 01:03 AM (UTC)
Message
the contents of word were OL, and the sql buffer is 1000, so there is no issue there. when i remove the %%, the output is normal, it only messes up when i put in the two percentage signs.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #17 on Sun 08 Jul 2007 03:35 AM (UTC)
Message
Is it possible that the MUD is interpreting those symbols somehow?

See the following:


[david@thebalrog:~]$ cat test.c

#include <stdlib.h>
#include <stdio.h>

int main(char ** argv, int argc)
{
    char buf[1000];
    const char * word = "OL";

    sprintf(buf,"select * from dictionary where word like '%s%%'\n", word );
    printf(buf);

    return 0;
}

[david@thebalrog:~]$ gcc test.c -o test
[david@thebalrog:~]$ ./test                            
select * from dictionary where word like 'OL%'
[david@thebalrog:~]$


I use the \n because otherwise zsh gets a little confused.

Anyhow, it comes out correctly...

I would try, on the MUD, using printf instead of bug and see if it does the right thing. (Of course you will have to look at the logs.)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #18 on Mon 09 Jul 2007 02:41 AM (UTC)
Message
yeah i guess for whatever reason it wasn't showing up correctly either because of valgrind or the mud, but wrote up a little function to check words and it worked just fine.
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #19 on Thu 26 Jul 2007 07:44 AM (UTC)

Amended on Thu 26 Jul 2007 06:56 PM (UTC) by Gohan_TheDragonball

Message
Ok well after exhausting debugging and changes, I finally have a working version of this scrabble game. All the variables are now in the character structure. Instead of using an array of current words i decided to hold an array of integers pointing to the letter on the board instead. I have a couple problems however that I could use an outside opinion on.

1.) Not going in correct order, in terms of direction it might go fine up through the 4th letter but the 5th letter is 3 spaces away instead of adjacent to the last square.

2.) Non-words not being cut off when determined not a word. IE words like IUIRPU being checked in the dictionary when it shouldn't have made it past IU. I was even checking the code on my friends server, which does not even have access to my database, so techincally no words should have gone past two letters, but they were anyways.

http://www.mudbytes.net/index.php?a=pastebin&s=view&pid=1943

Thats the two files scrabble.c and scrabble.h pasted into one file, as well as the mud.h definitions and declarations. Any helps would be appreciated thanks.

****EDIT*****
After more debugging and changing I have fixed those two errors, and the code is actually working now. I still have some memory leaks to track down so back to valgrind.
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.


62,367 views.

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

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.