Guest Seifer Posted September 2, 2003 Report Posted September 2, 2003 I'm trying to do numerical inputs, i looked at the mervbot tutorial for this but i get this error. C:Do-*BAD WORD*-ents and SettingsSeiferMy Do-*BAD WORD*-entsMERVBot PluginsBasicBotcommand.cpp(131) : error C2065: 'atoi' : undeclared identifier Any idea's?
»Dustpuppy Posted September 2, 2003 Report Posted September 2, 2003 You can use getInteger() if you're working with merv.
Guest Seifer Posted September 2, 2003 Report Posted September 2, 2003 ok well i got the error sorted, but how can i make it check for a number and take effect on it, so i make !test 1 pm you with, You selected 1. just so i have an example to work on
Dark Nexus Posted September 2, 2003 Report Posted September 2, 2003 switch (c->final (or whatever variable you stored it as)) { case 1: { sendPrivate(p, "You selected 1"); break; } case 2: { sendPrivate(p, "You selected 2"); break; } }
ExplodyThingy Posted September 2, 2003 Report Posted September 2, 2003 Wont work, as c->final is a string.What will work is using '1', however, that is not a numeric value. try #include for atoi(). In this case, you will want this:int number = atoi(c->final); to sture the int value of c->final to number. Now use sendPirvate(p,"You sent "+String(number)); You can THEN use the switch statement to utilize the number.
Dark Nexus Posted September 3, 2003 Report Posted September 3, 2003 maybe i am not clear on what you need. But the switch would work, with '1'. But if you needed to do arithmatic with the numbers, then i guess what explody thingy said
Mr Ekted Posted September 3, 2003 Report Posted September 3, 2003 switch statements only work with integral values. You can't use it to compare strings. switch (atoi(c->final)) { case 1: etc. }
»SOS Posted September 3, 2003 Report Posted September 3, 2003 Well it would compare the pointer in that case I think, but yea, that was not going to work
Dark Nexus Posted September 3, 2003 Report Posted September 3, 2003 ooohhhh, because the switch has to have a constant
Trained Posted September 3, 2003 Report Posted September 3, 2003 Lord Ekted has spoken! All hail Ekted *praises*
ExplodyThingy Posted September 6, 2003 Report Posted September 6, 2003 Hey! Whiskey Tango Foxtrot? I said the same thing as him!
Recommended Posts