module-development
textPage 5 of 43
50 messages on this page
Sunday, July 27, 2025
User 69dd72
download the json, import the module via the action list on the top righ in the module builder
User f34ff9
So all I have to do is copy the teleport and this code or make a new one?
User 69dd72
/tp home
/back
will teleport you back before you were teleported to home
/back
will teleport you back before you were teleported to home
User 69dd72
@User 20661824 Yes !
User f34ff9
So I see you got return back working.
Saturday, July 26, 2025
User 69dd72
But we have an updated module viewer with categories
User 69dd72
And people for now is me xd
User 69dd72
That’s the idea as long as people tag them right
User 6ceaf4
I imagine if I'm installing modules on a Rust server, Minecraft only modules won't even show, is that right?
Friday, July 25, 2025
User a12f6e
Thanks!
User a12f6e
Ooook I'll keep an eye out for the official method and switch to that when it's available 🙂
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
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
User bddf69
Technically, internal use only and subject to breaking changes
User bddf69
Do you like to live dangerously? 😄
User a12f6e
Is that trigger endpoint ok to use? Or expected for internal use only and potentially subject to breaking changes?
User a12f6e
Thanks!
User a12f6e
Ohhh ok I see
User bddf69
(aka the same code you'd use in a module)
User bddf69
Oh check the code link I sent, that has examples using the api client
User a12f6e
Or is there a better way to trigger a command for a player?
User a12f6e
So how you do that in JSON?
User bddf69
True :p
User a12f6e
Erm... well that's not in the DTO lol
User a12f6e
Uhhh there is no
id parameter, just msg and playerId. I'm talking about CommandTriggerDTO.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.tsUser bddf69
Ah no, it's a bit confusing. The
id parameter in that endpoint is actually a gameserver id.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. 😦
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?User bddf69
Hmm not ideal! I can take some time and see what goes wrong there and make it smarter about carrying over configs
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!
User bddf69
I wonder if we have control of the size of that box :O
User bddf69
Ah yeah, when editing 'latest' which is installed, it can cause weirdness :( Solution is to tag your modules!
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();
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
PNG • 16.6 KB
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.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
User bddf69
Yeah :P Typescript is a lot nicer to work with x.x
User a12f6e
Ok neat, thank you! That helps a lot! I'm so used to typed languages that I struggle with JS sometimes haha
User bddf69
if statement is just one way though. You can also do stuff likeif (typeof foo !== 'number') throw new Error('Foo not a number')
Anything after that line will know that foo is a string
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
PNG • 38.0 KB
User bddf69
So here it doesnt know yet, so either the string or the number

image.png
PNG • 39.9 KB
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 statementUser 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?
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
User bddf69
it would be valid Typescript! But not valid Javascript
User bddf69
That
foo as string syntax is not valid Javascript
