AI to Module

threadPage 1 of 1
Wednesday, October 15, 2025
Avatar for 8aa88c3efb234c0cb8e10aeda354934f5962c758666d3ea6bb0c3677e2a3bdba
User 8aa88c
🎯 Answer (Confidence: High)
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:
  1. Reading the
    home_teleport
    variable that
    /sethome
    saved.
  2. 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.
Response generated from 14 search results
Avatar for e3617ce9af6d75316d3d8429202aedeabcff86e1baff4480ea9377f0cfa46444
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();