Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-29-2011, 05:38 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Exclamation Rc chat system. HELP!

Hi i am trying to make a script where normal players can chat on RC by starting there message with //

PHP Code:
//#CLIENTSIDE 

function onPlayerChats() {
    if (
player.chat.starts("//")) {
        
SendToRc(temp.player.chat);
    }

i think its the temp.player.chat bit but can somebody help please?

thanks in advance!
__________________

Last edited by Emera; 04-29-2011 at 08:01 PM..
Reply With Quote
  #2  
Old 04-29-2011, 07:29 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
I thought SendToRc was serverside? Also have you tried player.chat instead of temp.player.chat? And It's been years since I used starts(""); .. have you tries "// test" AND "//test" ?
Reply With Quote
  #3  
Old 04-29-2011, 07:31 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I have used player.chat and i get "unknown command" on RC so i know im doing something. Also, how do i issue sendToRC serverside then?
__________________
Reply With Quote
  #4  
Old 04-29-2011, 07:33 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Ah there its fixed thanks guys.
__________________
Reply With Quote
  #5  
Old 04-29-2011, 07:35 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
I am just asumming you removed the "//#CLIENTSIDE" ? or did you impliment

PHP Code:
triggerServer"gui"this.name"action" ); 
Reply With Quote
  #6  
Old 04-29-2011, 07:51 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Ok know how can i get other RC's to see the chat. I can only see mine and not other players. And yes, they all have the weapon.
__________________
Reply With Quote
  #7  
Old 04-29-2011, 07:52 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Im new to scripting and i dont quite know what you man by the trigger action.
__________________
Reply With Quote
  #8  
Old 04-29-2011, 07:56 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
To my knowledge all rc's should be seeing the chat.. if you mean all players seeing the rc chat? or all players that do not have an rc seeing the chat you are sending to rc?
Reply With Quote
  #9  
Old 04-29-2011, 07:57 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
The staff on rc. I let a player use the weapon and i couldnt see his chat on RC. I used it and i could see mine.
__________________
Reply With Quote
  #10  
Old 04-29-2011, 08:00 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Hmm.. I would have to login to testbed and play around with it myself then.
Reply With Quote
  #11  
Old 04-29-2011, 08:01 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Sure go ahead.
__________________
Reply With Quote
  #12  
Old 04-29-2011, 08:08 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Emera View Post
Hi i am trying to make a script where normal players can chat on RC by starting there message with //

PHP Code:
//#CLIENTSIDE 

function onPlayerChats() {
    if (
player.chat.starts("//")) {
        
SendToRc(temp.player.chat);
    }

i think its the temp.player.chat bit but can somebody help please?

thanks in advance!
I know you said you fixed it, but just for future reference, you can fix this by removing the "temp." prefix to inside of "sendtorc" and also by changing it to: player.chat.substring(2).

Quote:
Originally Posted by Emera View Post
Ok know how can i get other RC's to see the chat. I can only see mine and not other players. And yes, they all have the weapon.
You have to be logged into client-rc for your chat to display to other RCs in the RC chat. If you are logged into client-rc it should work fine.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #13  
Old 04-29-2011, 08:10 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Having issues connecting to graal right now.. Either its taking forever or my connection isnt working properly.

However, you might want to take into consideration that doing a script like this risks flooding the rc. Players would be able to make RC useless for staff by spamming it non-stop.

Alternatively, to fix the non-displayed message problem. You could give the weapon to all the players and use something similar to this.


This would tell all players to trigger the action to send message to rc, this would be under "//#CLIENTSIDE"
PHP Code:
for ( temp.allplayers ) {
  
with (temp.p) {
    
triggerServer"gui"this.name"sendtorc"message );
  }

This would be above "//#CLIENTSIDE", it would receive the trigger.
PHP Code:
function ActionServerSide() {
  if ( 
params[0] == "senttorc" ) {
    
SendToRc(params[1]);
  }

You might need to play around with this but that is what I would probably do.

When sending an action to the server param[#] refers to each param after "this.name" in the command.

Make sure that the actionserverside is ABOVE any part of the script that is //#CLIENTSIDE.. and the first code I mentioned..


EDIT:
Damn Tig, you beat me to the substring part.. To explain why Tig posted that tho, substring(#) means to take everything from the second character all the wat to the end.. This would eliminate "//" at the beginning of the message.
Reply With Quote
  #14  
Old 04-29-2011, 08:14 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Ah thanks tig and thanks scriptless. I got it workin mighty fine now.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.