ManiaControl Promotion plugin

ManiaControl, the completely new designed and easy to use controller managing all your Maniaplanet server.

Moderators: Jocy, Wabbitface, steeffeen, NADEO

User avatar
chco
Posts: 301
Joined: 24 Dec 2012, 09:11

Re: ManiaControl Promotion plugin

Post by chco »

No, I get that and much appreciated! :)
Image
User avatar
steeffeen
Translator
Translator
Posts: 2472
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: ManiaControl Promotion plugin

Post by steeffeen »

i kinda doubt that "self::.." will work, you might need to use the class name directly

my attempt:

Code: Select all

const SETTING_PROMOTE = 'Message text ';
// ..
for (int i = 0; i < self::MESSAGE_COUNT; i++) {
	$settingName = self::SETTING_PROMOTE . $i;
	$settingValue = $this->maniaControl->settingManager->getSettingValue($settingName);
	if ($settingValue) {
		array_push($this->message, $settingValue);
	}
}
or if you like fewer lines

Code: Select all

// ..
for (int i = 0; i < self::MESSAGE_COUNT; i++) {
	if ($settingValue = $this->maniaControl->settingManager->getSettingValue(self::SETTING_PROMOTE . $i)) {
		array_push($this->message, $settingValue);
	}
}
>> not tested
note the single get() instead of two calls

(setting names have numbers instead of characters that way though, which scales better anyways)
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    User avatar
    chco
    Posts: 301
    Joined: 24 Dec 2012, 09:11

    Re: ManiaControl Promotion plugin

    Post by chco »

    Thanks for the examples guys!
    Btw, the reason it didn't have numbers is the fact that in the settings screen of mc you get:
    Setting 1
    Setting 10
    Setting 2
    Setting 3

    That is why I used a, b,c...
    I'll try out your suggestions gentlemen.
    Thanks!
    Image
    User avatar
    steeffeen
    Translator
    Translator
    Posts: 2472
    Joined: 14 Oct 2012, 16:22
    Location: Germany

    Re: ManiaControl Promotion plugin

    Post by steeffeen »

    kremsy wrote:The Numbers in Steeffeens example are only for accassing the Settings (they have nothing todo with the displayed names).
    that's not correct ^^
    the numbers are part of the message
    chco wrote:That is why I used a, b,c...
    you're right there, that comes from the alphabetical ordering
    either you format the numbers to look like 01, 02, .., 11, ..
    or simply use chr() to get the characters from the loop counter
    (A = 65, B = 66, ..)

    Code: Select all

    $x = chr(65 + $i);
      Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

      ManiaControl, FancyManiaLinks
      User avatar
      steeffeen
      Translator
      Translator
      Posts: 2472
      Joined: 14 Oct 2012, 16:22
      Location: Germany

      Re: ManiaControl Promotion plugin

      Post by steeffeen »

      please fix the errors of the plugin, check out http://maniacontrol.com/user/errors
        Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

        ManiaControl, FancyManiaLinks
        User avatar
        chco
        Posts: 301
        Joined: 24 Dec 2012, 09:11

        Re: ManiaControl Promotion plugin

        Post by chco »

        I've passed one on to you guys (when settings are changed part) as I cannot reproduce this error.
        New version (1.2) is uploaded..

        Sorry it took a while, was away much.
        Image
        User avatar
        steeffeen
        Translator
        Translator
        Posts: 2472
        Joined: 14 Oct 2012, 16:22
        Location: Germany

        Re: ManiaControl Promotion plugin

        Post by steeffeen »

        chco wrote:I've passed one on to you guys (when settings are changed part) as I cannot reproduce this error.

        Code: Select all

        public function handleSettingChangedCallback(Setting $setting)
        you have to add a use statement for the settings namespace
          Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

          ManiaControl, FancyManiaLinks
          Post Reply

          Return to “ManiaControl”

          Who is online

          Users browsing this forum: No registered users and 1 guest