AI to Module
threadPage 1 of 1
Wednesday, October 15, 2025
User 8aa88c
🎯 Answer (Confidence: High)
Hey there!
Hey there!
You've made a great observation. You are correct, the
/sethome command you've created doesn't actually perform a teleport. Its purpose is to save the player's current coordinates as a variable, and it looks like your code is doing that perfectly!To complete the feature, you would typically create a second command, like
/home. This new command would be responsible for:- Reading the
variable thathome_teleport
saved./sethome - Using the coordinates from that variable to execute a teleport for the player.
This two-command approach is standard. For example, the built-in Teleports module has separate commands like
/settp to save a location and /teleport to travel to it.Your
/sethome command is a solid first step! For a complete example of how to build the corresponding /home command, I'd recommend checking out the code for the built-in modules on the Takaro GitHub repository, as they are great real-world examples.Sources:
• Takaro Documentation: Writing Takaro Modules | Takaro (4 sections)
• Takaro Documentation: teleports | Takaro
• Takaro Documentation: Writing Takaro Modules | Takaro (4 sections)
• Takaro Documentation: teleports | Takaro
Response generated from 14 search results
User e3617c
Im trying oot the Using AI to write modules guide on here and asked Claude to make a sethome home teleport so far the respond works, but after comparing the code with the teleports module i feel like the yode dont really create a teleport. the /sethome code:
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, pog, gameServerId, module: mod } = data; if (!checkPermission(pog, 'HOME_USE')) { throw new TakaroUserError('You do not have permission to use home teleports!'); } const existingHome = await takaro.variable.variableControllerSearch({ filters: { key: ['home_teleport'], gameServerId: [gameServerId], playerId: [pog.playerId], moduleId: [mod.moduleId], }, }); const homeLocation = JSON.stringify({ x: pog.positionX, y: pog.positionY, z: pog.positionZ, }); if (existingHome.data.data.length > 0) { await takaro.variable.variableControllerUpdate(existingHome.data.data[0].id, { value: homeLocation, }); await player.pm('Successfully overwritten home teleport!'); } else { await takaro.variable.variableControllerCreate({ key: 'home_teleport', value: homeLocation, gameServerId, playerId: pog.playerId, moduleId: mod.moduleId, }); await player.pm('Successfully created home teleport!'); } } await main();