• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Boosted Monster Gesior

Azerty

Active Member
Joined
Apr 15, 2022
Messages
316
Solutions
4
Reaction score
32
I'm trying to insert the boosted monster into gesior. Can anyone help me? I use TFS 1.5
I'm not able to make the monster image appear, I've already configured the database, I just can't make gesior show the monster.

PHP:
                                <div id="ThemeboxesColumn">
                                    <?PHP
                                        $monsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_name'")->fetch();
                                        $monster = $monsterquery["value"];
                                        $urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
                                        $urlmonster = $urlmonsterquery["value"];

                                    ?>
                                    <div id="DeactivationContainerThemebox" onclick="DisableDeactivationContainer();"></div>
                                    <?php if(Website::getWebsiteConfig()->getValue('info_bar_active')){?>
                                    <div id="RightArtwork">
                                        <img id="Monster" src="<?php echo $urlmonster; ?>" alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monster))); ?>" style="position: absolute;
                                            height: 45px;
                                            width: 50px;
                                            top: -80px;
                                            left: 23px;
                                            z-index: 106;
                                            cursor: pointer;">
                                        <img id="Pedestal" src="<?php echo $layout_name; ?>/images/global/header/pedestal.png" alt="Monster Pedestal">
 
Last edited:
If you managed to solve something, update the post with the solvation and the issue you discovered for others or even yourself in the future to see.
You come onto Otland expecting help from others while not wanting to help others that may have a similar issue with their plans.
 
Who said I don't want to help? I didn't solve the problem, I'm just giving up on solving it.
Post automatically merged:

I came back with the same problem haha
 
Last edited:
@Azerty

PHP:
 $urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
It seems that the path or address for the monster of the day image is saved in your database and this function above returns the address...
It seems strange the address for the image of the monster is in your database...
You can confirm that these values exist in your database?

where's your monster folder path?
 
@Azerty

PHP:
 $urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
It seems that the path or address for the monster of the day image is saved in your database and this function above returns the address...
It seems strange the address for the image of the monster is in your database...
You can confirm that these values exist in your database?

where's your monster folder path?
Yes, it is setting a value for the database, I also don't understand this path and what to do to find the monster's .gif file in images/monsters/
Post automatically merged:

However, the gesior I'm using has animatedOutfits
 
Can you provide an example of how the image is saved in your database and also the directory it is in?
Please note: The file extension is important, please show it.
Lua:
boostedMonsters = {}
boostedMonstersExperienceMultiplier = 2 -- 1 = default, 2 = 200% (aka, double experience)
boostedMonstersLootChanceMultiplier = 2 -- 1 = default, 2 = 200% (aka, double chance of loot.) (1.36% -> 2.72%)(88% -> 100%)

local boostedMonstersAmount = 2 -- how many arrays from boostedMonstersList will be chosen
-- NOTE: Ensure that this amount does not exceed the amount of arrays in boostedMonstersList.. or your server will crash.

local boostedMonstersList = {
    {"rat"},
    {"troll"},
    {"cyclops"},
    {"demon"},
    {"rotworm"},
    {"dwarf"},
    {"dragon"},
    {"nightmare"},
    {"grim reaper"},
    {"medusa"},
    {"serpent spawn"},
    {"hydra"},
    {"minotaur"},
    {"tarantula"},
    {"giant spider"},
    {"dawnfire asura"},
    {"deepling tyrant"},
    {"kollos"},
    {"manta ray"},
    {"waspoid"},
    {"crawler"},
    {"feral sphinx"},
    {"young goanna"},
    {"manticore"},
    {"hellhound"},
    {"lamassu"},
    {"sphinx"},
    {"guzzlemaw"},
    {"silencer"},
    {"frazzlemaw"},
    {"retching horror"},
    {"choking fear"},
    {"demon outcast"},
    {"plaguesmith"},
    {"dark torturer"},
    {"blightwalker"},
    {"lost soul"},
    {"juggernaut"},
    {"thanatursus"},
    {"arachnophobica"},
    {"minotaur hunter"},
    {"worm priestess"},
    {"mooh'tah warrior"},
    {"glooth blob"},
    {"hellspawn"},
    {"destroyer"},
    {"glooth anemone"},
    {"glooth golem"},
    {"rot elemental"},
    {"devourer"},
    {"rustheap golem"},
    {"undead dragon"},
    {"behemoth"},
    {"wyrm"},
    {"hellfire fighter"},
    {"lich"},
    {"vampire"},
    {"hero"},
    {"gargoyle"},
    {"vicious squire"},
    {"renegade knight"},
    {"vile grandmaster"},
    {"undead gladiador"},
    {"blood priest"},
    {"fury"},
    {"werebadger"},
    {"wereboar"},
    {"phantasm"},
    {"infernalist"},
    {"frost dragon"},
    {"defiler"},
    {"elder wyrm"},
    {"sparkion"},
    {"instable sparkion"},
    {"instable breach brood"},
    {"drillworm"},
    {"son of verminor"},
    {"green djinn"},
    {"necromancer"},
    {"crystal spider"},
    {"bog raider"},
    {"warlock"},
    {"orewalker"},
    {"flimsy lost soul"},
    {"ghastly dragon"},
    {"mutated bat"},
    {"mutated tiger"},
    {"pirate buccaneer"},
    {"lizard chosen"},
    {"rage squid"},
    {"cyclops smith"},
    {"cyclops drone"},
    {"dark faun"},
    {"twisted pooka"},
    {"enfeebled silencer"},
    {"ogre brute"},
    {"ogre shaman"},
    {"ogre savage"},
    {"clomp"},
    {"priestess of the wild sun"},
    {"gryphon"},
    {"lizard high guard"},
    {"lizard zaogun"},
    {"lizard legionnaire"},
    {"draken warmaster"},
    {"draken spellweaver"},
    {"draken abomination"},
    {"insectoid worker"},
    {"swarmer"},
    {"spitter"},
    {"fire elemental"}
}

local function generateBoostedMonstersText()
    local text = ""
    for i = 1, #boostedMonsters do
        if text ~= "" then
            if i == #boostedMonsters then
                text = text .. " and "
            else
                text = text .. ", "
            end
        end
        text = text .. boostedMonsters[i]
    end
    text = "Today's boosted monsters are " .. text .. "."
    return text
end

local function chooseBoostedMonsters()
    local boostedMonstersCount = 0
    while boostedMonstersCount < boostedMonstersAmount do
        local randomMonster = math.random(#boostedMonstersList)
        if not table.contains(boostedMonsters, boostedMonstersList[randomMonster][1]:lower()) then
            for i = 1, #boostedMonstersList[randomMonster] do
                table.insert(boostedMonsters, boostedMonstersList[randomMonster][i]:lower())
            end
            boostedMonstersCount = boostedMonstersCount + 1
        end
    end
    print(generateBoostedMonstersText())
end

local global = GlobalEvent("globalEvent_boostedMonsters")

function global.onStartup()
    addEvent(chooseBoostedMonsters, 0)
    local randomMonster = math.random(#boostedMonstersList)
    db.query("UPDATE `server_config` SET `value` = " .. randomMonster .. " WHERE `config` = 'boost_monster_name';")
    return true
end

global:register()


local loginEvent = CreatureEvent("onLogin_boostedMonsters")
loginEvent:type("login")

function loginEvent.onLogin(player)
    --player:sendTextMessage(MESSAGE_STATUS_DEFAULT, generateBoostedMonstersText())
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, generateBoostedMonstersText())
    return true
end

loginEvent:register()
 
Lua:
boostedMonsters = {}
boostedMonstersExperienceMultiplier = 2 -- 1 = default, 2 = 200% (aka, double experience)
boostedMonstersLootChanceMultiplier = 2 -- 1 = default, 2 = 200% (aka, double chance of loot.) (1.36% -> 2.72%)(88% -> 100%)

local boostedMonstersAmount = 2 -- how many arrays from boostedMonstersList will be chosen
-- NOTE: Ensure that this amount does not exceed the amount of arrays in boostedMonstersList.. or your server will crash.

local boostedMonstersList = {
    {"rat"},
    {"troll"},
    {"cyclops"},
    {"demon"},
    {"rotworm"},
    {"dwarf"},
    {"dragon"},
    {"nightmare"},
    {"grim reaper"},
    {"medusa"},
    {"serpent spawn"},
    {"hydra"},
    {"minotaur"},
    {"tarantula"},
    {"giant spider"},
    {"dawnfire asura"},
    {"deepling tyrant"},
    {"kollos"},
    {"manta ray"},
    {"waspoid"},
    {"crawler"},
    {"feral sphinx"},
    {"young goanna"},
    {"manticore"},
    {"hellhound"},
    {"lamassu"},
    {"sphinx"},
    {"guzzlemaw"},
    {"silencer"},
    {"frazzlemaw"},
    {"retching horror"},
    {"choking fear"},
    {"demon outcast"},
    {"plaguesmith"},
    {"dark torturer"},
    {"blightwalker"},
    {"lost soul"},
    {"juggernaut"},
    {"thanatursus"},
    {"arachnophobica"},
    {"minotaur hunter"},
    {"worm priestess"},
    {"mooh'tah warrior"},
    {"glooth blob"},
    {"hellspawn"},
    {"destroyer"},
    {"glooth anemone"},
    {"glooth golem"},
    {"rot elemental"},
    {"devourer"},
    {"rustheap golem"},
    {"undead dragon"},
    {"behemoth"},
    {"wyrm"},
    {"hellfire fighter"},
    {"lich"},
    {"vampire"},
    {"hero"},
    {"gargoyle"},
    {"vicious squire"},
    {"renegade knight"},
    {"vile grandmaster"},
    {"undead gladiador"},
    {"blood priest"},
    {"fury"},
    {"werebadger"},
    {"wereboar"},
    {"phantasm"},
    {"infernalist"},
    {"frost dragon"},
    {"defiler"},
    {"elder wyrm"},
    {"sparkion"},
    {"instable sparkion"},
    {"instable breach brood"},
    {"drillworm"},
    {"son of verminor"},
    {"green djinn"},
    {"necromancer"},
    {"crystal spider"},
    {"bog raider"},
    {"warlock"},
    {"orewalker"},
    {"flimsy lost soul"},
    {"ghastly dragon"},
    {"mutated bat"},
    {"mutated tiger"},
    {"pirate buccaneer"},
    {"lizard chosen"},
    {"rage squid"},
    {"cyclops smith"},
    {"cyclops drone"},
    {"dark faun"},
    {"twisted pooka"},
    {"enfeebled silencer"},
    {"ogre brute"},
    {"ogre shaman"},
    {"ogre savage"},
    {"clomp"},
    {"priestess of the wild sun"},
    {"gryphon"},
    {"lizard high guard"},
    {"lizard zaogun"},
    {"lizard legionnaire"},
    {"draken warmaster"},
    {"draken spellweaver"},
    {"draken abomination"},
    {"insectoid worker"},
    {"swarmer"},
    {"spitter"},
    {"fire elemental"}
}

local function generateBoostedMonstersText()
    local text = ""
    for i = 1, #boostedMonsters do
        if text ~= "" then
            if i == #boostedMonsters then
                text = text .. " and "
            else
                text = text .. ", "
            end
        end
        text = text .. boostedMonsters[i]
    end
    text = "Today's boosted monsters are " .. text .. "."
    return text
end

local function chooseBoostedMonsters()
    local boostedMonstersCount = 0
    while boostedMonstersCount < boostedMonstersAmount do
        local randomMonster = math.random(#boostedMonstersList)
        if not table.contains(boostedMonsters, boostedMonstersList[randomMonster][1]:lower()) then
            for i = 1, #boostedMonstersList[randomMonster] do
                table.insert(boostedMonsters, boostedMonstersList[randomMonster][i]:lower())
            end
            boostedMonstersCount = boostedMonstersCount + 1
        end
    end
    print(generateBoostedMonstersText())
end

local global = GlobalEvent("globalEvent_boostedMonsters")

function global.onStartup()
    addEvent(chooseBoostedMonsters, 0)
    local randomMonster = math.random(#boostedMonstersList)
    db.query("UPDATE `server_config` SET `value` = " .. randomMonster .. " WHERE `config` = 'boost_monster_name';")
    return true
end

global:register()


local loginEvent = CreatureEvent("onLogin_boostedMonsters")
loginEvent:type("login")

function loginEvent.onLogin(player)
    --player:sendTextMessage(MESSAGE_STATUS_DEFAULT, generateBoostedMonstersText())
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, generateBoostedMonstersText())
    return true
end

loginEvent:register()
Can you provide an image of the image directory?
 
htdocs/images/monsters/grim_reaper.gif
This?
Below
C++:
$urlmonster = $urlmonsterquery["value"]

add
C++:
var_dump($urlmonster);

this will print the value of the $urlmonster variable in array format (string). Check that this is correct, so that it can be used in the html element, which will fetch the image from the directory you sent.

Example...
C++:
<?PHP
    $monsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_name'")->fetch();
    $monster = $monsterquery["value"];
    $urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
    $urlmonster = $urlmonsterquery["value"];
    var_dump($urlmonster);
?>
 
Below
C++:
$urlmonster = $urlmonsterquery["value"]

add
C++:
var_dump($urlmonster);

this will print the value of the $urlmonster variable in array format (string). Check that this is correct, so that it can be used in the html element, which will fetch the image from the directory you sent.

Example...
C++:
<?PHP
    $monsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_name'")->fetch();
    $monster = $monsterquery["value"];
    $urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
    $urlmonster = $urlmonsterquery["value"];
    var_dump($urlmonster);
?>
Dont work. I don't understand, I can't find how to insert the image's directory, which directory does $urlmonster look for?
 
Right, let's go in parts.

  1. Perform this select that fetches the information from the monster's image directory in your database and paste the result into the answer.
    SQL:
    SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'

  2. In your project, navigate to the folder containing the images of the monsters, put a screenshot in the response (it is important that the directory path appears in full).

  3. Post your php script in full to make it easier to identify where the problem is.
 
Right, let's go in parts.

  1. Perform this select that fetches the information from the monster's image directory in your database and paste the result into the answer.
    SQL:
    SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'

  2. In your project, navigate to the folder containing the images of the monsters, put a screenshot in the response (it is important that the directory path appears in full).

  3. Post your php script in full to make it easier to identify where the problem is.
database.PNG

image.PNG
 

Attachments

Lua:
boostedMonsters = {}
boostedMonstersExperienceMultiplier = 2 -- 1 = default, 2 = 200% (aka, double experience)
boostedMonstersLootChanceMultiplier = 2 -- 1 = default, 2 = 200% (aka, double chance of loot.) (1.36% -> 2.72%)(88% -> 100%)

local boostedMonstersAmount = 2 -- how many arrays from boostedMonstersList will be chosen
-- NOTE: Ensure that this amount does not exceed the amount of arrays in boostedMonstersList.. or your server will crash.

local boostedMonstersList = {
    {"rat"},
    {"troll"},
    {"cyclops"},
    {"demon"},
    {"rotworm"},
    {"dwarf"},
    {"dragon"},
    {"nightmare"},
    {"grim reaper"},
    {"medusa"},
    {"serpent spawn"},
    {"hydra"},
    {"minotaur"},
    {"tarantula"},
    {"giant spider"},
    {"dawnfire asura"},
    {"deepling tyrant"},
    {"kollos"},
    {"manta ray"},
    {"waspoid"},
    {"crawler"},
    {"feral sphinx"},
    {"young goanna"},
    {"manticore"},
    {"hellhound"},
    {"lamassu"},
    {"sphinx"},
    {"guzzlemaw"},
    {"silencer"},
    {"frazzlemaw"},
    {"retching horror"},
    {"choking fear"},
    {"demon outcast"},
    {"plaguesmith"},
    {"dark torturer"},
    {"blightwalker"},
    {"lost soul"},
    {"juggernaut"},
    {"thanatursus"},
    {"arachnophobica"},
    {"minotaur hunter"},
    {"worm priestess"},
    {"mooh'tah warrior"},
    {"glooth blob"},
    {"hellspawn"},
    {"destroyer"},
    {"glooth anemone"},
    {"glooth golem"},
    {"rot elemental"},
    {"devourer"},
    {"rustheap golem"},
    {"undead dragon"},
    {"behemoth"},
    {"wyrm"},
    {"hellfire fighter"},
    {"lich"},
    {"vampire"},
    {"hero"},
    {"gargoyle"},
    {"vicious squire"},
    {"renegade knight"},
    {"vile grandmaster"},
    {"undead gladiador"},
    {"blood priest"},
    {"fury"},
    {"werebadger"},
    {"wereboar"},
    {"phantasm"},
    {"infernalist"},
    {"frost dragon"},
    {"defiler"},
    {"elder wyrm"},
    {"sparkion"},
    {"instable sparkion"},
    {"instable breach brood"},
    {"drillworm"},
    {"son of verminor"},
    {"green djinn"},
    {"necromancer"},
    {"crystal spider"},
    {"bog raider"},
    {"warlock"},
    {"orewalker"},
    {"flimsy lost soul"},
    {"ghastly dragon"},
    {"mutated bat"},
    {"mutated tiger"},
    {"pirate buccaneer"},
    {"lizard chosen"},
    {"rage squid"},
    {"cyclops smith"},
    {"cyclops drone"},
    {"dark faun"},
    {"twisted pooka"},
    {"enfeebled silencer"},
    {"ogre brute"},
    {"ogre shaman"},
    {"ogre savage"},
    {"clomp"},
    {"priestess of the wild sun"},
    {"gryphon"},
    {"lizard high guard"},
    {"lizard zaogun"},
    {"lizard legionnaire"},
    {"draken warmaster"},
    {"draken spellweaver"},
    {"draken abomination"},
    {"insectoid worker"},
    {"swarmer"},
    {"spitter"},
    {"fire elemental"}
}

local function generateBoostedMonstersText()
    local text = ""
    for i = 1, #boostedMonsters do
        if text ~= "" then
            if i == #boostedMonsters then
                text = text .. " and "
            else
                text = text .. ", "
            end
        end
        text = text .. boostedMonsters[i]
    end
    text = "Today's boosted monsters are " .. text .. "."
    return text
end

local function chooseBoostedMonsters()
    local boostedMonstersCount = 0
    while boostedMonstersCount < boostedMonstersAmount do
        local randomMonster = math.random(#boostedMonstersList)
        if not table.contains(boostedMonsters, boostedMonstersList[randomMonster][1]:lower()) then
            for i = 1, #boostedMonstersList[randomMonster] do
                table.insert(boostedMonsters, boostedMonstersList[randomMonster][i]:lower())
            end
            boostedMonstersCount = boostedMonstersCount + 1
        end
    end
    print(generateBoostedMonstersText())
end

local global = GlobalEvent("globalEvent_boostedMonsters")

function global.onStartup()
    addEvent(chooseBoostedMonsters, 0)
    local randomMonster = math.random(#boostedMonstersList)
    db.query("UPDATE `server_config` SET `value` = " .. randomMonster .. " WHERE `config` = 'boost_monster_name';")
    return true
end

global:register()


local loginEvent = CreatureEvent("onLogin_boostedMonsters")
loginEvent:type("login")

function loginEvent.onLogin(player)
    --player:sendTextMessage(MESSAGE_STATUS_DEFAULT, generateBoostedMonstersText())
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, generateBoostedMonstersText())
    return true
end

loginEvent:register()
Note that in this script you are only updating the table with the monster's number.

Lua:
function global.onStartup()
    addEvent(chooseBoostedMonsters, 0)
    local [B]randomMonster [/B]= math.random(#boostedMonstersList)
    db.query("UPDATE `server_config` SET `value` = " .. [B]randomMonster [/B].. " WHERE `config` = 'boost_monster_name';")
    return true
end

But you should have something like the directory path of the monster's image so that you can use it when you select from this table to get this data.
Example: c:/xampp/htdocs/images/monsters/Badger
Sugestion
  1. When updating the server_config table with the boosted monster, try to insert its name instead of the random "INDICE".
  2. When displaying the image of this monster, search only for its name.
    Example: Badger

  3. In your php script. Have a control variable with part of the image directory.
    Examplo: c:/xampp/htdocs/images/monters/

  4. When searching for the name of the monster, use the control variable with part of the directory and concatenate it with the name of the monster.
    PHP:
    $dir = "c:/xampp/htdocs/images/monsters"

  5. In your script, do something like:
    PHP:
    <img id="Monster" src="<?php echo $dir . $urlmonster; ?>"    alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monster))); ?>" style="position: absolute;
                                                    height: 45px;
                                                    width: 50px;
                                                    top: -80px;
                                                    left: 23px;
                                                    z-index: 106;
                                                    cursor: pointer;">
        <img id="PedestalAndOnline" src="<?php echo $layout_name; ?>/images/global/header/pedestal-and-online.gif" alt="Monster Pedestal and Online">
        <div id="PlayersOnline" onclick="window.location = '?subtopic=worlds';"><?php echo $players_online; ?></div>
            </div>

    Final result: c:/xampp/htdocs/images/monters/Badger

Note that in your script, you already make a query to look up the monster's name. If this is working, you can use the variable.
PHP:
$monster = $monsterquery["value"];
 
Note that in this script you are only updating the table with the monster's number.

Lua:
function global.onStartup()
    addEvent(chooseBoostedMonsters, 0)
    local [B]randomMonster [/B]= math.random(#boostedMonstersList)
    db.query("UPDATE `server_config` SET `value` = " .. [B]randomMonster [/B].. " WHERE `config` = 'boost_monster_name';")
    return true
end

But you should have something like the directory path of the monster's image so that you can use it when you select from this table to get this data.
Example: c:/xampp/htdocs/images/monsters/Badger
Sugestion
  1. When updating the server_config table with the boosted monster, try to insert its name instead of the random "INDICE".
  2. When displaying the image of this monster, search only for its name.
    Example: Badger

  3. In your php script. Have a control variable with part of the image directory.
    Examplo: c:/xampp/htdocs/images/monters/

  4. When searching for the name of the monster, use the control variable with part of the directory and concatenate it with the name of the monster.
    PHP:
    $dir = "c:/xampp/htdocs/images/monsters"

  5. In your script, do something like:
    PHP:
    <img id="Monster" src="<?php echo $dir . $urlmonster; ?>"    alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monster))); ?>" style="position: absolute;
                                                    height: 45px;
                                                    width: 50px;
                                                    top: -80px;
                                                    left: 23px;
                                                    z-index: 106;
                                                    cursor: pointer;">
        <img id="PedestalAndOnline" src="<?php echo $layout_name; ?>/images/global/header/pedestal-and-online.gif" alt="Monster Pedestal and Online">
        <div id="PlayersOnline" onclick="window.location = '?subtopic=worlds';"><?php echo $players_online; ?></div>
            </div>

    Final result: c:/xampp/htdocs/images/monters/Badger

Note that in your script, you already make a query to look up the monster's name. If this is working, you can use the variable.
PHP:
$monster = $monsterquery["value"];
I checked that the image has no address, I understood everything you explained but I don't have that knowledge to apply
Post automatically merged:

OK, we're almost there
diretorio.PNG
Post automatically merged:

Note that in this script you are only updating the table with the monster's number.

Lua:
function global.onStartup()
    addEvent(chooseBoostedMonsters, 0)
    local [B]randomMonster [/B]= math.random(#boostedMonstersList)
    db.query("UPDATE `server_config` SET `value` = " .. [B]randomMonster [/B].. " WHERE `config` = 'boost_monster_name';")
    return true
end

But you should have something like the directory path of the monster's image so that you can use it when you select from this table to get this data.
Example: c:/xampp/htdocs/images/monsters/Badger
Sugestion
  1. When updating the server_config table with the boosted monster, try to insert its name instead of the random "INDICE".
  2. When displaying the image of this monster, search only for its name.
    Example: Badger

  3. In your php script. Have a control variable with part of the image directory.
    Examplo: c:/xampp/htdocs/images/monters/

  4. When searching for the name of the monster, use the control variable with part of the directory and concatenate it with the name of the monster.
    PHP:
    $dir = "c:/xampp/htdocs/images/monsters"

  5. In your script, do something like:
    PHP:
    <img id="Monster" src="<?php echo $dir . $urlmonster; ?>"    alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monster))); ?>" style="position: absolute;
                                                    height: 45px;
                                                    width: 50px;
                                                    top: -80px;
                                                    left: 23px;
                                                    z-index: 106;
                                                    cursor: pointer;">
        <img id="PedestalAndOnline" src="<?php echo $layout_name; ?>/images/global/header/pedestal-and-online.gif" alt="Monster Pedestal and Online">
        <div id="PlayersOnline" onclick="window.location = '?subtopic=worlds';"><?php echo $players_online; ?></div>
            </div>

    Final result: c:/xampp/htdocs/images/monters/Badger

Note that in your script, you already make a query to look up the monster's name. If this is working, you can use the variable.
PHP:
$monster = $monsterquery["value"];
How do I read the monster in the folder?
 
Last edited:
I checked that the image has no address, I understood everything you explained but I don't have that knowledge to apply
Post automatically merged:

OK, we're almost there
View attachment 78797

Let's go in parts.
  1. Change this
    Lua:
    function global.onStartup()    addEvent(chooseBoostedMonsters, 0)
        local randomMonster = math.random(#boostedMonstersList)
        db.query("UPDATE `server_config` SET `value` = " .. randomMonster .. " WHERE `config` = 'boost_monster_name';")
        return true
    end

    For this
    Code:
    function global.onStartup()    addEvent(chooseBoostedMonsters, 0)
        local randomMonster = math.random(#boostedMonstersList)
        db.query("UPDATE `server_config` SET `value` = " .. boostedMonstersList[randomMonster] .. " WHERE `config` = 'boost_monster_name';")
        return true
    end

  2. In you script php, below
    PHP:
    $monsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_name'")->fetch();$monster = $monsterquery["value"];
    $urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
    $urlmonster = $urlmonsterquery["value"];
    Add
    PHP:
    $dir = "path/directory/of/your/image/";

  3. And change how you mount the image directory.
    PHP:
    <img id="Monster" src="<?php echo $dir . $urlmonster; ?>"    alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monster))); ?>" style="position: absolute;
                                                    height: 45px;
                                                    width: 50px;
                                                    top: -80px;
                                                    left: 23px;
                                                    z-index: 106;
                                                    cursor: pointer;">
        <img id="PedestalAndOnline" src="<?php echo $layout_name; ?>/images/global/header/pedestal-and-online.gif" alt="Monster Pedestal and Online">
        <div id="PlayersOnline" onclick="window.location = '?subtopic=worlds';"><?php echo $players_online; ?></div>
            </div>
Test these changes.

Good Luck!
 
Lua:
addEvent(chooseBoostedMonsters, 0)
local randomMonster = math.random(#boostedMonstersList)

What on earth is going on here?

There's no need to call an addEvent here if it's set to 0ms... just execute the function.

Also, if its choosing the boosted monsters in chooseBoostedMonsters, why are you then setting a random monster from the list to the DB?

You will have different boosted creatures in both server memory, and what is showing on the website...
 
Lua:
addEvent(chooseBoostedMonsters, 0)
local randomMonster = math.random(#boostedMonstersList)

What on earth is going on here?

There's no need to call an addEvent here if it's set to 0ms... just execute the function.

Also, if its choosing the boosted monsters in chooseBoostedMonsters, why are you then setting a random monster from the list to the DB?

You will have different boosted creatures in both server memory, and what is showing on the website...
I want to make any monster appear on the site in whatever way the server chooses. Then I decide if it's the correct monster or not. Do you have this knowledge to share with us? One thing at a time XD
Post automatically merged:

Let's go in parts.
  1. Change this
    Lua:
    function global.onStartup()    addEvent(chooseBoostedMonsters, 0)
        local randomMonster = math.random(#boostedMonstersList)
        db.query("UPDATE `server_config` SET `value` = " .. randomMonster .. " WHERE `config` = 'boost_monster_name';")
        return true
    end

    For this
    Code:
    function global.onStartup()    addEvent(chooseBoostedMonsters, 0)
        local randomMonster = math.random(#boostedMonstersList)
        db.query("UPDATE `server_config` SET `value` = " .. boostedMonstersList[randomMonster] .. " WHERE `config` = 'boost_monster_name';")
        return true
    end

  2. In you script php, below
    PHP:
    $monsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_name'")->fetch();$monster = $monsterquery["value"];
    $urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
    $urlmonster = $urlmonsterquery["value"];
    Add
    PHP:
    $dir = "path/directory/of/your/image/";

  3. And change how you mount the image directory.
    PHP:
    <img id="Monster" src="<?php echo $dir . $urlmonster; ?>"    alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monster))); ?>" style="position: absolute;
                                                    height: 45px;
                                                    width: 50px;
                                                    top: -80px;
                                                    left: 23px;
                                                    z-index: 106;
                                                    cursor: pointer;">
        <img id="PedestalAndOnline" src="<?php echo $layout_name; ?>/images/global/header/pedestal-and-online.gif" alt="Monster Pedestal and Online">
        <div id="PlayersOnline" onclick="window.location = '?subtopic=worlds';"><?php echo $players_online; ?></div>
            </div>
Test these changes.

Good Luck!
I got it bro!! After a lot of conversation with chatGPT I discovered this way. Now I need to fix the server's boosted.lua as the friend said above XD

PHP:
                                         $monsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_name'")->fetch();
                                        $monster = $monsterquery["value"];
                                        //$urlmonsterquery = $SQL->query("SELECT `value` FROM `server_config` WHERE `config` = 'boost_monster_url'")->fetch();
                                        //$urlmonster = $urlmonsterquery["value"];
                                        $dir = "/images/monsters/";
                                        $imagePath = $dir . $monster . ".gif";


                                        ...                                         

                                            

                                        <img id="Monster" src="<?php echo $imagePath; ?>" alt="Monster of the Day"
 
Last edited:
Back
Top