Server Help

Bot Questions - Sighage with bot vars.

ExplodyThingy - Wed Jan 08, 2003 11:20 am
Post subject: Sighage with bot vars.
p->name
Im trying to make a trivia type bot and need to isolate thier names.
I know that to capture a message in a string its
Code: Show/Hide
String s =msg;
If(s == FunkyVarName){}

but will that work with p->name?

Separtately, how do i do something like capture line 5 from a 30 line text file and store it to a string. Then, capture line 5 from another text file and compare it to msg. Like trivia with a question.txt and answer.txt

Keep in mind im in a bit of a hurry while typing this, so it may not be clear, am not infront of my code, and i am new to C++.
SOS - Wed Jan 08, 2003 12:30 pm
Post subject:
1) You mean if p->name is the FunkyVarName? Yes, p->name is a char[] string, so Catid's String class will work with it
If you mean p->name as the one on the left, then no.
2) You just have to read every line and count how many you have read until you reach the number you want.
ExplodyThingy - Wed Jan 08, 2003 5:50 pm
Post subject:
Drat.
k. Uh,
Code: Show/Hide
if(x){
String answer = "RandomText";
}
if(PlayerAnswer == answer){}

The complier gives error to the second "answer", says undeclared identifier. Does this mean that i didnt set the variable "answer" as a gloabal var? how do i do that from within one of the switch case{} things in the file

(Im not asking for a "how to write a plugin tutorial", and im trying to not end up doing that, im just baffeled by a few things, and i cant find any decent web resource that explaines these.)
Mine GO BOOM - Wed Jan 08, 2003 5:54 pm
Post subject:
Whenever you declare a variable inside a {}, it is only valid inside that. To do what you want, you need to do the following:

Code: Show/Hide
String answer = "";
if(x){
  answer = "RandomText";
}
if(PlayerAnswer == answer){}

ExplodyThingy - Wed Jan 08, 2003 6:00 pm
Post subject:
Gracias you 2.
Mine GO BOOM - Wed Jan 08, 2003 6:05 pm
Post subject:
Just remember to not do a string check if you don't want an answer. Otherwise someone could figure out a way to beat the system, and do things like sending a blank message that may screw up your bot. Yes, people do find ways to break things (i love bre.. i mean, debugging other people's things).
ExplodyThingy - Fri Jan 10, 2003 4:01 pm
Post subject:
mmk.
would this help take care of a few of those?
Code: Show/Hide
if(PlayerAnswer == "" || PlayerAnswer == " ") break;


[edit: stupid question, heh]

[edit: figured it out. Nice little website at http://www.dueling.net/bots/ ]
Anonymous - Sun Jan 19, 2003 10:19 pm
Post subject:
How do i find if someone is i spec?
Ive cant really seem to find something coherent in the others. something like
Code: Show/Hide
If(p->ship == spec) break;

do i have to use those funky player tag things that the rampage bot uses? If so, how?
SOS - Sun Jan 19, 2003 11:42 pm
Post subject:
if (p->ship == SHIP_Spectator)
ExplodyThingy - Fri Jan 31, 2003 4:55 pm
Post subject:
Ok, i suppose that works with SHIP_warbird and SHIP_lancaster and such?

And:
lets say i have command !pm [name] how do i convert c->final into whatever i need so i can do sendPrivate(c->final, "Someone says HI!");

Thanks in advance for putting up with my stupidity and all the other questions ive had.
Anonymous - Fri Jan 31, 2003 6:47 pm
Post subject:
Ok, i suppose that works with SHIP_warbird and SHIP_lancaster and such?

Yup.

-Rifle
SOS - Sat Feb 01, 2003 4:12 am
Post subject:
Quote:
lets say i have command !pm [name] how do i convert c->final into whatever i need so i can do sendPrivate(c->final, "Someone says HI!");


String s;
s = "Someone says ";
s += c->final;

ez
Dr Brain - Sat Feb 01, 2003 9:59 am
Post subject:
Heh, sos, thats what I thought, then I re-read the post.
SOS - Sat Feb 01, 2003 11:12 am
Post subject:
Oh sa_tongue.gif
Well.... just iterate through the list and compare
ExplodyThingy - Sat Feb 01, 2003 4:30 pm
Post subject:
Right, the question was asking how to send a pm to c->final, not how to make a message with the text c->final in it.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group