Server Help

Bot Questions - Ident problems

Cyan~Fire - Sat Nov 01, 2003 2:04 pm
Post subject: Ident problems
I've changed my capital ship plugin to check caps with ident instead of name, as it's just plain easier to work with.
But, for some reason, MERVBot isn't reading the ident right. So, to test it out, I made a command (!idme) that does:
sendPrivate(p, "Your ident is: " + p->ident); //Using class String '+' operator
and when I use the command, it just says "Your ident is: ".
I know MERV can read my ID, since it can send me private messages, but does anyone know what's causing this? Maybe I'm just making a stupid mistake.
k0zy - Sat Nov 01, 2003 7:03 pm
Post subject:
Code: Show/Hide
sendPrivate(p, "Your ident is: " + p->ident");


Where does the third " come from?
Cyan~Fire - Sat Nov 01, 2003 8:29 pm
Post subject:
Oops there is not third lol, edited.

Well I made a workaround by doing if (ident), but I'd still like to know why it's doing this
ExplodyThingy - Sat Nov 01, 2003 8:39 pm
Post subject:
p->ident is NOT good to use. Ident is not ?userid. Its the 3-byte id assigned by the server for use with chat and such items. It changes from connection to connection.
Mine GO BOOM - Sat Nov 01, 2003 10:57 pm
Post subject:
ExplodyThingy wrote:
Its the 3-byte id assigned by the server for use with chat and such items. It changes from connection to connection.


2 bytes. Just in the one position packet's case, it uses one byte, so it can shrink the packet's size. If the userid is over 255, it will always use the larger position packet.
Cyan~Fire - Sat Nov 01, 2003 11:01 pm
Post subject:
Oh. So you recommend I switch back to p->name?
50% Packetloss - Sat Nov 01, 2003 11:36 pm
Post subject:
ident starts at 0 and increments up for each player.
So if the bot was in the arena, it would be ident=0 then I entered then i would be Ident=1.
Cyan~Fire - Sun Nov 02, 2003 1:12 pm
Post subject:
Except it was just not getting an ident for players. The if (p->ident == blah) statement was true for every single player...

I'll just switch back to names, I guess.
Anonymous - Sun Nov 02, 2003 7:18 pm
Post subject:
try casting it to a string before you print it

sendPrivate(p,"your ident is " + (String)p->ident);
Cyan~Fire - Sun Nov 02, 2003 9:24 pm
Post subject:
No, the String class has its own operator for adding integers.
Anyway, I already switched back to p->name, so topic closed. But, thanks anyway. icon_smile.gif
Anonymous - Wed Nov 19, 2003 12:10 pm
Post subject:
it doesn't convert it to a String because you're adding a const char* and an integer, and then trying to convert the result to a String... if it did work you would have gotten a number... and clearly you didn't icon_smile.gif
Cyan~Fire - Wed Nov 19, 2003 4:12 pm
Post subject:
Other things I have tried worked like this... or at least I think so. icon_razz.gif

Thanks, but lol I've totally redone my system now to use Player struct pointers, instead of just one value. Makes a lot more sense.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group