Hello,
I wondered which category is better to post, general or here but I post here.
I sometimes see the players who type rainbow colored text(chat). So I asked him how to do that, and told me he uses perl(or PHP? I don't remember exactly) script to do that.
I searched about it on Google and found something which might be related:
Nexuiz used to have a client command that gave you either 'pirate' or rainbow text. I don't know if the same function still exists in Xonotic or if the function uses the same passphrase. Sadly I'm not at liberty to divulge the Nexuiz phrases.
The basic command was
PHP Code:
cl_cmd FOO say Hello world
You could make a simple alias
PHP Code:
alias rainbow "cl_cmd FOO say $*" alias pirate "cl_cmd BAR say $*"
and then use
PHP Code:
rainbow Hello world pirate Look at me
You need to replace FOO and BAR with the correct codes.
>rocknroll237
Oh, you got the wrong PICTURE. I wanna write rainbow colored TEXT lol
>Spaceman
Unfortunately, I couldn't find command for what I wanna do instead of FOO and BAR.
But I could learn more about commands and coud find some useful links by your help. Thank you
>divVarent
Thank you again for giving useful example! I'll try it(and try to fix a little)!
I didn't know Xonotic(and Nexuiz) can load not only cfg file but PHP scripts.
And I want to ask you is there any website for reference of these commands(explain options like --exec, --key or other commands)?
I can see some of commands' explanation on OUNS website but not so many. I'd like to know more about these.
>PinkRobot
Tell me if you could write any useful code
(12-16-2011, 06:50 AM)PinkRobot Wrote: Hehe, kudos on posting that div. Mine does not work anymore by the way, but maybe I should write my own script for it.
All I need is your player ID. If you use a current Xonotic build, just send me your key_0-public-fp.txt file that's in your xonotic configuration directory (one directory upwards from config.cfg). If you have an older build, just give me a qconsole.log, it contains it too.
for($i = 0; $i < $n; ++$i) //loop n times
{
$c = mb_substr($s, $i, 1); //get a letter from index i
if($c == "^")
{
$c = "^^";
if(mb_substr($s, $i+1, 1) == "^")
++$i;
}
if($c != " ")
{
list($r, $g, $b) = array($j, $j, $j); //I added but idk this's correct.
$c = rgb_to_hexcolor($r, $g, $b) . $c;
}
++$p;
$s2 .= $c;
}
return $s2;
}
?>
I modified one of three aliases as follows:
Code:
alias spam "menu_cmd curl --exec --key 0 http://localserverIP/spam.php cmd \"$1\" text \"${2- q}\""
and input as a cfg file.
type spammessagecommand in console and RET,
and then,
Code:
]spam say
prompto is displayed
then I type "TEST" as a test and hit RET.
And I got
Code:
Unknown variable function -q
This PHP script seems to work from my eyes. I guess arguments are not passed or received well in alias command.
hmm, but I tried http://rm.sudo.rm-f.org/~xonotic/spam/spam.php without my ID, of course I couldn't get colored text but error message output as "say" command.
Currently my environment doesn't output even as "say" command(I mean, displayed error message only in console)...
I have no idea now...
If possible, I could do this thing on my local server or local machine.
Could you tell me a little more advices?
I first was like: "OMFG I WANT THAT TOO!" But now it seams you have to code a lot of shit I have the slight feeling I'm never gonna talk in rainbow colors
If I wanted this, I'd prefer doing an engine mod. It's contained, doesn't depend on some external webserver and doesn't send your potentially private conversations to some remote location.
But that's just paranoid ol' me. (then there's always the irc spybot anyway)
And I don't need it. Or maybe I should do it, just for fun? hmm
(12-19-2011, 12:58 AM)nilyt Wrote: If I wanted this, I'd prefer doing an engine mod. It's contained, doesn't depend on some external webserver and doesn't send your potentially private conversations to some remote location.
But that's just paranoid ol' me. (then there's always the irc spybot anyway)
And I don't need it. Or maybe I should do it, just for fun? hmm
Chatting is by definition sending your potentially private conversations to some remote location, AFAIK
12-21-2011, 11:41 PM (This post was last modified: 12-21-2011, 11:43 PM by Lento.)
(12-21-2011, 03:40 AM)PinkRobot Wrote: Well done Lento
Thanks!
and I also could do like this:
xonotic20111222132034-00.jpg (Size: 46.71 KB / Downloads: 289)
僕と契約してXonoticプレイヤーになってよ!
(send specified command and get value from the server.)
Currently Xonotic doesn't support typing in Japanese but it can display
That's the same as querying meh.cgi?foo=abc%20def&bar=ghi%20jkl.
So you want alias spam "menu_cmd curl --exec --key 0 http://example.org/test.php myvariable \"$1\""
Hehe, I'd really love to see Lento helping you on this now. Now that would be awesome.
I personally don't have a clue about PHP, but from reading this thread I see that div's function needs to be called by your code and it should access $_POST["myvariable"]. Actually maybe the syntax that I showed you above sends $1 as $_POST["myvariable"] data rather than GET, and div's posts suggest that it indeed works that way.
Anyway, it should output a string that consists of "say " followed by whatever you want to say, I'm guessing. The menu_cmd executes as console command whatever the output of the web request is.