module-development

textPage 5 of 43
50 messages on this page
Sunday, July 27, 2025
Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
download the json, import the module via the action list on the top righ in the module builder
Avatar for f34ff9b94f19d1880635e371ada4d43f47fa82a3453f34f30a17b7e1abc3141e
User f34ff9
So all I have to do is copy the teleport and this code or make a new one?
Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
/tp home
/back
will teleport you back before you were teleported to home
Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
No content

back_module-1753629274904.json

JSON8.5 KB

Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
Avatar for f34ff9b94f19d1880635e371ada4d43f47fa82a3453f34f30a17b7e1abc3141e
User f34ff9
So I see you got return back working.
Saturday, July 26, 2025
Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
But we have an updated module viewer with categories
Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
And people for now is me xd
Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
That’s the idea as long as people tag them right
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
I imagine if I'm installing modules on a Rust server, Minecraft only modules won't even show, is that right?
Avatar for 69dd72e9beda7be7af827395b1f4c2eae3591be65684955a7d6af40731acc13c
User 69dd72
Good stuff!!
image.png

image.png

PNG137.1 KB

Friday, July 25, 2025
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Thanks!
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Ooook I'll keep an eye out for the official method and switch to that when it's available 🙂
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
That being said, this functionality of 'triggering a module/function on demand' is on the TODO list to add properly to the system
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
BUT if I make breaking changes, I have a LOT of tests to refactor. So in reality there probably wont be any breaking changes xd
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Technically, internal use only and subject to breaking changes
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Do you like to live dangerously? 😄
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Is that trigger endpoint ok to use? Or expected for internal use only and potentially subject to breaking changes?
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Thanks!
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Ohhh ok I see
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
(aka the same code you'd use in a module)
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Oh check the code link I sent, that has examples using the api client
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Or is there a better way to trigger a command for a player?
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
So how you do that in JSON?
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
True :p
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Erm... well that's not in the DTO lol
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
:D
image.png

image.png

PNG41.6 KB

Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Uhhh there is no
id
parameter, just
msg
and
playerId
. I'm talking about
CommandTriggerDTO
.
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I have to say, those
trigger
endpoints are mostly internal use :p They're a bit rough. I use them all the time in the tests to trigger stuff. You'll find plenty of examples there: https://github.com/gettakaro/takaro/blob/development/packages/lib-modules/src/__tests__/teleports/teleport.integration.test.ts
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Ah no, it's a bit confusing. The
id
parameter in that endpoint is actually a gameserver id.
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
That would be truly wonderful haha thanks! I noticed this a few weeks ago when I made changes to my teleports module and found that alllllll my aliases went buhbye on installing the new tag. 😦
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
For the Command controller's TriggerCommand endpoint, how does the
playerId
property of the DTO work? Will it try to execute that command as that player on all game servers?
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Hmm not ideal! I can take some time and see what goes wrong there and make it smarter about carrying over configs
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Yeah but upgrading/downgrading even to tags requires essentially reinstalling the module, which in my experience sometimes causes configurations options to be reset to defaults. It can be a lot of work resetting those configurations!
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I wonder if we have control of the size of that box :O
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Ah yeah, when editing 'latest' which is installed, it can cause weirdness :( Solution is to tag your modules!
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
How can I get the cron temporal value that's set for a specific cron in a specific module installation's system config?
Ah nevermind, you can see the datastructure using the Web UI documentation page's testing feature.
Then it's:
import (data, takaro) from '@takaro/helpers';
async function main() {
  const { module: mod } = data;
  const cronTemporalValue = mod.systemConfig.cronJobs.<cronJobName>.temporalValue;
}

await main();
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
It getThis is the view you get when you type
await takaro.module.moduleInstallationsControllerGetModuleInstallation(
and get the intellisenseish view of what the paramters are.
image.png

image.png

PNG16.6 KB

Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Also the function name
moduleInstallationsControllerGetModuleInstallation
is too long to fit in the mouseover tooltip in the Studio editor lol, it gets truncated by the tooltip boundary.
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
I noticed something I think is maybe a bug. If I edit a module that is installed on a game server by adding a user config option (type number) and if the game server is using the
latest
version label, the value of that new user config option will come back as NaN, even if the config field has a default value set to it. I think it's because
latest
doesn't include latest config schema changes. It works when I reinstall the module but that's a pain because then I have to reset all the user config values.
Thursday, July 24, 2025
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Yeah :P Typescript is a lot nicer to work with x.x
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Ok neat, thank you! That helps a lot! I'm so used to typed languages that I struggle with JS sometimes haha
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
if
statement is just one way though. You can also do stuff like
if (typeof foo !== 'number') throw new Error('Foo not a number')
Anything after that line will know that foo is a string
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
But here, because I do a hardcore number check in that if, it knows that
foo
must be 0 at this point in the code
image.png

image.png

PNG38.0 KB

Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
So here it doesnt know yet, so either the string or the number
image.png

image.png

PNG39.9 KB

Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
You can't do casting in JS indeed, but you can do runtime checks to ensure you're working with a certain type.
For example, here's a super cursed function which returns a string OR a number:
async function main() {

    function returnsStringOrNumber(a) {
        if (a > 1) return 'BiggerThanOne';
        return 0;
    }

    const foo = returnsStringOrNumber(1);

    if (typeof foo === 'number') {
        console.log(`${foo} is a number`);
    } else {
        console.log(`${foo} is a string`);
    }

}
await main();
If you paste that in studio and hover over
foo
at the different points in the function, you'll see that the language server knows for sure which type it is after that
if
statement
Avatar for a12f6e80e9d89b5470e3311f9d8388d6d4bc834b3825be85bf1f6a4e71dd314f
User a12f6e
Ah ok ty. I honestly don't know how to cast in Javascript lol, it's such a lawless language that you generally don't have to. Is there any syntactic sugar I can apply to tell the editor to interpret an object as a specific type?
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Takaro studio handles the code as typescript for better intellisense but it doesnt pick up this issue... :(
This thing did flag it though
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
it would be valid Typescript! But not valid Javascript
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
That
foo as string
syntax is not valid Javascript