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
Fakes & chat

 
Post new topic   Reply to topic Printable version
 View previous topic  Antiwarp in safezones Post :: Post Python Interfaces  View next topic  
Author Message
Hakaku
Server Help Squatter


Joined: Apr 07 2006
Posts: 299
Location: Canada
Offline

PostPosted: Thu Feb 26, 2009 12:47 pm    Post subject: Fakes & chat Reply to topic Reply with quote

At the moment in Deva we currently have the server forward messages to a bot in order to be able to send messages on a ?chat channel. In our attempt to make the zone eventually bot-free, would it technically be possible for the server or a fake player to send messages on a chat channel? If so, how could this be done?
Back to top
View users profile Send private message Add User to Ignore List Send email
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Thu Feb 26, 2009 1:58 pm    Post subject: Reply to topic Reply with quote

I know for sure it is. But do you want to keep the bot on a certain chat channel, or do you want the bot just relaying messages to different chat channels?
Back to top
View users profile Send private message Add User to Ignore List
Hakaku
Server Help Squatter


Joined: Apr 07 2006
Posts: 299
Location: Canada
Offline

PostPosted: Thu Feb 26, 2009 2:23 pm    Post subject: Reply to topic Reply with quote

Chambahs wrote:
I know for sure it is. But do you want to keep the bot on a certain chat channel, or do you want the bot just relaying messages to different chat channels?

I think you misunderstood. Right now we already have a bot relaying messages from the server to a ?chat channel. What I'd like to be able to do is get rid of the bot entirely and just have the server/fake player send messages to the channel. So I'm asking if this is even possible?
Back to top
View users profile Send private message Add User to Ignore List Send email
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Feb 26, 2009 3:07 pm    Post subject: Reply to topic Reply with quote

It's possible. You'd have to create a module to log a player into the billing server, and send ?chat=...

I don't know how much trouble that will be, though.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Thu Feb 26, 2009 5:25 pm    Post subject: Reply to topic Reply with quote

ive been meaning to do an asss chat mod, ill look into it...
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Initrd.gz
Seasoned Helper


Joined: Sep 18 2008
Posts: 134
Location: Over there --->
Offline

PostPosted: Fri Feb 27, 2009 8:25 pm    Post subject: Reply to topic Reply with quote

For fakes "speaking":

A ) You can use chat->SendAnyMessage
B ) You can add "Fake>" to the beginning of a message and send it like any other, though it would be green

Look at the Color module for how to "spoof" the color of chat->SendAnyMessage to make it look like a public/team/priv. message
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Fri Feb 27, 2009 9:33 pm    Post subject: Reply to topic Reply with quote

None of that will help with speaking on a ?chat channel.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sat Feb 28, 2009 12:50 am    Post subject: Reply to topic Reply with quote

because it only sends to those inside the zone


yeah, you could fake an entire chat session, but it wouldnt do anything for those in other zones...
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Thu Mar 05, 2009 2:17 am    Post subject: Reply to topic Reply with quote

in chat.c, it uses

Code: Show/Hide

local void v_send_msg(LinkedList *set, char type, char sound, Player *from, const char *str, va_list ap)
{
   int size;
   char _buf[256];
   const char *ctype = get_chat_type(type);
   struct ChatPacket *cp = (struct ChatPacket*)_buf;

   size = vsnprintf(cp->text, 250, str, ap) + 6;

   if (type == MSG_MODCHAT)
      type = MSG_SYSOPWARNING;

   cp->pktype = S2C_CHAT;
   cp->type = type;
   cp->sound = sound;
   cp->pid = from ? from->pid : -1;
   if (net) net->SendToSet(set, (byte*)cp, size, NET_RELIABLE);
   if (chatnet && ctype)
   {
      if (from)
         chatnet->SendToSet(set, "MSG:%s:%s:%s", ctype, from->name, cp->text);
      else
         chatnet->SendToSet(set, "MSG:%s:%s", ctype, cp->text);
   }
}


i notice it uses
Code: Show/Hide

struct ChatPacket *cp = (struct ChatPacket*)_buf;


which is basically inline structure declaration.
why does this work?
i tried throwing this into my code, but it died with a "dereferencing pointer to incomplete type" error every time i tried to do cp->pktype = S2C_CHAT; or something...


--edit--
i got this to compile without error by tweaking the code.
however, the curent ChatPacket struct expects char text[0], which i know wants the pointer to a char array...
how do i pass char buf[256] to cp.text without getting an incompatible types error?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Mar 05, 2009 6:43 am    Post subject: Reply to topic Reply with quote

It works because it doesn't do what you think it's doing. It declares the chat packet as pointing to the buffer, it doesn't create a new chat packet. It's not an inline structure declaration.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Mar 05, 2009 10:10 am    Post subject: Reply to topic Reply with quote

Yeah, it just typecasts _buf (a char*) to a Chatpacket*
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Thu Mar 05, 2009 10:54 am    Post subject: Reply to topic Reply with quote

thats what i figured, but how do i pass char buf[256] to cp.text (buf[0]) without getting an incompatible types error?

im not so great at this if you cant tell icon_biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Mar 05, 2009 4:48 pm    Post subject: Reply to topic Reply with quote

cp->text (not cp.text) already occupies some of the same memory as the buffer. Assigning the buffer to it is not what you want, since the packet IS the buffer. If you're looking to better understand it, I'd suggest you brush up on pointers and arrays. Specifically the part where they talk about the similarities between the two.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Mar 05, 2009 5:00 pm    Post subject: Reply to topic Reply with quote

strcpy?
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sat Mar 07, 2009 6:14 pm    Post subject: Reply to topic Reply with quote

so i connected this to a command

Code: Show/Hide

local void aCmd(const char *params, const char *params2, Player *p, const Target *target)
{
    chat->SendMessage(p,"net cmd sending...");
   
    //cpp=&cp;
    char buf[256];
    struct ChatPacket *cpp=(struct ChatPacket*)buf;
    int size;
   //cpp->text=buf;
   size=snprintf(cpp->text,250,"%s","weeeeeeeeeeeeeeee")+6;
   cpp->pktype=S2C_CHAT;
   cpp->type=MSG_PUB;//79;//type;
   cpp->sound=0;//sound;
   cpp->pid=p->pid;//-1;//from ? from->pid : -1;
   
    //net->SendToSet(set,(byte*)cp,size,NET_RELIABLE);
    //void (*SendToOne)(Player *p, byte *data, int length, int flags);
    net->SendToOne(p,(byte*)cpp,size,NET_RELIABLE);
   
    chat->SendMessage(p,"net cmd sent");
   
    return;
}


compiled fine, but the zone crashes somewhere between 'sending' and 'sent'...
i have no idea why


after this works, ill figure out how to log a fake player into the biller.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sat Mar 07, 2009 6:54 pm    Post subject: Reply to topic Reply with quote

Run it in a debugger (gdb if you're running on linux). If you don't know how to use a debugger, then it's time to learn. You'll never regret any amount of time spent learning to use your debugger. It's easily your most powerful programming tool.

Oh, if you do try to log fake players into a biller, make sure you don't test it on SSC while you're developing. Try it on something like subbill or catid's biller.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sat Mar 07, 2009 7:47 pm    Post subject: Reply to topic Reply with quote

good thing i dont own a ssc connected zone then, right? =D

never used a debugger, and how would i debug a dll? :S
i installed one, but i have no idea how to use it...


unrelated: why does

chat->SendMessage(p,"| %-15c | %-80c |","string","string");

output wierd chars instead?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sat Mar 07, 2009 8:56 pm    Post subject: Reply to topic Reply with quote

Cheese wrote:
never used a debugger, and how would i debug a dll? :S

Debug the entire program. It'll treat the dll as part of the whole.


Cheese wrote:
unrelated: why does

chat->SendMessage(p,"| %-15c | %-80c |","string","string");

output wierd chars instead?


Because %c is for a char. You want %s for a string.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sun Mar 08, 2009 3:44 am    Post subject: Reply to topic Reply with quote

oh duh, thanks
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Tue Mar 10, 2009 11:31 pm    Post subject: Reply to topic Reply with quote

do i need a just in time debugger, or will any work?

know any good ones?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Mar 11, 2009 6:32 am    Post subject: Reply to topic Reply with quote

Use gdb on Linux. Dev-C++ and MSVC++ both have built in debuggers.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sat Mar 14, 2009 4:30 pm    Post subject: Reply to topic Reply with quote

i dont know assembly, and i dont want to go through the hell of trying to get the core to compile.

im about to give up on this
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sat Mar 14, 2009 4:53 pm    Post subject: Reply to topic Reply with quote

Compile the core. That should have been your very first step when working with asss programming.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sat Mar 14, 2009 5:45 pm    Post subject: Reply to topic Reply with quote

:(

also,
Unknown exit code: -1073741819.



and the core will not compile if you dont have python

error 2:

CreateProcess((null), uname -s, ...) failed.
\src\Makefile ../build/deps.mk: No such file or directory.
\src\Makefile CreateProcess((null), ../windeps/python.exe ../scripts/makedeps.py -I. -Iinclude -I../build -I../windeps -D_REENTRANT -D_GNU_SOURCE -I../windeps -I../windeps/mysqlinc -I../windeps/pythoninc */*.c -P $(BUILDDIR)/ -o ../build/deps.mk, ...) failed.
\src\Makefile The system cannot find the file specified.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS 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: 751 page(s) served in previous 5 minutes.

phpBB Created this page in 0.567318 seconds : 49 queries executed (87.9%): GZIP compression disabled