I've gotten everything all sorted out for my little program. I followed the link to Dsock found here aswell to get Dsock.h for handling my sockets. Now I just need to figure out how to search this string.
Strength: 15 Intelligence: 12 Wisdom: 16 Dexterity: 16 Constitution: 15
To cross reference the stats defined by the user, versus the stats given from the socket. Then act upon it. This is what I have. However it doesn't work.
I got the code from a guy who built this feature into his MUD client. I assumed it would work outside of its environment. I assumed wrong.Code:from = ReadCommand(s, buf); if (from[0] != 'S') return; // str stat = (from[10]-48) * 10 + from[11]-48; if (stat < str){ write_to_socket("no\n"); return; } // int stat = (from[27]-48) * 10 + from[28]-48; if (stat < in){ write_to_socket("no\n"); return; } // wis stat = (from[38]-48) * 10 + from[39]-48; if (stat < wis){ write_to_socket("no\n"); return; } // dex stat = (from[52]-48) * 10 + from[53]-48; if (stat < dex){ write_to_socket("no\n"); return; } // con stat = (from[69]-48) * 10 + from[70]-48; if (stat < con){ write_to_socket("no\n"); return; } write_to_socket("yes\n");