ManiaControl Promotion plugin
Moderators: Jocy, Wabbitface, steeffeen, NADEO
Re: ManiaControl Promotion plugin
i kinda doubt that "self::.." will work, you might need to use the class name directly
my attempt:or if you like fewer lines
>> not tested
note the single get() instead of two calls
(setting names have numbers instead of characters that way though, which scales better anyways)
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);
}
}
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);
}
}
note the single get() instead of two calls
(setting names have numbers instead of characters that way though, which scales better anyways)
Re: ManiaControl Promotion plugin
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!
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!
Re: ManiaControl Promotion plugin
that's not correct ^^kremsy wrote:The Numbers in Steeffeens example are only for accassing the Settings (they have nothing todo with the displayed names).
the numbers are part of the message
you're right there, that comes from the alphabetical orderingchco wrote:That is why I used a, b,c...
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);
Re: ManiaControl Promotion plugin
please fix the errors of the plugin, check out http://maniacontrol.com/user/errors
Re: ManiaControl Promotion plugin
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.
New version (1.2) is uploaded..
Sorry it took a while, was away much.
Re: ManiaControl Promotion plugin
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)
Who is online
Users browsing this forum: No registered users and 1 guest