Poll

Do you know how to script?

Yes
Kinda
A Little
Not Really
No

Author Topic:  server message script help   (Read 2734 times)

Ok I have only one question right now:

How do I make a script that reacts to a user chating without using the server command script group?

EX Gamefandan: Gamefandanbot how are you?
Gamefandanbot: Fine and you?

Help would be appriciated thanks.
« Last Edit: February 20, 2009, 03:57:53 AM by gamefandan »

Look in other scripts, you are bound to find something. Don't be so lazy.

I tried and I couldn't find anything, I'm still looking though.

1.In the console type: trace(1);
2.Close the console and say something in chat.
3.Type trace(0); in the console to stop trace.
4.Find the function your looking for and figure out the attributes.
5.Package and make sure to call the parent.

If you don't understand this, you need to look at basic scripts and try to figure out how they work, and mess around with them to get an understanding of how coding works.

I think I understand but what does trace(1); do? Good Lord! no thnx idk wtf I'm supposed to be looking for.
« Last Edit: February 11, 2009, 10:51:14 PM by gamefandan »

Open blockland, do what I told you, then close blockland, and go into the console.log file, and copy everything that was echo'd during the trace, and I'll help you through it a bit, though I'm not going to help you with everything, since you need to learn on your own and be able to code without going strait to the help section every time you don't know something needed for your code.

ummmmmm this?
Code: [Select]
Entering GlobalChat(1)
   Entering newMessageHud::open(newMessageHud, SAY)
      Entering [RTBC_IRCClient]Canvas::pushDialog(Canvas, newMessageHud)
         Entering [CanvasCursor]GuiCanvas::pushDialog(Canvas, newMessageHud)
            Entering newMessageHud::onWake(5255)
            Leaving newMessageHud::onWake() - return 796 40
            Entering [CanvasCursor]GuiCanvas::checkCursor(Canvas)
               Entering [CanvasCursor]GuiCanvas::checkTabFocus(Canvas)
               Leaving [CanvasCursor]GuiCanvas::checkTabFocus() - return
            Leaving [CanvasCursor]GuiCanvas::checkCursor() - return
         Leaving [CanvasCursor]GuiCanvas::pushDialog() - return
      Leaving [RTBC_IRCClient]Canvas::pushDialog() - return
      Entering newMessageHud::updatePosition(newMessageHud)
      Leaving newMessageHud::updatePosition() - return
   Leaving newMessageHud::open() - return
Leaving GlobalChat() - return

or maybe.....this?
Code: [Select]
Entering messageClient(8026, 42, 67, 8026)
      Entering [TG_NewRewards]commandToClient(8026, 97, 42, 67, 8026, , , , , , , , , )
      Leaving [TG_NewRewards]commandToClient() - return
   Leaving messageClient() - return
Leaving serverCmdStartTalking() - return
Entering clientCmdServerMessage(42 MsgStartTalking, 67 , 8026)
   Entering defaultMessageCallback(42 MsgStartTalking, 67 , 8026, , , , , , , , , )
      Entering onServerMessage()
      Leaving onServerMessage() - return
   Leaving defaultMessageCallback() - return
   Entering handleStartTalking(42 MsgStartTalking, 67 , 8026)
      Entering WhoTalk_addID(8026)
         Entering WhoTalk_Init()
         Leaving WhoTalk_Init() - return 11571
         Entering WhoTalkSO::addID(11571, 8026)
            Entering WhoTalkSO::HasID(11571, 8026)
            Leaving WhoTalkSO::HasID() - return 0
            Entering WhoTalkSO::Display(11571)
            Leaving WhoTalkSO::Display() - return
         Leaving WhoTalkSO::addID() - return
      Leaving WhoTalk_addID() - return
   Leaving handleStartTalking() - return
Leaving clientCmdServerMessage() - return

oooorrrrrr.... this?
Code: [Select]
Entering [eventsPlus]serverCmdMessageSent(8026, hello)
   Entering serverCmdMessageSent(8026, hello)
      Entering chatMessageAll(8026, 133, [N], Gamefandan, TRPA, hello)
         Entering spamAlert(8026)
         Leaving spamAlert() - return 0
         Entering chatMessageClient(8026, 8026, , , 133, [N], Gamefandan, TRPA, hello, , , , , , )
            Entering [TG_NewRewards]commandToClient(8026, 134, 8026, , , 133, [N], Gamefandan, TRPA, hello, , , , )
            Leaving [TG_NewRewards]commandToClient() - return
         Leaving chatMessageClient() - return
      Leaving chatMessageAll() - return
      Gamefandan: hello
   Leaving serverCmdMessageSent() - return
Leaving [eventsPlus]serverCmdMessageSent() - return
Entering serverCmdStopTalking(8026)
   Entering messageClient(8026, 43, 67, 8026)
      Entering [TG_NewRewards]commandToClient(8026, 97, 43, 67, 8026, , , , , , , , , )
      Leaving [TG_NewRewards]commandToClient() - return
   Leaving messageClient() - return
Leaving serverCmdStopTalking() - return
Entering clientCmdChatMessage(8026, , , 133 [N]Gamefandan TRPA: hello, [N], Gamefandan, TRPA, hello)
   Entering onChatMessage( [N]Gamefandan TRPA: hello, , )
      Entering newChatHud_AddLine( [N]Gamefandan TRPA: hello)
         Entering NewChatSO::addLine(8170, [N]Gamefandan TRPA: hello)
            Entering NewChatSO::displayLatest(8170)
               Entering newMessageHud::updatePosition(newMessageHud)
               Leaving newMessageHud::updatePosition() - return
               Entering newChatHud_UpdateScrollDownIndicator()
                  Entering newChatHud_UpdateIndicatorPosition()
                  Leaving newChatHud_UpdateIndicatorPosition() - return
               Leaving newChatHud_UpdateScrollDownIndicator() - return
            Leaving NewChatSO::displayLatest() - return
         Leaving NewChatSO::addLine() - return
         Entering newMessageHud::updatePosition(newMessageHud)
         Leaving newMessageHud::updatePosition() - return
         Entering newChatHud_UpdateScrollDownIndicator()
            Entering newChatHud_UpdateIndicatorPosition()
            Leaving newChatHud_UpdateIndicatorPosition() - return
         Leaving newChatHud_UpdateScrollDownIndicator() - return
      Leaving newChatHud_AddLine() - return
   Leaving onChatMessage() - return
Leaving clientCmdChatMessage() - return
Entering clientCmdServerMessage(43 MsgStopTalking, 67 , 8026)
   Entering defaultMessageCallback(43 MsgStopTalking, 67 , 8026, , , , , , , , , )
      Entering onServerMessage()
      Leaving onServerMessage() - return
   Leaving defaultMessageCallback() - return
   Entering handleStopTalking(43 MsgStopTalking, 67 , 8026)
      Entering WhoTalk_removeID(8026)
         Entering WhoTalkSO::removeID(11571, 8026)
            Entering WhoTalkSO::Display(11571)
            Leaving WhoTalkSO::Display() - return
         Leaving WhoTalkSO::removeID() - return
      Leaving WhoTalk_removeID() - return
   Leaving handleStopTalking() - return
Leaving clientCmdServerMessage() - return
Entering [SpaceTick]SpaceTick()
   Entering [SpaceTick]SimSet::tick(TargetCtrl)
      Entering targetCtrlTick(TargetCtrl)
      Leaving targetCtrlTick() - return 162092
   Leaving [SpaceTick]SimSet::tick() - return 162092
Leaving [SpaceTick]SpaceTick() - return 2133
Entering [SpaceTick]SpaceTick()
   Entering [SpaceTick]SimSet::tick(TargetCtrl)
      Entering targetCtrlTick(TargetCtrl)
      Leaving targetCtrlTick() - return 162154
   Leaving [SpaceTick]SimSet::tick() - return 162154
Leaving [SpaceTick]SpaceTick() - return 2134
Entering [SpaceTick]SpaceTick()
   Entering [SpaceTick]SimSet::tick(TargetCtrl)
      Entering targetCtrlTick(TargetCtrl)
      Leaving targetCtrlTick() - return 162201
   Leaving [SpaceTick]SimSet::tick() - return 162201
Leaving [SpaceTick]SpaceTick() - return 2135
Entering [SpaceTick]SpaceTick()
   Entering [SpaceTick]SimSet::tick(TargetCtrl)
      Entering targetCtrlTick(TargetCtrl)
      Leaving targetCtrlTick() - return 162248



Code: [Select]
Entering clientCmdChatMessage(8026, , , 133 [N]Gamefandan TRPA: hello, [N], Gamefandan, TRPA, hello) //This is the first line, this is when the server is telling the client that someone spoke.  (this is probably what you want to package, just make sure to call the parent, or you'll break your chat)
   Entering onChatMessage( [N]Gamefandan TRPA: hello, , ) //This is a function that was called by the first function.
      Entering newChatHud_AddLine( [N]Gamefandan TRPA: hello) //This is another function, the function names should be speaking for themselfs.  This is telling the chat hud in your game to add a new line to add a new line.
         Entering NewChatSO::addLine(8170, [N]Gamefandan TRPA: hello) //Each one of these lines is when the function is being entered within the processing of the code.  What comes after the function, as is in the parenthesis are what is entered into the function.  Note that datablocks and other named things are reverted into their number form when being shown here, so you may need to look the number up.
            Entering NewChatSO::displayLatest(8170)
               Entering newMessageHud::updatePosition(newMessageHud)
               Leaving newMessageHud::updatePosition() - return //This is the first leaving line.  The function is being left, and the program flow is going back into the function that called the function that is ending.  There is nothing that is returned in this code, but if there was something, it would be shown after "- return".
               Entering newChatHud_UpdateScrollDownIndicator()
                  Entering newChatHud_UpdateIndicatorPosition()
                  Leaving newChatHud_UpdateIndicatorPosition() - return
               Leaving newChatHud_UpdateScrollDownIndicator() - return
            Leaving NewChatSO::displayLatest() - return
         Leaving NewChatSO::addLine() - return
         Entering newMessageHud::updatePosition(newMessageHud)
         Leaving newMessageHud::updatePosition() - return
         Entering newChatHud_UpdateScrollDownIndicator()
            Entering newChatHud_UpdateIndicatorPosition()
            Leaving newChatHud_UpdateIndicatorPosition() - return
         Leaving newChatHud_UpdateScrollDownIndicator() - return
      Leaving newChatHud_AddLine() - return
   Leaving onChatMessage() - return
Leaving clientCmdChatMessage() - return
That help a bit?

Also, I'm assuming you want to be client sided, you'll want to look at some other stuff it your going for server sided.
« Last Edit: February 11, 2009, 11:20:30 PM by laremere »

so do i just copy and paste that or what?

No, that is a visual representation of what is going on in the code as far as functions being called.

If you look here: Entering clientCmdChatMessage(8026, , , 133 [N]Gamefandan TRPA: hello, [N], Gamefandan, TRPA, hello)

We see what function we need to use, but in order to use this function, we need to put it into a package.  You can find a tutorial on packaging functions here: http://forum.blockland.us/index.php?topic=21811.0 
I think you are smart enough to figure out exactly what attribute of clientCmdChatMessage does what.



Code: [Select]
Package newpackage
{
Function clientCmdChatMessagehi(%client)
{
Parent::messageall('','hey there');
}
};
Activatepackage(newpackage);

Like that?

No.


Are you wanting server sided code or client sided?

I want it client sided yeah.


This is why they invented LOLscript