[Xaseco] Nouse Message V2.0 NEW

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

[Xaseco] Nouse Message V2.0 NEW

Post by nouseforname » 02 Nov 2009 23:01

  • Nouse Message V2.0

    Updated:
    - new functions
    - "infinite" additional messages
    - random mode
    - ordered mode
    - enable/disable toggle (show/hide with F7)
    - new chat commands

    all still done via chat commands on the fly


    read the manual at top of plugin file!!!!


    the third plugin this week. it's quite similiar to the link plugin.

    Xaseco plugin to display a ingame manialink with message text.
    everything is configureable via the config file, all values in config are initial values.
    Everything like text, interval, position, size and style can be changed on the fly via admin chat commands. the chatcommand is made of 3 parts.

    /[initial] [param] [value]

    Command list:
    /msgmod... for the initial command, have to be in front.
    ....text "text" will add a new message to the existing ones
    ....text(1,2,3....) to display the particular message
    ....text(1,2,3....) 'text' to edit the particular message
    ....text(1,2,3....) '""' to delete the particular message
    ....textcount to display the amount of messages stored
    ....interval "seconds" for the interval, 0 for static text.
    ....random "0/1" for ordered or random messages
    ....toggle "0/1" to enable/disable the toggle function (F7) show/hide
    ....mpos "x y" for the main position (n.nn, n = numbers)
    ....msize "x y" for the window size of window (n.nn, n = numbers)
    ....tsize "n" (1 - 10)
    ....style "Mania Style" for the window style
    ....substyle "Mania substyle" for the substyle

    if no param given, a little help text will be displayed.

    all new values given by chat commands are saved in config file as new initial values.

    click on it to hide, it's also combined with the widget display/hide commands.

    Download here:
    http://tmf.game-host.org/pages/tools.php


    let me know if you like it.


    ps: don't forget to chmod the config file in linux systems
Last edited by nouseforname on 16 Jun 2010 20:12, edited 1 time in total.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

nihilist
pedestrian
pedestrian
Posts: 6
Joined: 03 Nov 2009 09:59
Owned TM-games: TMU

Re: [Xaseco] Nouse Message V1.0

Post by nihilist » 03 Nov 2009 10:05

Hehe, nice one :thumbsup:

Is it possible to start multiple instances of this plugin?

I mean copy/rename and adding the new name to plugins.xml won`t do, right?

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Message V1.0

Post by nouseforname » 03 Nov 2009 10:22

nihilist wrote:Hehe, nice one :thumbsup:

Is it possible to start multiple instances of this plugin?

I mean copy/rename and adding the new name to plugins.xml won`t do, right?
no not possible, you would have to rename all functions.

why you would like to have multiple? need more random text?
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

nihilist
pedestrian
pedestrian
Posts: 6
Joined: 03 Nov 2009 09:59
Owned TM-games: TMU

Re: [Xaseco] Nouse Message V1.0

Post by nihilist » 03 Nov 2009 10:30

i just thought it would be nice to have one on the top, displaying servername or some motto of the day, and another one at the bottom showing something else...

So i don`t really need it, it was just a thought about what you could do with it :D

biloudeprovence
road tourist
road tourist
Posts: 82
Joined: 24 Jul 2008 09:49
Owned TM-games: TMU

Re: [Xaseco] Nouse Message V1.0

Post by biloudeprovence » 01 Dec 2009 09:16

Hi nouseforname
Nice plugin works fine with xaseco 1.10
Just a question
It is possible to additionnel more message ?
Actually
<infotext>$03fsecond text</infotext>
<infotext1>$f80first text</infotext1>
<infotext2>$03fsecond text</infotext2>
<infotext3>$0f0third text</infotext3>
thx

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Message V1.0

Post by nouseforname » 01 Dec 2009 09:21

biloudeprovence wrote:Hi nouseforname
Nice plugin works fine with xaseco 1.10
Just a question
It is possible to additionnel more message ?
Actually
<infotext>$03fsecond text</infotext>
<infotext1>$f80first text</infotext1>
<infotext2>$03fsecond text</infotext2>
<infotext3>$0f0third text</infotext3>
thx
i was waiting for this question :)

no it's not possible at the moment. maybe in a future release.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

biloudeprovence
road tourist
road tourist
Posts: 82
Joined: 24 Jul 2008 09:49
Owned TM-games: TMU

Re: [Xaseco] Nouse Message V1.0

Post by biloudeprovence » 01 Dec 2009 11:37

Hi nouseforname
ok thx
I hope soon :gobananas:

Amisxp
road tourist
road tourist
Posts: 81
Joined: 26 Dec 2008 10:28
Owned TM-games: TMUF
Location: Slovenia, Maribor

Re: [Xaseco] Nouse Message V1.0

Post by Amisxp » 30 May 2010 16:39

hey

is it possible to remove this function with hiding (if u click on it, it hides everything)

tia :pil

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Message V1.0

Post by nouseforname » 30 May 2010 21:58

Amisxp wrote:hey

is it possible to remove this function with hiding (if u click on it, it hides everything)

tia :pil
it would be possible, but i made it the way it is.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

Amisxp
road tourist
road tourist
Posts: 81
Joined: 26 Dec 2008 10:28
Owned TM-games: TMUF
Location: Slovenia, Maribor

Re: [Xaseco] Nouse Message V1.0

Post by Amisxp » 31 May 2010 22:46

nouseforname wrote:
Amisxp wrote:hey

is it possible to remove this function with hiding (if u click on it, it hides everything)

tia :pil
it would be possible, but i made it the way it is.
ahm okey ._.

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Message V1.0

Post by nouseforname » 31 May 2010 22:49

i will check it when i have time, also for the other request of adding more messages. :)

so you dont wnat to hide or just dont want hide it together with the widgets?
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

Amisxp
road tourist
road tourist
Posts: 81
Joined: 26 Dec 2008 10:28
Owned TM-games: TMUF
Location: Slovenia, Maribor

Re: [Xaseco] Nouse Message V1.0

Post by Amisxp » 31 May 2010 23:13

nouseforname wrote:i will check it when i have time, also for the other request of adding more messages. :)

so you dont wnat to hide or just dont want hide it together with the widgets?
that was fast ^^
take your time with anything dude :d

i prefer if it would be unclickable. e.g. widget would only hide if u would press F7

i hope u know what i mean :p

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Message V1.0

Post by nouseforname » 01 Jun 2010 02:14

for a fixed windows without any hiding function you just need to delete some functions.

this should work but i didnt test it:

Code: Select all

<?php

/* ----------------------------------------------------------------------------------
 * 
 * Xaseco plugin to display a ingame manialink with message text.
 * everything is configureable via the config file, all values in config are initial values.
 * Everything like text, interval, position, size and style can be changed onthefly 
 * via admin chat commands. the chatcommand is made of 3 parts.
 * 
 * /[initial] [param] [value]
 * 
 * Command list:
 * /msgmod... for the initial command, have to be in front.
 * ....text "text" for the static and initial text
 * ....text(1,2,3) "text" for the 3 different random texts
 * ....interval "seconds" for the random interval, 0 for random off.
 * ....mpos "x y" for the main position (n.nn, n = numbers)
 * ....msize "x y" for the window size of window (n.nn, n = numbers)
 * ....tsize "n" (1 - 10) 
 * ....style "Mania Style" for the window style
 * ....substyle "Mania substyle" for the substyle
 *
 * find styles at http://fish.stabb.de/styles/
 *
 * if no param given, a little help text will be displayed.
 *
 * all new values given by chat commands are saved in config. 
 *
 * ----------------------------------------------------------------------------------
 *
 * Author: 			nouseforname @ http://www.tm-forum.com
 * Home: 			tmf.game-host.org
 * Date: 			31.10.2009
 * Version:			1.0
 * Dependencies: 	none
 *
 * ----------------------------------------------------------------------------------
 *
 * LICENSE: This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * ----------------------------------------------------------------------------------
 */

Aseco::registerEvent('onSync', 'init_message_manialinks');
Aseco::registerEvent('onStartup', 'message_loadSettings');
Aseco::registerEvent('onNewChallenge', 'message_on');
Aseco::registerEvent('onPlayerConnect', 'message_on');
Aseco::registerEvent('onEndRace', 'message_off');
Aseco::registerEvent('onEverySecond', 'msg_random_message');

Aseco::addChatCommand('msgmod', 'Change Message window apperance.');

global $msginfotext, $msginfotext1, $msginfotext2, $msginfotext3, $msgstyle, $msgsubstyle;
global $msgmainposition, $msgmsize, $msgtextsize, $msginterval;
global $xml_message_on, $xml_message_off;

// load xml configs
function message_loadSettings(){
	global $msginfotext, $msginfotext1, $msginfotext2, $msginfotext3, $msgstyle, $msgsubstyle;
	global $msgmainposition, $msgmsize, $msgtextsize, $msginterval;

	$file = file_get_contents('nouse_message_config.xml');
	$xml = simplexml_load_string($file);
	$msginfotext = strval($xml->infotext);
	$msginfotext1 = strval($xml->infotext1);
	$msginfotext2 = strval($xml->infotext2);
	$msginfotext3 = strval($xml->infotext3);
	$msginterval = intval($xml->msginterval);
	$msgmainposition = strval($xml->mainposition);
	$msgmsize = strval($xml->size);
	$msgtextsize = strval($xml->textsize);
	$msgstyle = strval($xml->style);
	$msgsubstyle = strval($xml->substyle);
}

function message_savesettings($param, $value) {
	global $msginfotext, $msginfotext1, $msginfotext2, $msginfotext3, $msgstyle, $msgsubstyle;
	global $msgmainposition, $msgmsize, $msgtextsize, $msginterval;
	
	$file = 'nouse_message_config.xml';
	
	$config = '<?xml version="1.0" encoding="utf-8" ?>' . CRLF;
	$config .= '<settings>' . CRLF;
	$config .= CRLF;
	$config .= "\t<!-- config file for plugin.nouse.info.php -->" . CRLF;
	$config .= "\t<!-- all values here are initial values and can be changed via admin command -->" . CRLF;
	$config .= "\t<infotext>".$msginfotext."</infotext>" . CRLF;
	$config .= "\t<infotext1>".$msginfotext1."</infotext1>" . CRLF;
	$config .= "\t<infotext2>".$msginfotext2."</infotext2>" . CRLF;
	$config .= "\t<infotext3>".$msginfotext3."</infotext3>" . CRLF;
	$config .= CRLF;
	$config .= "\t<msginterval>".$msginterval."</msginterval> <!-- interval in seconds, set tto \"0\" for random off -->" . CRLF;
	$config .= CRLF;
	$config .= "\t<mainposition>".$msgmainposition."</mainposition>" . CRLF;
	$config .= "\t<size>".$msgmsize."</size>" . CRLF;
	$config .= "\t<textsize>".$msgtextsize."</textsize>" . CRLF;
	$config .= CRLF;
	$config .= "\t<style>".$msgstyle."</style>" . CRLF;
	$config .= "\t<substyle>".$msgsubstyle."</substyle>" . CRLF;
	$config .= CRLF;
	$config .= '</settings>';
	
	//** write out XML file **//
	if (!@file_put_contents($file, $config)) {
		trigger_error('Could not write info config file ' . $file . ' !', E_USER_WARNING);
	}
}

function msg_random_message($aseco) {
	global $msginfotext, $msginfotext1, $msginfotext2, $msginfotext3;
	global $msgreset, $msginterval;
	$msgreset++;
	if ($msginterval) {
		if ($msgreset == $msginterval && $msginfotext != $msginfotext2 && $msginfotext != $msginfotext3) {
			$msginfotext = $msginfotext2;
			init_message_manialinks($aseco, $msginfotext);
			message_on($aseco);
		} elseif ($msgreset == $msginterval && $msginfotext != $msginfotext1 && $msginfotext != $msginfotext3) {
			$msginfotext = $msginfotext3;
			init_message_manialinks($aseco, $msginfotext);
			message_on($aseco);
		} elseif ($msgreset == $msginterval && $msginfotext != $msginfotext1 && $msginfotext != $msginfotext2) {
			$msginfotext = $msginfotext1;
			init_message_manialinks($aseco, $msginfotext);
			message_on($aseco);
		}
	}
}

// admin chat commands to  mod message window
function chat_msgmod($aseco, $command) {
	global $msginfotext, $msgstyle, $msgsubstyle, $msginterval;
	global $msginfotext1, $msginfotext2, $msginfotext3;
	global $msgmainposition, $msgmsize, $msgtextsize;
	$admin = $command['author'];
	$login = $admin->login;
	$nick = $admin->nickname;
	//$command['params'] = strtolower($command['params']);
	$com = explode(' ', $command['params'], 2);
	
	// check if chat command was allowed for a masteradmin/admin/operator
	if ($aseco->isMasterAdmin($admin) || $aseco->isAdmin($admin)) {
		// check for unlocked password (or unlock command)
		if ($aseco->settings['lock_password'] == '' || $admin->unlocked) {
			if ($com[0]) {
				switch ($com[0]) {
					case 'text':
						$msginfotext = $com[1];
						init_message_manialinks($aseco, $msginfotext);
						message_savesettings('infotext', $msginfotext);
					break;
					case 'text1':
						$msginfotext1 = $com[1];
						init_message_manialinks($aseco, $msginfotext1);
						message_savesettings('infotext1', $msginfotext1);
					break;
					case 'text2':
						$msginfotext2 = $com[1];
						init_message_manialinks($aseco, $msginfotext2);
						message_savesettings('infotext2', $msginfotext2);
					break;
					case 'text3':
						$msginfotext3 = $com[1];
						init_message_manialinks($aseco, $msginfotext3);
						message_savesettings('infotext3', $msginfotext3);
					break;
					case 'interval':
						$msginterval = $com[1];
						init_message_manialinks($aseco, $msginterval);
						message_savesettings('msginterval', $msginterval);
					break;
					case 'mpos':
						$msgmainposition = $com[1];
						init_message_manialinks($aseco, $msgmainposition);
						message_savesettings('mainposition', $msgmainposition);
					break;
					case 'msize':
						$msgmsize = $com[1];
						init_message_manialinks($aseco, $msgmsize);
						message_savesettings('size', $msgmsize);
					break;
					case 'tsize':
						$msgtextsize = $com[1];
						init_message_manialinks($aseco, $msgtextsize);
						message_savesettings('textsize', $msgtextsize);
					break;
					case 'style':
						$msgstyle = $com[1];
						init_message_manialinks($aseco, $msgstyle);
						message_savesettings('msgstyle', $msgstyle);
					break;
					case 'substyle':
						$msgsubstyle = $com[1];
						init_message_manialinks($aseco, $msgsubstyle);
						message_savesettings('msgsubstyle', $msgsubstyle);
					break;
					default:
					break;	
				}
				message_on($aseco);
			} else {
				$message = '{#server}> {#error}Missing parameter. Usage like $fff"/msgmod param value" $f80param: $i$ff0"msgtext(n)=text - msginterval=sec - msgpos=x y - msgmsize=x y - msgtsize=x y - msgstyle=STYLE - msgsubstyle=SUBSTYLE {#error}!';
				$aseco->client->query('ChatSendToLogin', $aseco->formatColors($message), $login);
			}
		} else {
			// write warning in console
			$aseco->console($login . ' tried to use admin chat command (not unlocked!): "/msgmod"');
			// show chat message
			$aseco->client->query('ChatSendToLogin', $aseco->formatColors('{#error}You don\'t have the required admin rights to do that, unlock first!'), $login);
		}
	} else {
		// write warning in console
		$aseco->console($login . ' tried to use admin chat command (no permission!): "/msgmod" ');
		// show chat message
		$aseco->client->query('ChatSendToLogin', $aseco->formatColors('{#error}You don\'t have the required admin rights to do that!'), $login);
	}
}

function init_message_manialinks($aseco, $value=0) {
	global $xml_message_on, $xml_message_off;
	global $msginfotext, $msgstyle, $msgsubstyle;
	global $msgmainposition, $msgmsize, $msgtextsize;

	$xml_message_on = '<manialink id="0815471122122">
		<frame posn="'.$msgmainposition.'">
			<quad posn="0 0 0" sizen="'.$msgmsize.'"  halign="center" valign="center" style="'.$msgstyle.'" substyle="'.$msgsubstyle.'"  />
			<label posn="0 0.2 1" sizen="'.$msgmsize.'" halign="center" valign="center" textsize="'.$msgtextsize.'" text="'.$msginfotext.'" />
		</frame>
	</manialink>';

	$xml_message_off = '<manialink id="0815471122122">
	</manialink>';
}

// display manialink
function message_on($aseco) {
	global $xml_message_on;
	global $msgreset;
	$msgreset = 0;
	$aseco->client->addCall('SendDisplayManialinkPage', array($xml_message_on, 0, false));
}  

// switch off manialink at roundsend
function message_off($aseco) {
	global $xml_message_off;
	global $msgreset;
	$msgreset = -900;
	$aseco->client->addCall('SendDisplayManialinkPage', array($xml_message_off, 0, false));
} 
?>
Last edited by nouseforname on 01 Jun 2010 09:37, edited 1 time in total.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

Amisxp
road tourist
road tourist
Posts: 81
Joined: 26 Dec 2008 10:28
Owned TM-games: TMUF
Location: Slovenia, Maribor

Re: [Xaseco] Nouse Message V1.0

Post by Amisxp » 01 Jun 2010 09:16

xaseco stops loading at [XAseco] Load plugin [plugin.nouse.message.php]

i tried deleting some things by myself but it didnt work (d0h)

nouseforname
swift roadking
swift roadking
Posts: 840
Joined: 20 Apr 2008 08:58
Owned TM-games: TMUF,TMNF, TMN
Manialink(s): therookies
Location: Germany
Contact:

Re: [Xaseco] Nouse Message V1.0

Post by nouseforname » 01 Jun 2010 09:38

sry, just delete the last curly bracket at the bottom.
i edit the post above. then it should load.
Owner of the Rookie servers and some more. :)
Rookies HP
My Project
Rookies Manialinkcolor>

Post Reply