is it possible to know clientside

Decepti|<on
08-14-2004, 06:06 PM
if someone has played a voice file ~wsound in the chatmenu?

Amadeus
08-14-2004, 06:14 PM
If the part after ~ gets caught by onClientMessage(). Dunno actually.

DaJackal
08-14-2004, 07:06 PM
yes. it is part of %msg in onclientmessage. it can be parsed. i filter out things like death being done too many times or the wind sounds

GreyHound
08-14-2004, 10:56 PM
Answer to your question:

add this to your onclientmssage(%client,%m sg) function probably located in events.cs or support.cs


if(String::findSubStr(%ms g, "~") != -1 ){
//call to a function that defindes what to do when "~" has been found
//this could be;
remoteBP(2048, "The Client with the ID: "@%client@" just triggered a Sound", 5);
}


Extra fancy drunk information:


function onClientMessage(%client, %msg)
{
if(String::findSubStr(%ms g, "~") != -1 )
remotebp(2048, %Client@" has sent a sound trigger", 4);

}



Basicly the WHOLE tribes scripting depends on this function "onClientMessage(%client, %msg)" nevertheless the server doesnīt trigger direct function as
remoteflagtrakupdate(%var 1, %var2, etc...)
(which does the flag status changes on fstat (mayb even other) servers)

which isnīt necassary for any scripts at all. This direct "client notify" is just a simple way to make clientside scripts more easy as the actual infomation a client needs (like: who died, who dropped the flag, who dropped, who joined, etc.) is done by the server already and send to the client in the essential syntax. THIS IS JUST EXTRA FANCY SHIT YOU DONT HAVE TO NOTICE AT ALL. (guys that know more know how i mean this)



Generally Tribes script work like this:

1.A message enters the onClientMessage(%client, %msg) function on your engine. This happends for Text Messages by any Client or the server itself (likeText-, Death-, Join-, Drop-, vote-, &FlagMessages and so on.)
This function is absolutly the most important function in any script pack you can find.

2. In this Function (onClientMessage) you have defined conditions that definde certain events on the certain (most up-top-date) message sent to you
(this requires the needed event functions of course)

-this could be

if(String::findSubStr(%ms g, "flag") != -1 )
{
Event::Trigger(eventFlagM essage, %client, %msg);
};

by that you would have attached all messages entering your engine that contain the string "flag" to the event "eventFlagMessage" passing 2 variables (%client and %msg)
with this inf you can proceed and furthermore attach any function to this event which actually means that the attached function is execute when a message containing the string "flag" occurs.

The Event triggering is just the very very very (reuse reply 1000 times to get itīs actual value) best way to make the happening of any happening (conditions in onClientmessage) beeing accessable from any point of your scripts by attaching some to be executed function to those conditions.
i.e: "Flag" has been said ---> output message "Flag was said!"

3. now you have a possibility to interfere in all messages that contain the text "flag" and furthermore examine this message and so get to a certain conclusion. (flag has been captured, flag was dropped, returned or whatever)



why i wrote that much??!?!??!
1.me si drunk
2.thought itīs needed to be said
3. wohoooo
4.this function should be handled very careful, you could really really, screw up everything your tribes is like




So as final output:

if you already use a scriptpack you should already have some kind of onclientmessage() that looks like this (very very stripped and basic)

function onclientmessage(%client, %msg)
{
Event::Trigger(eventClien tMessage, %client, %msg);
}

which means you should be able to access this happening by using code like (in any other not directly connected but executed script)


Event::Attach(eventClient Message, Clientmessage::recieved);

function Clientmessage::recieved(% client, %msg)
{
//findout whatīs in %msg and define contitions depending on its ingredients
}









omg, i m getting sober again but donīt really think i should delete this stuff above, mayb somebody likes to read it.

Decepti|<on
08-15-2004, 11:36 AM
that was the best omg im drunk post i've ever read

Amadeus
08-15-2004, 01:08 PM
that was the best omg im drunk post i've ever read
I agree

GreyHound
08-15-2004, 01:21 PM
rofl omg

(back in life)

WorstAim
08-15-2004, 03:01 PM
Greyhound has it right. If you want the name instead of the clientId, just do this:


if(String::findSubStr(%ms g, "~") != -1 ){
//call to a function that defindes what to do when "~" has been found
//this could be;
remoteBP(2048, client::getName(%client)@" just triggered a Sound", 5);
}


Extra fancy drunk information:


function onClientMessage(%client, %msg)
{
if(String::findSubStr(%ms g, "~") != -1 )
remotebp(2048, client::getName(%client)@" has sent a sound trigger", 4);

}