Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Alias and Player class functions

 
Post new topic   Reply to topic Printable version
 View previous topic  yay,i got my bot.now what? Post :: Post public commands  View next topic  
Author Message
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Sep 22, 2003 6:45 pm    Post subject: Alias and Player class functions Reply to topic Reply with quote

2 Questions:

1) Has anybody had problems with alias.dll just plain not recording names? It's kinda weird.

2) I keep getting a weird error in my plugin.
When I do this:
botInfo::cheack_leave(Player *p)
{
if (p->name == array[p->team])
blah;
}
The function doesn't work.

And yet this works:
botInfo::check_leave(String name, int team)
{
if (name == array[team])
blah;
}

Of course I am calling the function differently with:
check_leave(p);
check_leave(p->name, p->team);

So I'm doing it the second way but I could do a lot more and it would be simpler to do it the first. Any help/explanation would be appreciated!

Thanks,
Cyan~Fire
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Plody
Guest


Offline

PostPosted: Wed Sep 24, 2003 7:53 am    Post subject: Reply to topic Reply with quote

Because p->name (i think) is a char, and, looking at the array, that is type String. Do "String bleh = p->name", then use "if(bleh == array[p->team])".
That oughta work.
Back to top
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Wed Sep 24, 2003 4:17 pm    Post subject: Reply to topic Reply with quote

Hmmm, good thinking, I'll try it out later. I still don't fully understand how the String class works, basically I just have 'pidgin MERVBot', I don't really understand how a lot of it works.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Rifle
Guest


Offline

PostPosted: Wed Sep 24, 2003 10:12 pm    Post subject: Reply to topic Reply with quote

When I work with Mervbot-defined strings and my own variables ( such as char playername[20] ), I use strcmp instead of if (string1 == string2).

f.ex

if (strcmp(mystring,mervstring)==0)
{
tell(makeEcho("my string is equal to mervs string"));
}
else
{
tell(makeEcho("my string is not equal to mervs string"));
}

Note : Remember that strcmp is case-sensetive, so converting both strings to lowercase is recommended if f.ex you`re comparing a players input to f.ex a string from a text file.

You might have to #include "string.h" to use the strcmp function.

-Rifle
Back to top
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Sep 25, 2003 6:14 pm    Post subject: Reply to topic Reply with quote

Thanks, but I think that's fixing what isn't broken. I'm using 'string1==string2' right now and it works. And case doesn't matter too because the value stored in 'array' is straight from p->name, so the case should be the same no matter what.

And anyway, my main problem is with alias.dll. I can't ban anybody the nice way because it records no player names and just says 'I have never seen them before.'

Thanks though.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dustpuppy
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Jan 23 2003
Posts: 215
Location: England
Offline

PostPosted: Fri Sep 26, 2003 11:42 am    Post subject: Reply to topic Reply with quote

The String object has it's own function for comparing to a char, so as long as you put it as the first item it will work. Like this:

botInfo::cheack_leave(Player *p)
{
if (array[p->team] == p->name)
blah;
}

Rather than this:


botInfo::cheack_leave(Player *p)
{
if (p->name == array[p->team])
blah;
}
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Sep 26, 2003 7:47 pm    Post subject: Reply to topic Reply with quote

Oooooh ok, cool, thanks.

Any comments on alias?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
ExplodyThingy
Server Help Squatter


Age:38
Gender:Gender:Male
Joined: Dec 15 2002
Posts: 528
Location: Washington DC
Offline

PostPosted: Fri Sep 26, 2003 9:22 pm    Post subject: Reply to topic Reply with quote

Clean the names out of the database, use the new(er) one on cats site, with the large-zone bug fix.
_________________
There are no stupid question, but there are many inquisitive idiots.
Loot

Dr Brain> I hate clean air and clean water. I'm a member of Evil Conservitive Industries
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat Sep 27, 2003 11:31 am    Post subject: Reply to topic Reply with quote

Lol, whoops, sorry about that, the problem was just that my bot wasn't sysop. Oh well, thanks anyway.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 179 page(s) served in previous 5 minutes.

phpBB Created this page in 0.554418 seconds : 34 queries executed (89.7%): GZIP compression disabled