#modules

1 messages · Page 1 of 1 (latest)

random kraken
#

Is there a way to be an admin if u do /module utility in the TRIBE HOUSE?

paper kraken
random kraken
whole tide
worldly star
#

oh sorry

whole tide
#

its alright

#

players will help you there

worldly star
#

thanks

tulip lily
#

how does playSound work? can lua team members use custom sounds or just game sounds?

mild sage
#

Just game sounds

#

playSound gonna be a chaos

whole tide
#

when we can upload our own sounds

whole tide
#

to which module

mild sage
#

aurora

tulip lily
#

Hm

#

thx atelier, i was about to find out every piece of sound to download, now there's a list :D

tulip lily
#

cite18 it has a lot of interesting sound that you can use in minigames

#

It even has vampire sounds

tulip lily
whole tide
mild sage
#

omg..

whole tide
#

they even have birds in there

open crypt
whole tide
#

what troll event tfm_OMG

tulip lily
#

lol

lone stream
lone stream
tulip lily
#

May be

#

But sounds like raining

mild sage
whole tide
#

Nice

tulip lily
#

Nice

obtuse latch
#

woah

hidden fjord
inland garnet
#

cool

whole tide
#

sound/music are really important element that makes the game more enjoyable

tulip lily
#

Yeah

#

I was missing that on minigames

tulip lily
#

I don't know if it's already like this, but being able to press space to continue with the dialogue would also be nice, in games I prefer to press space or enter to continue than clicking on the dialogue window

whole tide
#

yeah I agree with you

mild sage
tulip lily
#

@cobalt saffron space doesn't work in #aurora0poisson, with setWorldGravity you can get it working to freeze all the mice in place

#

they forgot to document the new function tfm_derp

mild sage
#

how to do if i have commands a b c in the image below which are executed in random order?
i hope u know what i mean

hidden trail
#

maybe you have to sfhfjfaff and sdfhfshgs

#

I assume you want this anyway

function callInRandomOrder(functions)
  table.sort(functions, function() return math.random() > 0.5 end)
  for i, f in next, functions do
    f()
  end
end

local functions = {a, b, c}
callInRandomOrder(functions)
lilac gulch
#

can you somehow detect that only on specific map function works?

tulip lily
#

Specify which map the function should work on? is possible with tfm.get.room.currentMap

#

If I'm not mistaken if it's vanilla maps currentMap will be -1 but common maps created by players will show up with the code in integer

lilac gulch
#

tysm 🙏

mild sage
#

I've always used fixed rotations or XML so I never looked up at it lmao

tulip lily
#

lol

#

In fixed rotations I think it still works but with XML it will be -1 too

tight spindle
#

how can i set two spawn points considering two teams

#

i mean, one team spawns on one side and the other team on the other side

mild sage
#

One single spawn in the center and instant teleport based on the team when new game starts

#

then on eventPlayerRespawn (if your player respawns), do the same

tight spindle
#

i will try, thank you!tfm_D

mild sage
tulip lily
#

Nice but bruh.. Did you change your mouse's image? >.>

mild sage
#

There was no image with centered space for the mouse to be visible

tulip lily
#

Hmm

#

I was surprised because the giant hole jumps like the mouse, so I thought you had replaced the image...

mild sage
#

how to detect player holding "x" key

tulip lily
#
system.bindKeyboard("+Bnpy#0000", 88, true, true)

function eventKeyboard(name, key, down, x, y)
  if (key == 88) then
    -- if down is true then the key is being pressed, if false then the key has been released 
  end
end
atomic thunder
#

can anyone help me how to lets players teleport to a place when they reach a certain number of players in the script

mild sage
# atomic thunder can anyone help me how to lets players teleport to a place when they reach a cer...

You need to track how much players are there. I'd recommend having two variables, one for total players and other for alive players. After that, you only have to check when a new player joins the total number of players, and if it exceeds the max value you set, you teleport them.

I'd also recommend to track if the Player was teleported through a table, so you don't teleport everyone each time a mouse joins the room.

local totalPlayers = 0
local alivePlayers = 0
local miceLimit = 5 -- How many mice are needed to teleport everyone
local playersToTeleport = {} -- Stores what players should be teleported

function eventNewGame() -- On eventNewGame everyone gets respawned so the alive players is equal to the total players
  alivePlayers = totalPlayers
end

function eventNewPlayer(playerName) -- Increase the total players when a new player joins
  totalPlayers = totalPlayers + 1
  tfm.exec.respawnPlayer(playerName)

  playersToTeleport[playerName] = true -- Player is added to the list

  if totalPlayers >= miceLimit then -- If the amount of players reach the limit you set, then...
    for Player, _ in pairs(playersToTeleport) do
      tfm.exec.movePlayer(Player, x, y) -- Move players pending to teleport to the desired coordinates
    end
    playersToTeleport = {}
  end
end

function eventPlayerDied(playerName) -- Decrease alive players if one dies
  alivePlayers = alivePlayers - 1
end

function eventPlayerRespawn(playerName)  -- Increase alive players when one respawns
  alivePlayers = alivePlayers + 1
end

function eventPlayerLeft(playerName) -- Decreases total players when one left the room
  totalPlayers = totalPlayers - 1
end

for playerName, Player in pairs(tfm.get.room.playerList) do -- Must call eventNewPlayer for players already in the room since it doesn't trigger automatically
  eventNewPlayer(playerName)
end
atomic thunder
#

tysm

slender oak
#

waiting for simon says module

silk hawk
trail oracle
#

woooo honk

tulip lily
# silk hawk

Nice, it's a shame that the npc image slips but quite interesting a battle system in mice

tall crane
#

i am using tfm lua well

#

i have made

#

spawns 50 balls in the center of the room and nothing else

mild sage
#

Nice start

#

Just don't do it in a loop hehe

tall crane
#

Now im trying to make my gamemode and cannot figure out how to turn off the shaman

#
tfm.exec.newGame("@7915328")

function eventNewGame()
tfm.exec.disableAutoShaman(true)
tfm.exec.addShamanObject(604,400,200,0,0,0,false)
end
mild sage
#

tfm.exec.disableAutoShaman(active)

tall crane
#

Thats in there

mild sage
#

oh

#

lmao

tall crane
#

I fixed it though

#

i had to put it at the top lmao

mild sage
#

Ah yes, it only works for the next round

#

So you disable auto shaman at the start of the new map, but it will only take effect after that map ends

tall crane
#

hm do objects not become nil when off the edge?

#

Just need to create a respawning object

mild sage
#

What do you mean?

#

Objects should despawn when they fall to void

#

However I think their ids stay in tfm.get.room.objectList

tall crane
#

Ah darn

#

How do i check if its despawned then? I couldnt find any functions for that

mild sage
#

When you use tfm.exec.addShamanObject it returns the object's id, so you can track which objects are spawned through a table

#

You can add a timestamp with a delay for the object and on eventLoop check the time and despawn them, even if they've reached the corner

local objectDespawn = {}

function SpawnBall()
  local delay = 3000 -- It's on milliseconds
  local id = tfm.exec.addShamanObject(6, 400, 200, 0, 0, 0, false)
  table.insert(objectDespawn, {id = id, timestamp = os.time() + delay})
  -- (os.time() + delay) means "The current time in milliseconds, plus the delay I've specified"
  -- This means, if we compare that timestamp with the current time, it will only be inferior if the current time is greater than the delay
end

function eventLoop()
  local index = 1
  local object
  while index < #objectDespawn do
    object = objectDespawn[index]
    if os.time() > object.timestamp then
      tfm.exec.removeObject(object.id)
      table.remove(objectDespawn, index)
    else
      index = index + 1
    end
  end
end
mild sage
#

I don't know if that's what you mean, if you need to check if a object is on the edges then you can access its values in tfm.get.room.objectList[id of the object].x and .y, and in eventLoop spawn/despawn them accordingly


local ball_id
function SpawnBall()
  return tfm.exec.addShamanObject(604, 400, 200, 0, 0, 0, false)
end

function eventLoop()
  if ball_id then
    local ball = tfm.get.room.objectList[ball_id]
    local shouldRemove = false

    -- This assumes the map is 800x400, but you can modify the values on the right according to your maps
    if ball then
      if ball.x < 0 or ball.x > 800 then
        shouldRemove = true
      elseif ball.y < -200 or ball.y > 400 then
        shouldRemove = true
      end
    else
      ball_id = nil
    end
 
    if shouldRemove then
      tfm.exec.removeObject(ball_id)
      ball_id = nil
    end
  else
    ball_id = SpawnBall()
  end  
end
tall crane
#

Not sure whats wrong here but i cant get the game to delete the object a shaman summons

tfm.exec.newGame(6)

for name,player in pairs(tfm.get.room.playerList) do
end

function eventSummoningEnd(playerName, objectType, xPosition, yPosition, angle, xSpeed, ySpeed, objectType, other)
tfm.exec.addShamanObject(54,xPosition,yPosition,angle,xSpeed,ySpeed,false)
tfm.exec.removePhysicObject(objectType.id)
end
mild sage
#

You have two objectType 👀

tall crane
#

It shows 2 on the wiki, which one do i remove?

#

figured it out
my function was wrong and i should use removeObject

mild sage
#

eventSummoningEnd ( playerName, objectType, xPosition, yPosition, angle, objectDescription)

objectType : the type of shaman object (i.e. ball, box, balloon)
objectDescription : a table with the object description as it would appear in the objectList

mild sage
tall crane
#

hey i can edit what i said completley too!

tall crane
#

now to quit goofing of and make a gamemode of sorts

#

which i will do tomorrow

#

as soon as i have an idea someone hasnt already done

#

(i was working on soccer before but someone already has) :(

tall crane
#

Dear God programming on a phone is atrocious

#

I can't even test my code

tall crane
#

tbh i dont even know what happened

tall crane
#

okay um

tall crane
#

i cant figure out how to select a random player and put their name in a variable

#

just once

#

figured it out

mild sage
#

Players in tfm.get.room.playerList are organised through associative indexes, for selecting a random element from a table it has to be a table of numerical indexes. So you have to iterate over playerList and insert each one with table.insert in a new table.

Then, to get a random member you pick a value from 1 to the amount of players

local pickPlayer = {}
for playerName, Player in pairs(tfm.get.room.playerList) do
  table.insert(pickPlayer, playerName)
end

local randomPlayer = pickPlayer[math.random(#pickPlayer)]
tall crane
#

Alright who wants to come play my lua thingy in my tribe house?

#

idk how to get the command for people to join tho

whole tide
#

/inv username#0000

tall crane
#

how do i turn off the stupid "3, 2, 1, go" with multiple people

#

or at least a way to change maps without newGame()

tall crane
#

ah well im working around it for my script

#

whats even more annoying is that it doesnt show up if there just one person

frozen timber
#

I have a new module idea

#

Module where everyone spawning at flat map, everyone is shaman and having skills. They are building and reviving if died

hidden trail
#

What are they supposed to build

frozen timber
#

anything they want

mild sage
#

Like that Build competition in Micecraft? Where you're asked to build some object with blocks and people vote for the most accurate construction

paper kraken
mild sage
#

Very enjoyable

tight spindle
#

😱

coral quartz
mortal ember
#

G e n i u s

mild sage
#

Credits to Mckeydown#0000

shrewd monolith
#

How can I increase the player's height?
in the tribal house

mild sage
#

tfm.exec.changePlayerSize(playerName, size)
size: between 0.1 (smol) and 5.0 (huge), being 1.0 normal and default size

shrewd monolith
#

where did i go wrong

covert sedge
#

"Tsunkeru#1367" mayb

shrewd monolith
#

this worked :))

#

thank you

lapis shale
#

For future reference - strings aka literal text require quotes around them, otherwise they are interpreted as the name of a variable

Since there isn't a defined variable with the name Tsunkeru#1637 and # isn't a legal character for variable names anyways, the script fails

covert sedge
tame granite
whole tide
#

amazing work and it is really helpful

mild sage
#

This is amazing, very good Lays

hidden trail
#

that's smth we really needed

covert sedge
lapis shale
#

Well, technically it isn't just MTs, but yeah, an indicator would be nice

lapis shale
#

You've got a little mistake there, FunCorps don't have access to file-related functions but do have access to everything else

tame granite
#

Thank you! It's corrected now.

grim citrus
#

what is the module

static meadow
#

what currency

whole tide
mild sage
frozen timber
mighty quartz
#

question: when will the pac-mouse funcorp module thing become official like parkour, unotfm, freezertag etc.?

static meadow
#

In my opinion some gamemodes should remain as funcorp specific modes, if it became official it would not have as many players as they do during funcorps since the playerbase is not big enough to fill all of its modules. Part of the fun is the large amounts of people in a funcorp room and by not being always available it retains that fun spark of "YES PACMOUSE ROOM"

mild sage
severe ledge
spice iris
#

pro

latent flower
mild sage
whole tide
#

Soon...

hidden trail
#

amazing

mortal ember
whole tide
woeful geyser
frozen patio
grim citrus
#

will the mouse roll like sonic or run

old mesa
#

Bonsoir

whole tide
mild sage
mild sage
#

🤨 🧐

wicked pumice
#

How can I make a quicksand floor that isn't as strong? tfm_sad

merry chasm
wicked pumice
whole tide
wicked pumice
#

What?

wicked pumice
#

Makes it not sink as fast

untold tulip
#

Tried to make a code to link 2 random mice with the command !link, failed hard

for name,player in pairs(tfm.get.room.playerList) do
table.insert(players,name)
end
function eventChatCommand(name,command)
if command=="link" then
tfm.exec.linkMice(Player1[math.random(#players)], Player2[math.random(#players)], true)
end
end ```
found a code to link mice but can’t add the text command in there…any ideas?
``` local players={}
table.foreach(tfm.get.room.playerList, function(n) players[#players + 1] = n end)
for i=1,#players do
if players[i+1] then
tfm.exec.linkMice(players[i],players[i+1])
end
end```
mild sage
#
function eventChatCommand(playerName, message)
  local args = {}
  local command
  for arg in message:gmatch("%S+") do
    args[#args + 1] = arg
  end
  command = table.remove(args, 1)

  if command == "link" then
    local mice = {}
      if #args > 1 then
        mice = args
      else
        for name, _ in next, tfm.get.room.playerList do
          mice[#mice + 1] = name
        end
      end

    if #mice > 1 then
      for i=1, #mice - 1 do
        tfm.exec.linkMice(mice[i], mice[i+1], true)
      end
    end
  end
end

Usage:
!link : Links all mice
!link a b c : Links a with b, and b with c. Can add more players

untold tulip
#

Wow, ty 🙂

mighty quartz
#

i need help finding 2 modules:

the 1st one: u need 2 players (or more idk) and try to avoid the shark on the side of the screen chasing u while running across
the 2nd one: there isnt an objective, u just run down a very long rainbow pathway which takes a few mins

mild sage
#

I think the 2nd one is #aurora0rainbow

mighty quartz
mighty quartz
rotund monolith
#

is it possible to send a chat message to the normal chat instead of lua chat in the tribehouse?

mild sage
#

Nope. It is only possible if you're FunCorp or Module Team

rotund monolith
#

Can you put multiline text in a text area?
This doesn't work:

    local str = 'Your size: ' .. self.size .. '\n'
    str = str .. 'test'
    ui.updateTextArea(1, str, playerName)
hidden trail
#

Textarea is too small to display the rest (you can scroll down tho)

mild sage
tulip lily
#

🤔 Tig could add a parameter to add scrollbar to the textarea, it would be more interesting and fluid than doing with the lua api

tulip lily
#

Yes lol, for the joy of some and the sadness of others.

#

I was curious to see how the community was

whole tide
#

mostly the joy for us all

tulip lily
whole tide
#

I have seen you help others and give tips for years

tulip lily
#

Yeah but I've been away for a while working on some stuff... Now I have a little more time to play and chat.

#

I'm currently thinking about becoming a bit more active in the Lua Transformice development community, I have a few ideas in mind.

whole tide
#

you know

#

maybe you should apply for MT

#

or event squad

#

making some events

tulip lily
#

Maybe, but my main idea is to help enrich developers' experience. I have a few things in mind for this.

#

For example, I know that many devs use a tool in python to be able to separate their minigames into different files and be able to put everything together in a single file, but that completely discards the feeling of modules that you have in regular Lua.

local module = require("./module")

module.doStuff()

A tool that allows you to package Lua modules would be more interesting.

#

You are also not able to test your module before playing in transformice and hope you don't have errors, it's something that needs to be fixed...

mild sage
#

I did some sort of script that can merge various files from different directories, assert whether or not the syntax is correct and execute some events to emulate a game initialization; it may not catch all bugs but it helps to detect some of them easily

It's not something big tho, I can share it if you need it

tulip lily
#

Hm, I'm thinking of making a tool in rust and creating an extension for VSCode. I intend to learn more about rust this would be a good project to help in this regard.

#

But yes, it would be very useful, I can study your code for inspiration

#

I intend to allow the standard lua syntax (require-return) and provide a way to test the main game events like eventKeyBoard and others. I even thought of making the tool initialize a local server to test the script in real time but that could be considered piracy despite not being playable in a multiplayer sense so I think it will be possible to just develop the debugger

#

Perhaps I could ask tig for permission to develop a super-limited local server only allowing testing Lua functions, but it is very likely that he will deny it.

rotund monolith
#

Is it possible to make someone look either right or left?

tulip lily
mighty quartz
mild sage
mighty quartz
#

aw ok if anyone knows whats its called pls lemme know :c

austere totem
mighty quartz
#

omg yes ty ^^

mild sage
#

HELP in utility how do i unadmin someone?

forest furnace
#

!unadmin [name] - Takes away admin rights from a player
!admin [name] - Grants a player admin rights ( admin rights can't be removed unless you type !unadmin [name] in the chatbox)

#

I hope it will help

rotund monolith
#

is it possible to disable confetti sounds or disable it altogether?

mild sage
#

You can't disable players' sounds through Lua, only by yourself on settings by clicking on the sign that looks like a musical note

ashen rover
cursive void
#

Yeah music note is sound effects, speaker icon is music. Makes total sense. At least the bell for notifications is reasonable.

ashen rover
#

Ever since i started playign i had sounds off 💀

tulip lily
#

I left the sound effects enabled and disabled only the music

whole tide
#

i enabled the sounds when they add sounds to modules

vale mist
#

Does anyone have the script of @merry parcel to do giveaways?

whole tide
#

are you asking the community or Ninguem 👀

mild sage
#

I think both

whole tide
#

there was old giveaway module made by an Arab dev

#

you can find it in the Arab module forums

whole tide
#

this and there is another one

low knoll
#

There is another one in portugese but i lost it.

vale mist
#

i copy from tfm 😐

storm bolt
#

Is LUA easier than JavaScript?

mild sage
#

Well

#

it depends

storm bolt
#

How about Java

#

Those are the only two I have good knowledge of

#

Java I learned in a course, and JS by myself when I didn’t know it was near useless

mild sage
#

Java is definitely harder than Lua. For JS vs Lua, it mostly depends on what do you want to focus, although JS is a bit higher level than Lua as it has more built-in functionalities

tulip lily
#

Both are dynamically typed languages ​​but JavaScript has a lot of boilerplate and a lot of features, while Lua lacks some features common in many languages ​​it has an syntax easy to understand and work with. JavaScript, on the other hand, was made to have backwards compatibility, which makes the language load a lot of old boilerplate and mix with current features.

mild sage
#

When Module API switching to Lua 5.4 and breaking 100% of Modules pls

tulip lily
#

Hardly, it will only happen if JIT upgrades to Lua 5.4

#

I don't think Tig would use a common version of Lua

mild sage
#

They don't even use LuaJit :sadge:

tulip lily
#

:v yes, and tfm uses

mild sage
#

It's LuaJ, regular Lua but written in Java instead of C

tulip lily
#

I don't think so, there is a mixture of Lua 5.1 and Lua 5.2 that only LuaJIT does

#

well, i'm not 100% sure only who can confirm that is Tig

mild sage
tulip lily
#

On the bright side, if MAPI goes to Lua 5.4 we will have constants using attributes

#

Hm

#
local foo<const> = "bar"

foo = "baz" -- assignment error
mild sage
tulip lily
#

Hmmm, yea, makes sense

hearty flint
#
whole tide
hearty flint
#

hello 🥰

tulip lily
#

forget it, Roblox really did a good job with Luau

#

It would be interesting to have this as a module api although it might break all modules :v

hearty flint
#

tig could add "script versions"

#

the current modules run on the old API version, and the new ones can use the new API

mild sage
#

That would be unsustainable for many Module developers

tulip lily
hearty flint
#

Why

mild sage
#

also there are many scripts used by people and they're written on the current version

#

Suddenly 2/3 of scripts ever made have to be rewritten

#

well actually that's a bit dramatic lmao but the amount of scripts affected would be important

tulip lily
#

Yup, the versioning issue is that it would complicate something that should be simple, at least on the server side. It's easier for Tig to take a recent version and do its best to make compatible with current scripts, so devs have to deal with very few changes.

#

Imagine if there was a different bug in each version, Tig would have to maintain each version, and for each version of Lua the code changes a lot at some point, Lua 5.4 is already almost completely different from Lua 5.1 [ talking about source-code of Lua in C, not the language itself ]

#

Lua 5.4 supports a lot of Lua 5.1, the difference is in small changes in the syntax, addition of attributes and removal/addition of some functions besides the addition of bitwise operators and the builtin utf8 table of lua 5.3

#

Poor Fofinhoppp to rewrite MyCity lol, as far as I know his code went from 10k lines

lone stream
#

Hii @mild sage how do i use your Lua events in the tribe?

mild sage
lone stream
#

I want to play your events too, please

rotund monolith
#

Is it possible to tell whether an object was spawned by the map or by a shaman? Even if a shaman object was spawned by the map, eventSummoningEnd still gets called with playerName of either the shaman or the person who ran the script

mild sage
rotund monolith
#

thanks!

tulip lily
#

What if the module spawns 11k objects? will the id go from 11k or reset to 200?

tulip lily
#

Perhaps the api should have a property on the table that declares the object's invocation mode invokedBy module, shaman, map

mild sage
tulip lily
#

10 objects each 500 ms...

#

and would despawn soon after

#

It could even be 25 every 500ms

#

A regular module wouldn't do that, but what if the module was played in a room for 5 hours spawning objects on the same map?

storm bolt
tulip lily
#

Commands? Functions are functions, there's no commands. And yes, all languages ​​have built-in (pre-made/native) functions.

#

The differences lie in their syntax, application and features.

rotund monolith
# tulip lily What if the module spawns 11k objects? will the id go from 11k or reset to 200?

The ID will continue to go up past 11000, and if you try to summon anything (the game will try to summon an object with an id that is already occupied) the game will freeze until you let go of the mouse button, and if you hold it for long enough you will see that a count will appear on the object in the shaman menu that goes down very quickly and when it hits 0 you will run out of the objects (which proves that you don't actually have infinite objects, there is a limit how many you have, you just don't see it if the count is high enough)

#

The limit of objects is 100, and the count will be visible if the count is below or equals 20, this can be noticed in normal gameplay too, if you spam arrows, for example

tulip lily
#

Interesting

#

I expected something like this to happen, but I didn't know that a counter would appear.

mild sage
#

You can now run The Orchestra Lua Event on your tribehouses.

/module evt_music

tulip lily
#

Hm, events can now be run using the evt_ prefix?

mild sage
#

Lua Events are modules internally. Yes, they have the prefix evt_ but most of the time they get into a Disabled level (like archived, can't run with /module) instead of (semi-)official. It depends on each Event and its coder

tulip lily
#

Got it, interesting

whole tide
mild sage
#

🤔

#

Oh, I have to disable one setting

lapis shale
rotund monolith
#

I mean the limit of a particular object that a shaman can spawn

mild sage
#

Players are handled differently, so they are not included on that count

mild sage
whole tide
vagrant hollow
#

Can I try the new event "Hoppy Chinese New Year" in tribe house ?

mild sage
#

Only when the event ends

tulip lily
lone stream
mild sage
#

Somewhere in the Abyss of Archived Modules

lone stream
mild sage
#

I can't make others people events available as I was not the main programmer of these, you have to contact each one of them if you want their events to be playable on Tribehouses

lone stream
mild sage
#

I did three events, two in collaboration with Drgenius. The Nightmares Hunt I'd say is mostly him, because he was the host and did around 3/5 of the code. If you want to play that one, you should ask him ^^

The Music Event was done as well with him, but I was the host and we agreed to make it publicly available

and the current one running, which I can't make available yet

indigo flower
#

New Module Soon!

untold tulip
#

Hey, is there a way to pickup the cheese and not to die at the bottom of the long vertical map?

||MAP='<C><P H="40000" MEDATA="1,1;;;;-0;0:::1-"/><Z><S><S T="10" X="411" Y="39950" L="1127" H="93" P="0,0,0.3,0,0,0,0,0"/><S T="15" X="425" Y="39292" L="924" H="159" P="0,0,0,0,0,0,0,0"/></S><D><DC X="426" Y="134"/><F X="421" Y="39763"/><P X="240" Y="160" T="160" P="0,0"/><P X="560" Y="885" T="160" P="0,0"/><P X="255" Y="1620" T="160" P="0,0"/><P X="600" Y="2575" T="160" P="0,0"/><P X="220" Y="3520" T="160" P="0,0"/><P X="630" Y="4640" T="160" P="0,0"/><P X="225" Y="5505" T="160" P="0,0"/><P X="610" Y="6475" T="160" P="0,0"/><P X="195" Y="7655" T="160" P="0,0"/><P X="600" Y="8920" T="160" P="0,0"/><P X="260" Y="10130" T="160" P="0,0"/><P X="675" Y="11650" T="160" P="0,0"/><P X="160" Y="13175" T="160" P="0,0"/><P X="545" Y="14610" T="160" P="0,0"/><P X="330" Y="16180" T="160" P="0,0"/><P X="775" Y="17720" T="160" P="0,0"/><P X="160" Y="18665" T="160" P="0,0"/><P X="695" Y="20585" T="160" P="0,0"/><P X="215" Y="22400" T="160" P="0,0"/><P X="680" Y="24195" T="160" P="0,0"/><P X="280" Y="25835" T="160" P="0,0"/><P X="595" Y="27615" T="160" P="0,0"/><P X="280" Y="29345" T="160" P="0,0"/><P X="650" Y="31175" T="160" P="0,0"/><P X="145" Y="33225" T="160" P="0,0"/><P X="645" Y="34955" T="160" P="0,0"/><P X="235" Y="36805" T="160" P="0,0"/><P X="685" Y="38440" T="160" P="0,0"/><P X="230" Y="39525" T="160" P="0,0"/><P X="550" Y="39075" T="160" P="0,0"/><P X="230" Y="38755" T="160" P="0,0"/><T X="415" Y="188"/><DS X="392" Y="122"/></D><O/><L/></Z></C>' tfm.exec.newGame(MAP)||

rotund monolith
# untold tulip Hey, is there a way to pickup the cheese and not to die at the bottom of the lon...

The game probably stores your coordinates as 2-byte signed integers (limit 32767), and after it reaches more than 32767, it will go into the negatives and it will cause bugs, so your best bet is to keep your map height below that.
What's interesting is that your player position from tfm.get.room.playerList can be above 32767, however any event that you cause will say that your position is negative, and the game kills you if you're too high up too.

inner carbon
#

the lua position is in fact transmitted as a signed short, but lua is a different vm that's running in the server

#

for some reason there are some... weird mechanics that happen in the server code

#

such as the server actually storing your position as a signed integer (4-byte) but sending it to lua as a signed short (2-byte)

#

such as in an event, like eventKeyboard, as the client itself sends your position for that specific event as a signed short

#

it's as i said, some weird mechanics

#

movePlayer sends both the position and velocity as shorts

inner carbon
#

so what they did was to just trigger movePlayer multiple times and playing with the offset

#

as the new position is calculated in the client side, you can just say "move to y 32767" and then just say "add 5000 to your y position", effectively teleporting past the 32767 limit

mild sage
mild sage
#

"As bombinhas são super altas e tem um pavio muito curto! Eu não os deixaria bravos se fosse você!"

#

isso não tem sentido em português

#

"Firecrackers are super loud and they have a really short fuse! I wouldn't make them mad if I were you!"

#

loud = barulhento, não alto

#

@hexed rock perguntando pra um event squad br...

#

mas qm faz as traduções dos eventos?

hexed rock
#

Obrigado pelo toque

#

mas acho que traduziram pra alto pelo barulho ser alto, mas faz mais sentido como barulhento mesmo

tulip lily
#

Eu acho que poderia ser "As bombinhas são barulhentas e de pavio curto! Eu não as irritaria se fosse você!"

solid light
static meadow
mild sage
#

What is this module?

whole tide
#

new minigame called Soinc The Mouse

#

still in test phase

mild sage
#

Thank you.

grim citrus
#

@whole tide tell me next time

#

looks so cool

whole tide
#

ofc

#

we can ask @halcyon arrow or @tame granite to host another test room or a real funcorp

mild sage
#

Lua Event Hoppy Chinese New Year is now available to be played on Tribe houses.

/module evt_hoppy_cny

tulip lily
#

Hm, could tig make a command like /modulelist where it shows all available modules in the tribe including events? It would be easier to have a whole list ready to go

static meadow
#

you can do /module to show all available public modules but I think that command doesn't show event modules

tulip lily
#

It doesn't, and it also doesn't show all the modules, only the official ones if I'm not mistaken

#

But in this case it would be better to update /module than to create a new command. I just wanted to add context to the suggestion.

mild sage
tulip lily
#

not in the chat... interface, preferably one that has buttons to visit the official rooms if available or run in tribe house

mild sage
#

🥺 I wish we had our own interface for searching Modules

whole tide
tulip lily
#

Hmm, what is this Pshy lib? I've never seen this before, looks interesting

sweet mauve
nova iris
#

Hi, does anyone have a discord creator of freezertag?

#

Or maybe server

tulip lily
#

Just because I was programming it went into maintenance ;-;

#

Tig could fix the __len metamethod, it would be very useful #table not return 0

tulip lily
tulip lily
shut wolf
#

Update on #basketball:
The bug with the ball power is due to a bug in the new Transformice update. I've released a temporary hotfix in the meantime, but the ball seems to be behaving strangely still. There's not much more I can do about this until the TFM bugs are fixed, sorry!

urban mountain
#

Can someone reset the football module? Something weird happens when shooting the ball and it's been like this for ~3-4 days now.

shy ridge
#

The #basketball module has been facing some bugs recently after the update that occured on 3/2/2023, it experienced anormal ball speed when released, but I believe Drgenius fixed that however there's still another bug which is the ball disappears when you release it, this isn't normal and should be immediately fixed, although we also hope that the Leaderboard is brought back after this matter is settled @shut wolf

mild sage
#

Will be fixed on Thursday

#

for all modules

frozen timber
#

please return chess module

shy ridge
#

modules are still bugged 💀

#

how funny that modules are given no f's about whilst they are literally the most played out of the gamemodes that you have including vanilla 😭

halcyon arrow
#

You can temporarily fix scripts you run manually by adding this snippet at their very beginning:

local incorrect_tfm_exec_movePhysicObject = tfm.exec.movePhysicObject
tfm.exec.movePhysicObject = function(id, x, y, pos_offset, vx, vy, speed_offset, ...)
    return incorrect_tfm_exec_movePhysicObject(id, x, y, pos_offset, (vx or 0) / 10, (vy or 0) / 10, speed_offset, ...)
end
shy ridge
#

Tig's intervention is needed lol

shut wolf
#

Yeah, objects seem to disappear when moving them. Not sure if this is the same bug, but it's likely related since it was a much more rare occurrence before. Likely has to do with synchronization

shy ridge
shut wolf
#

I will keep investigating. So far I have no idea what could be causing the disappearing bug. None of the code has changed since before this was an issue

shy ridge
#

much appreciated if it's as soon as possible, also try to work on bringing back the leaderboard

tulip lily
shy ridge
#

@halcyon arrow all modules that have moveObject aren't working properly anymore whenever you shoot the ball it's like ten times more force it goes to the sky, this happens in #football and #basketball, let us know if you can help figure out how the ball still disappears in basketball after applying a hotfix

halcyon arrow
# shy ridge <@298878496099401749> all modules that have moveObject aren't working properly a...

I tested moveObject and it seems to not have changed (my modules using it didnt have their behavior changed).
On the other hand, movePhysicObject had its behavior altered, it now moves ground 10 times faster than before.

However, this is now coherent (previously the speed unit of both functions was different, now it is the same).

The ball in #basketball may actually not be a ball but a ground, so it's affected by this change.

However after testing some cases, it appears using strings as ids for grounds instead of integers can cause grounds to disappear.
As for why the "ball" disappear, i do not have access to the source code of the module, so idk if this is what they are doing.

I updated my snippet to fix this if this is the reason.

shut wolf
#

It's a shamanObject with an image attached

#

This week is very busy for me, but I'll look into it more when I get the chance. Thanks for the info!

shy ridge
#

💀

shut wolf
#

The #basketball ball de-spawning bug should be fixed now!

shy ridge
urban mountain
#

is there any indication on when the football module will be fixed?

whole tide
#

switch to #Soccer

frozen timber
#

module of wizard

#

cool module

whole tide
#

Wiz is a talented games maker, I always loved his minigames and modules

hidden trail
#
-- Define some constants for the arrow's speed and lifetime
local ARROW_SPEED = 300
local ARROW_LIFETIME = 2000

local arrows = {}

function shootArrow(playerName, x, y)
  -- Calculate the arrow's velocity based on the player's current position and the mouse cursor's position
  local mouseX, mouseY = tfm.get.room.mouseX, tfm.get.room.mouseY
  local dx, dy = mouseX - x, mouseY - y
  local distance = math.sqrt(dx^2 + dy^2)
  local vx, vy = dx/distance * ARROW_SPEED, dy/distance * ARROW_SPEED
  
  -- Create a new arrow object with the calculated velocity and add it to the arrows table
  local arrow = {x = x, y = y, vx = vx, vy = vy, lifetime = ARROW_LIFETIME}
  table.insert(arrows, arrow)
end

-- Register the function to the space bar key event
tfm.exec.bindKeyboard("space", true, true)

-- Define the update loop that will be called every frame
function update()
  -- Iterate over all active arrows and update their positions based on their velocities
  for i, arrow in ipairs(arrows) do
    arrow.x = arrow.x + arrow.vx * tfm.get.room.deltaTime
    arrow.y = arrow.y + arrow.vy * tfm.get.room.deltaTime
    
    -- Decrease the arrow's lifetime and remove it from the arrows table if it has expired
    arrow.lifetime = arrow.lifetime - tfm.get.room.deltaTime
    if arrow.lifetime <= 0 then
      table.remove(arrows, i)
    end
  end
  
  -- Draw all active arrows on the screen
  for _, arrow in ipairs(arrows) do
    tfm.exec.displayProjectile(1, arrow.x, arrow.y, arrow.vx, arrow.vy)
  end
end

-- Register the update loop to the tfm event loop
tfm.exec.setRoomStickiness(false)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disablePhysicalConsumables(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.setGameTime(0)

-- Register the shootArrow function to the space bar key event
tfm.exec.addPhysicalButton(" ", 0, 0, 20, 20, "shootArrow")
#

(it doesn't work ofc but crazy how it still knows some of the methods

#

idk what is room stickineess tho lmao??

open crypt
#

I actually like that idea, lol!

#

Is that the new AI?

hidden trail
#

yea, chatgpt

mild sage
#

tfm.get.room.deltaTime

tulip lily
#

Stickness would be something like setGravity tho?

#

tfm.exec.setWorldGravity(20)

hidden trail
#

yup + wind

flat vergeBOT
#

Extremq#0000 has decided to retire from the Module Team.

shy ridge
#

!setscore [red-blue] does not work in #basketball and also some other commands @shut wolf + leaderboard isnt back yet

grave ember
#

hello, can someone help me on a little lua thing

#

how can i add a handler or smt that reads if a player presses a button

#

for example, like in bootcamp, i want to add a hotkey for /mort, which is g

grave ember
#

okay i found a way to get a key input but now idk what numeric code to use to read the key g

grave ember
#

okay i found the way

#

the way

#

i did it

#

idk what the g, x and y stand for in the eventKeyboard function

#

i put g at first thinking it would get the key from somewhere but it doesnt do anything apparently

glad dust
mild sage
#

No developer for Mycity

#

@grave ember en el foro de ES hay un hilo que tiene todos los códigos de las teclas

#

tmb esta la documentación que actualizo frecuentemente

glad dust
#

Ohhh/:

indigo flower
#

Hello everyone
⚽ The background in **#soccer **has been updated.
||If I know you, enter #soccer and try to find yourself in the background.||

halcyon arrow
# grave ember i put g at first thinking it would get the key from somewhere but it doesnt do a...

You can find a list of key codes here: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/ui/Keyboard.html

eventKeyboard's arguments in order are:

  • the player name (player)
  • the key code (key)
  • whether the key was pressed down or up (a boolean, you called it g, you may call it down)
  • x coordinate where the key was pressed
  • y coordinate where the key was pressed
  • speed the player had over the x axis
  • speed the player had over the y axis

You can type /luahelp in-game to display documentation.
Documentation from the forum (may not be as up to date): https://atelier801.com/topic?f=6&t=781139

limber star
#

34mice on pk? tfm_derp

grim citrus
whole tide
#

False, I'm no such thing

grim citrus
#

right you’re a chicken I forgot

indigo flower
#

but from another point of view i'm younger than you tfm_derp (16 years old)

whole tide
#

Thank you, but you see, age has nothing to do with creativity. Also without the help of my friends Pshy, Lays and others I would have never been able to make any game.

vagrant hollow
#

Hey guys, I wrote a code which is: There is an image, if you are near it and press S, it will disappear.
The problem is that the image disappears for me and for others as well. So I wanted it to disappear for me only when I press S, and disappears for them only when they press S.
This is an example of the code:

#

Can anyone solve my problem please ?!

hidden trail
# vagrant hollow Hey guys, I wrote a code which is: There is an image, if you are near it and pre...
a = tfm.exec.addImage("177fc344c1b.png", "_1", 2980, 435, nil, 0.8, 0.8, 0, 1, 0.5, 0.5)

function eventKeyboard(name, keyCode, down, x, y)
    if keyCode == 3 then
        for playerName in next, tfm.get.room.playerList do
            if (tfm.get.room.playerList[playerName].x) >= 2950 and (tfm.get.room.playerList[playerName].x) <= 3010 then
            if (tfm.get.room.playerList[playerName].y) >= 405 and (tfm.get.room.playerList[playerName].y) <= 465 then
                tfm.exec.removeImage(a, name)
            end
            end
        end
    end
end

for playerName in pairs(tfm.get.room.playerList) do
    tfm.exec.bindKeyboard(playerName, 3, true, true)
end

I didn't test but should work. You can specify a specific person to hide the image (tfm.exec.removeImage(imageID, playerName)

vagrant hollow
#

didn't work

#

It still disappears from their screen after I pressed S

#

@hidden trail

hidden trail
#

oh yeah i see why now

#

I editted the code try it out now

#

Also you don't really need to loop through the player list to check the coordinates, just checking the coordinates of the person that pressed the key is enough

a = tfm.exec.addImage("177fc344c1b.png", "_1", 2980, 435, nil, 0.8, 0.8, 0, 1, 0.5, 0.5)

function eventKeyboard(playerName, keyCode, down, x, y)
    if keyCode == 3 then
            if (tfm.get.room.playerList[playerName].x) >= 2950 and (tfm.get.room.playerList[playerName].x) <= 3010 then
            if (tfm.get.room.playerList[playerName].y) >= 405 and (tfm.get.room.playerList[playerName].y) <= 465 then
                tfm.exec.removeImage(a, playerName)
            end
            end
    end
end

for playerName in pairs(tfm.get.room.playerList) do
    tfm.exec.bindKeyboard(playerName, 3, true, true)
end
vagrant hollow
#

I will try it

#

still disappears..

#

@hidden trail

hidden trail
#

really

vagrant hollow
#

I tried alot of things to solve it and still

#

even your code didn't work

hidden trail
#

well that's odd, maybe it's the time to log into tfm and test it myself without being lazy

#

oh sorry turns out you cant actually remove an image for a specific person

local imgIds = {}


function eventKeyboard(playerName, keyCode, down, x, y)
    if keyCode == 3 then
            if (tfm.get.room.playerList[playerName].x) >= 2950 and (tfm.get.room.playerList[playerName].x) <= 3010 then
            if (tfm.get.room.playerList[playerName].y) >= 405 and (tfm.get.room.playerList[playerName].y) <= 465 then
                tfm.exec.removeImage(imgIds[playerName])
            end
            end
    end
end

for playerName in pairs(tfm.get.room.playerList) do
    tfm.exec.bindKeyboard(playerName, 3, true, true)
    imgIds[playerName] = tfm.exec.addImage("177fc344c1b.png", "_1", 2980, 435, playerName, 0.8, 0.8, 0, 1, 0.5, 0.5)
end
``` @vagrant hollow try this one out?
vagrant hollow
#

It worked, thanks!

#

@hidden trail

hidden trail
#

np! :D feel free to ask if you have any question

vagrant hollow
#

So if I want to add another image with the same concept (press S to disappear), how can I do that without making the first image disappears also when I want to disappear the new one?

#

@hidden trail

hidden trail
#

You can pretty much do like the same thing with a liiitle bit of altering here and there.

local imgIds = {}


function eventKeyboard(playerName, keyCode, down, x, y)
    if keyCode == 3 then
            if (tfm.get.room.playerList[playerName].x) >= 2950 and (tfm.get.room.playerList[playerName].x) <= 3010 and (tfm.get.room.playerList[playerName].y) >= 405 and (tfm.get.room.playerList[playerName].y) <= 465 then -- i simplified it here
                if imgIds[playerName] then tfm.exec.removeImage(imgIds[playerName][1]) end
            end
            if coordinateCheckforOtherImage then
                if imgIds[playerName] then tfm.exec.removeImage(imgIds[playerName][2]) end
            end
             if coordinateCheckforotherotherImage then
                if imgIds[playerName] then tfm.exec.removeImage(imgIds[playerName[3]) end        
            end
    end
end

for playerName in pairs(tfm.get.room.playerList) do
    tfm.exec.bindKeyboard(playerName, 3, true, true)
    if not imgIds[playerName] then imgIds[playerName] = {}
    imgIds[playerName][1] = tfm.exec.addImage("177fc344c1b.png", "_1", 2980, 435, playerName, 0.8, 0.8, 0, 1, 0.5, 0.5)
    imgIds[playerName][2] = tfm.exec.addImage("your other image")
    imgIds[playerName][3] = tfm.exec.addImage("your other other image")
    imgIds[playerName][4] = tfm.exec.addImage("your other other image")
end

But as you can see this might get messy if you keep adding more and more. So inthat case I'd handle this in a completely different way. I can do that for you aswell but not now

vagrant hollow
#

I wanted to add 14 images in total

hidden trail
#

oh i see, then you could also give a try for the other method I told you (which I'd explain). Or you can just carry on like this aswell if you want to

vagrant hollow
#

But the other images will have different x, y

#

so will it work ?

hidden trail
#

yeah you will have to do the what you did with the previous image for the new images

vagrant hollow
#

if (tfm.get.room.playerList[playerName].x) >= 2950 and (tfm.get.room.playerList[playerName].x) <= 3010 and (tfm.get.room.playerList[playerName].y) >= 405 and (tfm.get.room.playerList[playerName].y) <= 465 then -- i simplified it here
if imgIds[playerName] then tfm.exec.removeImage(imgIds[playerName][1]) end
end

should i repeat that or this

if coordinateCheckforOtherImage then
if imgIds[playerName] then tfm.exec.removeImage(imgIds[playerName][2]) end
end

hidden trail
#

just replace coordinatecheckforotherimage with the new coordinates

vagrant hollow
#

coordinatecheckforotherimage, do you add "other" to the code ?

#

otherother?

#

If you're tired of explaining, just send a full code. Then I will imitate what you did.

hidden trail
#
-- just put your image data here
local images = {
  ["177fc344c1b.png"] = {"_1", 2980, 435, 0.8, 0.8, 0, 1, 0.5, 0.5, startX = 2950, stopX = 3010, startY = 405, stopY = 465 },
  ["otherImage.png"] = {...}
}

local playerImages = {}

function eventKeyboard(playerName, keyCode, down, x, y)
  local player = tfm.get.room.playerList[playerName]
  if keyCode == 3 then
    for imageID, imageData in next, images do
      if player.x >= imageData.startX and player.x <= imageData.stopX and player.y >= imageData.startY and player.y <= imageData.stopY then
        tfm.exec.removeImage(playerImages[playerName][imageID])
      end
    end
  end
end

for playerName in pairs(tfm.get.room.playerList) do
    tfm.exec.bindKeyboard(playerName, 3, true, true)
    playerImages[playerName] = {}
    for imageID, imageData in next, images do
      playerImages[playerName][imageID] = tfm.exec.addImage(imageID, imageData[1], imageData[2], imageData[3], playerName, imageData[4], imageData[5], imageData[6], imageData[7], imageData[8], imageData[9])
    end
end

or you can try something like this, just put your image data on top and the code will manage the rest

#

again i was lazy and didnt test so hope it works

#

lol

vagrant hollow
#

The concept worked well (The image disappear from my screen only when I press S) but only the last image
in "local images = {}" appears on the map when the room starts.

#

@hidden trail

hidden trail
#

can you send your code here or in me dms so i can test aswell

vagrant hollow
hidden trail
#

oh ya i see, i thought they are going to be different images

local images = {
  {"177fc344c1b.png", "_1", 100, 300, 0.8, 0.8, 0, 1, 0.5, 0.5, startX = 70, stopX = 130, startY = 270, stopY = 330},
  {"177fc344c1b.png","_2", 200, 300, 0.8, 0.8, 0, 1, 0.5, 0.5, startX = 170, stopX = 230, startY = 270, stopY = 330},
  {"177fc344c1b.png", "_3", 300, 300, 0.8, 0.8, 0, 1, 0.5, 0.5, startX = 270, stopX = 330, startY = 270, stopY = 330}
}

local playerImages = {}

function eventKeyboard(playerName, keyCode, down, x, y)
  local player = tfm.get.room.playerList[playerName]
  if keyCode == 3 then
    for imageID, imageData in next, images do
      if player.x >= imageData.startX and player.x <= imageData.stopX and player.y >= imageData.startY and player.y <= imageData.stopY then
        tfm.exec.removeImage(playerImages[playerName][imageID])
      end
    end
  end
end

for playerName in pairs(tfm.get.room.playerList) do
    tfm.exec.bindKeyboard(playerName, 3, true, true)
    playerImages[playerName] = {}
    for imageID, imageData in next, images do
      table.insert(playerImages[playerName], tfm.exec.addImage(imageData[1], imageData[2], imageData[3], imageData[4], playerName, imageData[5], imageData[6], imageData[7], imageData[8], imageData[9], imageData[10]))
    end
end
vagrant hollow
#

@hidden trail

#

It worked.

#

Thanks for your patience, I appreciate that!

hidden trail
#

yeeee

mild sage
#

King best Lua dev

quick latch
#

Hey, I would like to know how exactly to use the eventTalkToNPC function? I want to make my NPC talk once someone clicks on it, but I´m not sure how to implement it... Since once I tried, it gave back an error (Init Error : Lorenzzo#9356.lua:216: attempt to call nil) and I´m not quite sure on how to do the whole strings, etc thing. I have this bit ready:

local look = tfm.get.room.playerList["Lorenzzo#9356"].look

local npcDef = {
title = 558,
look = "165;0,0,0,0,60_fa1919+ff0000+2305ff+900f31+20310+de2c2c+2b04b8+ff0000+fa1919+ffffff,130_bd1010+ff3041+2b04b8+de2c2c+fa1919+6f3131+2305ff,4_3700ff+bf0c0c,108_ff0000+2b04b8+ffffff,0",
x = 60,
y = 163,
female = false,
lookAtPlayer = true,
interactive = true,
}

                    tfm.exec.addNPC("Lorenzzo#0000", npcDef, nil)

But I´m not sure what to do from there. I´d really appreciate some help :)

mild sage
#

what's the line 216?

vagrant hollow
quick latch
vagrant hollow
mild sage
#

You can consult the API docs (through forums or /luahelp command) every time you are wondering to do something in your script, most of the time you can find the functionality there

#

Unless is outdated

#

it probably is

#

welp

quick latch
#

thanks a lot for the help :)

indigo flower
#

Squid-Game-TFM Funcorp_script Comming Soon... m_shock

vagrant hollow
#

Hello guys, I wanted to make a timer and decrease its value every 500ms after pressing a button ,using eventLoop. But the code didn't work for some reason.


ui.addTextArea(101, "<font size='14'><p align='center'><font color='#ffffff'>Timer: "..timer, nil, 200, 100, 200, 20, 0x000000, 0x010000, 0, true)
ui.addTextArea(102, "<font size='14'><p align='center'><font color='#ffffff'><a href='event:example'>Button</a>", nil, 200, 140, 200, 20, 0x000000, 0x010000, 0, true)

function eventTextAreaCallback(textAreaID, playerName, callback)
    if textAreaID == 102 then
        function eventLoop()
            timer = timer - 1
            ui.addTextArea(101, "<font size='14'><p align='center'><font color='#ffffff'>Timer: "..timer, nil, 200, 100, 200, 20, 0x000000, 0x010000, 0, true)
        end
        print("Success")
    end
end```
Fix it please.
mild sage
#

You can't declare your events like that, events get evaluated at init and are immutable so you can't override them in runtime. That means that they will only apply when your script is loading, not when it is already running.

In case you're having just a single timer, you can add a boolean when clicking textArea 102 and check if that boolean is set to true on your eventLoop, to substract 1 from your Timer.

local timer = 60
local isTimerActive = false

ui.addTextArea(101, "<font size='14'><p align='center'><font color='#ffffff'>Timer: "..timer, nil, 200, 100, 200, 20, 0x000000, 0x010000, 0, true)
ui.addTextArea(102, "<font size='14'><p align='center'><font color='#ffffff'><a href='event:example'>Button</a>", nil, 200, 140, 200, 20, 0x000000, 0x010000, 0, true)

function eventTextAreaCallback(textAreaID, playerName, callback)
    if textAreaID == 102 then
        isTimerActive = true
        print("Success")
    end
end

function eventLoop()
    if isTimerActive then
        timer = timer - 1
        ui.addTextArea(101, "<font size='14'><p align='center'><font color='#ffffff'>Timer: "..timer, nil, 200, 100, 200, 20, 0x000000, 0x010000, 0, true)
    end
end

I guess you want to make something happen whenever the timer reaches 0 but you can add that by yourself under the timer condition in eventLoop. However if you need more than one timer then you need a whole Timer class to manage all of them

tulip lily
#
function eventNewGame()
  _G["eventLoop"] = print
end

tfm.exec.newGame(0)

Just a test snippet

#

Just a PS: functions are block-scoped so that's why declaring eventLoop inside another function doesn't work, but using the global object to declare does, unless Tig changed the behavior.

mild sage
#

That will not work if the call isn't registered on Init, at least that's what happened when I tried it.

The event call will suffer some form of "optimization" and "caching" once Init finishes and you won't be able to overwrite it. They are registered on the server after all the script is evaluated and get called from there, they do not access the _G environment.

local counter = 0

local a = function()
    print("a")
end

local b = function()
    print("b")
end

function eventKeyboard()
    print("init")
end

function eventLoop(e)
    counter = counter + 1
    if counter == 10 then
        print("switching to b")
        _G["eventKeyboard"] = b
    elseif counter == 5 then
        print("switching to a")
        _G["eventKeyboard"] = a
    end
end

system.bindKeyboard("Indexinel#5948", 32, true, true)

If you press space, you will see that even after the counter reaches 5 or 10, the only function that will execute will be the one defined at initialization

#

It would be cool to change the behavior on runtime tho

tulip lily
#

Oh yes, in that case it makes sense, the tests I did are static so it's considered pre-runtime.

#

Like an event emitter can be done easily, although not necessary.

#
tfm.events:on("Keyboard", function()
  print("first call")
  tfm.events:off("Keyboard")
  tfm.events:on("Keyboard", print)
end)

Is it possible to do something like this if you create an event system, I didn't implement it because I'm not at home

#

But honestly I never found a use for an event system in tfm, like, why change the behavior of an event for all players?

#

Unless you're making something like Bolo or Mistens, creating a minigame with several minigames embedded. In that case it makes sense.

tulip lily
mild sage
#

Yeah, it's mostly about when you have a main game and several mini-games, although Bolo's or Minstens' systems are more focused on preventing the Module to crash hard and instead send a log report. In most cases, the Module host won't be connected and if the Module has an unprotected call that produces an error, it will stop the whole thing without the host being able to check any logs.

Event handlers have other specific uses, -not only on TFM, but on any game- when you want different things to happen when a player is in different locations or under certain circumstances, without creating a mess of spaghetti code.

vagrant hollow
#

#modules How can I disable player's W, A, S and D? So if he wants to move, he won't.

indigo flower
vagrant hollow
#

Oh thx!

frozen timber
#

Flood module

lone stream
whole tide
abstract rivet
#

omg yes

mossy plank
#

Micepoly incoming!

frozen timber
vagrant hollow
#

#modules How can I count the number of players in the room and make something happen when the number is 0?

open crypt
#

But to count the players in the room: tfm.get.room.uniquePlayers

lapis shale
#

Is it now a publicly accessible variable? I recall it returned nil both with FunCorp elevation and without it

mild sage
#

It's only available for Module Team and Lua Events as it is only relevant when counting players for saving stats

#

And you can pretty much know if someone is an alt or not with it so...

tulip lily
#

You can still count the number of players by creating some counting method, although I would prefer Tig fix the __len metamethod so #table doesn't return 0 when tables isn't empty. (I mean, come on, in Lua 5.1 it's super easy to fix this language bug by compiling your own version, imagine using a Java interpreter, just modify it)

mild sage
#

It's better to use uour own counting method, as player list won't update properly or fast enough in many cases

vagrant hollow
spiral lake
#

hi anyone knows if there is a way to have custom textures in game?

mild sage
# vagrant hollow True, but I still confused about finding a method

You only need to preserve a variable and keep adding or removing players through eventNewPlayer and eventPlayerLeft.

local totalPlayers = 0 -- At the start of your script

-- ...

function eventNewPlayer(playerName)
  totalPlayers = totalPlayers + 1
end

function eventPlayerLeft(playerName)
  totalPlayers = totalPlayers - 1
end

-- eventNewPlayer won't trigger for players in room already, so we need to trigger it manually.
for playerName, playerData in next, tfm.get.room.playerList do
  eventNewPlayer(playerName)
end
vagrant hollow
mild sage
#

You need to trigger eventNewPlayer manually for every player at init. I've edited the code to show that ^^

#

You can also keep similar logic for alive players with eventPlayerDied and eventPlayerRespawn

vagrant hollow
mild sage
#

Nope, you only want to register the players already in room, so just trigger eventNewPlayer. If you trigger eventPlayerLeft as well then those players will be treated as if they've leaved the room and the counter will be kept at zero

vagrant hollow
mild sage
indigo flower
#

indexinel is very smart 😄
continue you are a legend
pls fix LAG in the module tfm_smiley

mild sage
#

New version will be less laggy

tulip lily
#

lowerSync?

mild sage
#

No, that's other stuff

#

Current version in-game is laggy, it does so many unnecessary stuff in the code and some things are poorly implemented (just like real Minecraft lol)

This version is done from scratch, with better design and code behind it

#

also I'm planning to make it have its own style, not like the average 2D Minecraft project but something a more different. I suck even for pixel art so I will see if I find any artist once I finish coding xD

tulip lily
#

Got it lol

#

It looks interesting

echo helm
#

Tell me when they r going to fix parkour' choco sticky roof in maps?

whole tide
mighty quartz
#

for anyone that uses #utility the !pet spawn pet now moves really fast how can i change its speed or make it move slower?

untold tulip
#

looks like 'ground collision' option interfere with its behaviour

halcyon arrow
#

This is caused by a change in the Lua api, utility needs to be updated to accommodate it.

whole tide
#

@dusky minnow Congrats on joining the MT team 🎉

tulip lily
#

Can someone explain what Tig meant in that last ad? 🤔 the statement was very confusing despite being fun.

whole tide
silk hawk
static meadow
#

reminds me of bumper cars

silk hawk
nimble acorn
#

I'm famous haha

whole tide
#

damn, this is so good, when u going to share the script?

silk hawk
#

When I have a playable version, I will send a link here. 😄
You can now play as any ship in the game and npc ships and players are teamed together by faction. (I did not draw the ships btw)

I'll stop spamming chat with space Lua, sorry xD

whole tide
#

keep sharing, there is not much going on here

silk hawk
#

unfortunately the game crashes a lot due to Lua overload
Warning : Runtime can't exceed 40 ms in 4 seconds ! Currently : 40 ms. derpy

whole tide
#

40ms for normal player right?

silk hawk
#

yes, but it doesn't work on 60ms either

whole tide
#

so a staff member must run it

#

or u can always submit it for modules

silk hawk
#

Modules are limited to 60 ms if i remember correctly, maybe I'll come up with something that will reduce runtime 😄

indigo flower
marsh laurel
#

how can I add random backgroud into XML?
I tested it out like this, but the backgound is not showing humm

}
randomBg = background[math.random(#background)]
gameMap = '<C><P D="randomBg.." /><Z><S><S L="802" H="30" X="400" Y="389" T="5" P="0,0,0.3,0.2,0,0,0,0" /></S><D><DS Y="361" X="400" /></D><O /></Z></C>'

tfm.exec.newGame(gameMap) ```
shut crest
# marsh laurel how can I add random backgroud into XML? I tested it out like this, but the bac...
 background = { "x_transformice/x_maps/x_peche2014/x_temple.jpg", "x_bouboum/x_fond/x_f5.jpg", "x_transformice/x_maps/x_papaques_2015/map2.jpg"
}
randomBg = background[math.random(#background)]
gameMap = '<C><P D="' .. randomBg .. '" /><Z><S><S L="802" H="30" X="400" Y="389" T="5" P="0,0,0.3,0.2,0,0,0,0" /></S><D><DS Y="361" X="400" /></D><O /></Z></C>'

tfm.exec.newGame(gameMap) 

It's '..randomBg..' not just randomBg..

Some simple examples for similar situations:

local batata = "Potato"
print("I love " .. batata )
--or print('I love ' .. batata) 
local batata = "Potato"
print("I love " .. batata .. " very much" ) 
--or print('I love ' .. batata .. ' very much' ) 
--or print("I love " .. batata .. ' very much' ) 
marsh laurel
tough token
whole tide
#

nope

vagrant hollow
#

Open miceditor on any browser, add any ground, then in its setting click on 'use ground image'. Put the url of the image(that you uploaded in image upload center), in 'URL' field.

tough token
vagrant hollow
#

So you can't stretch it or make it bigger

tough token
#

the first image is a miceeditor. I need my picture to be visible in the tribe room

vagrant hollow
whole tide
#

lua images doesn’t work in normal maps codes

#

it require a lua

vagrant hollow
whole tide
#

are they lua images or images from tfm database

vagrant hollow
#

Images URLs from image upload center

whole tide
#

thats tfm database images

vagrant hollow
#

Nah

#

Database is something different

#

A whole website

#

For tfm, boubom, dead maze and so on

whole tide
tulip lily
#

You can only upload images that are hosted on the atelier database if you are not using lua. And in the same way, if you are going to use lua you need someone from the module team to upload the image at images.atelier801.com since all lua images are loaded from there.

vagrant hollow
vagrant hollow
#

I misunderstood you, the image can only be used in a script using lua, sorry guys tfm_derp tfm_sweatdrop

latent jay
#

honestly idk hwhere to tell this but utility has major issues rn

#

it crashes for no reason

#

uhh

#

i know its a problem to report to the ujh owner of the module but i have no idea who is he

static meadow
#

records module has also been suffering issues, I think it’s a tfm issue but I’m not sure why it happens

latent jay
#

it must be some sort of code

#

i think this is bannable idk

#

i feel they're just trolling but i think they're doing it abusively

#

plus just look at the account date

#

should i report this

#

i mean im posting this in the modules channel bc it's about modules anyway

whole tide
latent jay
#

hehehe

static meadow
tulip lily
#

room #aurora0poisson

latent jay
#

anyone knows what's this img called? (utility)

mild sage
tulip lily
vagrant hollow
#

Is there a library for TFM events and functions that can be used in external editor like VSC?

vagrant hollow
#

This is a website. What I need is a library like in some other programming languages

import library_name
#

@whole tide

nocturne vine
#

It depends on the said language the lib is coded in

#

and also the library that has different naming

#

a lua library has different functions compared to another library, of any language including itself

tulip lily
#

Lua natively has require but tfm has removed the function, so at most you can use a bundler to bundle all files into one.

latent jay
#

should i just whisper one

dreamy orchid
#

is it possible to make an NPC play an emote?

halcyon arrow
tough token
whole tide
#

cool tfm_OMG

tough token
#

star it if you like it ^_^

lone stream
#

@steady pasture

stiff sluice
steady pasture
#

Guys, i have a problem with #anvilwar

#

This module was mine and the current host player is Indexinel (not sure what #tag is)

#

I'm not getting contact with Indexinel under Discord and Transformice, and the last applied update are from more than 5 months ago

#

What can I do?

whole tide
#

sadly index isn’t here anymore

#

you can contact a module team member, maybe they can help you with that

steady pasture
#

i contacted two module team members, and one said that I should contact Matza

whole tide
clear folio
#

epico

mild sage
#

Is it possible to set some custom "flags" on shaman / physic objects in map editor to check for them by code?

mild sage
#

okay, I found how to do this, its possible to set custom parameter in object's xml code and check for it later with this function:

local function parseXML(xml)
    local objects = {}
    
    for element in xml:gmatch('<S (.-)/>') do
        local attributes = {}
        
        for key, value in element:gmatch('(%w+)="(.-)"') do
            attributes[key] = value
        end

        if attributes['lua'] then
            local object = {
                T = tonumber(attributes['T']),
                X = tonumber(attributes['X']),
                Y = tonumber(attributes['Y']),
                L = tonumber(attributes['L']),
                P = attributes['P'],
                o = tonumber(attributes['o']),
                N = attributes['N'],
                lua = tonumber(attributes['lua']),
                flag = attributes['flag'] -- Our "custom" flag
            }
            table.insert(objects, object)
        end
    end
    
    return objects
end

We can set flag in our map's xml:

<S T="13" X="362" Y="240" L="10" P="0,0,0.3,0.2,0,0,0,0" o="324650" lua="1" flag="remove"/>```

And then check for it with:
```lua
print("<R>Map XML:</R>")
            if tfm.get.room.xmlMapInfo.xml~=nil then
                local xmlCode = tfm.get.room.xmlMapInfo.xml
                local objectsTable = parseXML(xmlCode)
                
                for _, object in ipairs(objectsTable) do
                    if object.flag ~= nil then
                        print("Removing physic object with flag: "..object.flag.." ID: "..object.lua)
                        tfm.exec.removePhysicObject ( object.lua )
                    end
                end
            end```

Result (console):

• [00:18] # Removing physic object with flag: remove ID: 1```

#

its important to set lua=id parameter in most cases so we can remove our object with tfm.exec.removePhysicObject function, otherwise we can't

#

also, there is a "bug" (or just game limitation) so we can't check for map's xml code without waiting at least 1.5s (otherwise table is not created yet) so its better to set an 1.5s timer every time we use it

shy knoll
mild sage
#

btw tfm.get.room.xmlMapInfo.xml works only after calling tfm.exec.newGame and eventNewGame functions (idk why but ye)

#

also, maps are probably load from other (thread?) with access to xml code from database

#

because they can trigger stuff before even lua is called (for example dissapear flag on physic objects can be called after just 1ms)

#

but its probably tribe limitation because module rooms have instant tfm.exec.newGame called and you cant really do this in tribe because it will load @0 map or images wont work

shy knoll
shy knoll
#

I think that maybe the game doesn't want you copying people's maps

mild sage
#

the only problem is that print() and textarea uses "<" and ">" to format text

#
local xmlCode = tfm.get.room.xmlMapInfo.xml:gsub("<", "&lt;"):gsub(">", "&gt;")```
#

here you are ^

steel flame
#

well a delay in when you can get the map limits how quickly you can get the map data to stop someone from copying maps en masse, it might be the intention

shy knoll
#

OH

shy knoll
#

i find it funny that the lua interpreter lets you format text in it

mild sage
#

I made a whole script for getting maps codes, wait a second

#
function getXML()
    if tfm.get.room.xmlMapInfo.xml~=nil then
        currentXML = tfm.get.room.xmlMapInfo.xml:gsub("<", "&lt;"):gsub(">", "&gt;")
        print("<J>New Map Started</J>\n<R>XML Code(in parts):")
        print("\n<R>XML Code (Part1):</R>\n\n<font size='1' ><N>"..currentXML:sub(0,4000).."</N></font>\n")
        if (currentXML:len() > 4000) then
            print("\n<R>XML Code (Part2):</R>\n\n<font size='1' ><N>"..currentXML:sub(4001,8000).."</N></font>\n")
                if (currentXML:len() > 8000) then
                    print("\n<R>XML Code (Part3):</R>\n\n<font size='1' ><N>"..currentXML:sub(8001,12000).."</N></font>\n")
                    if (currentXML:len() > 12000) then
                        print("\n<R>XML Code (Part4):</R>\n\n<font size='1' ><N>"..currentXML:sub(12001,16000).."</N></font>\n")
                            if (currentXML:len() > 16000) then
                                print("\n<R>XML Code (Part5):</R>\n\n<font size='1' ><N>"..currentXML:sub(16001,20000).."</N></font>\n")
                                if (currentXML:len() > 20000) then
                                    print("\n<R>XML Code (Part6):</R>\n\n<font size='1' ><N>"..currentXML:sub(20001,24000).."</N></font>\n")
                                    if (currentXML:len() > 24000) then
                                        print("\n<R>XML Code (Part7):</R>\n\n<font size='1' ><N>"..currentXML:sub(24001).."</N></font>\n")
                                    end
                                end
                            end
                    end
                end
        end
    end
end```
#

this function splits xml code in parts and prints it in 1 pixels font

shy knoll
#

cool..

mild sage
#

it have single letters lose due to text format but you can actually copy whole map by putting output to miceditor (it will fix it automatically)

#

remember to call it after newgame function inside of eventNewGame with 1500ms delay

shy knoll
#

okay, it looks like you done the hard part yourself though which is a good thing

#

thanks

#

isn't there a savefile function in the TFM lua? if that existed it would be much easier

mild sage
#

nope

#

only for better ones (module team)

shy knoll
#

that sucks

#

i suppose for virus prevention

mild sage
#

I have scripts with like 3000 lines 💀

shy knoll
#

sounds like you might have made one of those mario or sonic remakes

mild sage
mild sage
#

just came back to tfm after 4 years of programming in other games so Im making one rn but api scares me hard

shy knoll
#

i don't think there is anything to fear in TFM api except maybe yourself

mild sage
#

you can make most things by yourself but fact that you can use just 1 file at once make things hard

#

best thing you can do is making own systems like own event handlers so you dont have to put everything inside of single event

#
local eventSubscribers = {}

function subscribeToEvent(eventName, callback) --subscribeToEvent('eventName', function() end)
    if not eventSubscribers[eventName] then
        eventSubscribers[eventName] = {}
    end
    table.insert(eventSubscribers[eventName], callback)
end

function triggerEvent(eventName, ...)
    local subscribers = eventSubscribers[eventName]
    if subscribers then
        for _, callback in ipairs(subscribers) do
            callback(...)
        end
    end
end```

Usage:
```lua
function eventNewPlayer( playerName )
    triggerEvent('NewPlayer', playerName)
end

subscribeToEvent('NewPlayer', function(playerName)
    print('New player appeared!')
end)

subscribeToEvent('NewPlayer', function(playerName)
    print('New player appeared but inside of other handler!')
end)
shy knoll
#

oh.. well i suppose we all have different styles of programming

#

i've never made any large programs myself

mild sage
#

from my experience, its best to start with making useful tools like bundle of commands with own gui

#

my first code was just tool that uses every single tfm api function

shy knoll
#

i suppose i don't enjoy the task of programming itself, but i find it satisfying when i am able to do what i wanted to do, so i usually ignore whatever isn't necessary

mystic sun
#

I am working on a module and it will be ready soon , can anyone tell me where I can find shaman objects images ? Like those in tfm shop like beachaBall and cannon ?

#

Because they are very well designed

#

And thet have better quality than images I got from Pinterest or the cut ones I make tfm_sad

#

Are there those img codes like blablabla.png ?

#

That need a FC member to upload them ?

#

Yeah

#

Atelier801 database makes no sense

#

I can't find a single image there

#

Oh I understand

#

Thx

mystic sun
#

I got them all , and my friend uploaded them too , ty for helping @lunar ridge

celest stag
#

using the setPlayerCollision munition how do I increase the player's collision? I don't know how to manipulate bits and it's not explained properly in the documentation

fierce viper
#

but depending of what you want, there are other ways

#

'function eventContactListener(playerName, groundId, contactInfos)
print(playerName .. " hit the ground: " .. groundId)
end'

#

just remember that the objects need the contactListener = true

celest stag
#

thanks

celest stag
#

But i dont need for this, i using changePlayerSize funcion i forgot that function exists

#

😅

celest stag
#

there is a way to know the execution time of a part of the script?

#
local t1 = os.time()

n = 0
for i = 1,100000 do
 n = i
end

local t2 = os.time()
print(os.difftime(t2, t1))
#

#Lua says the script loaded in 24 ms

#

and the print says 23

lunar ridge
# celest stag ```lua local t1 = os.time() n = 0 for i = 1,100000 do n = i end local t2 = os...

It's correct, your script inside the sandbox shows 23 ms, when the script finishes the environment outside the script takes the control, imagine that it took 1 ms giving the control back to main program. It can be explained with something like:

  • Delay during the script startup;
  • Delay during the script execution;
  • Delay while finishing the script execution;

Your case is the second, you get the measured time without external delays.

celest stag
#

Thanks

celest stag
#

Simple thing that i made

ripe badger
#

hi, how can i check if the x of the player is higher than something?

#

i'm trying to figure out lua lol

ripe badger
#

alright I figured it out

#

Where can I find a list of functions such as "tfm.get.room.playerList[n].x"? I've scrolled through the forum documentation and couldn't see it there

#

also is there any comprehensible tutorial which explains stuff such as creating variables, functions like the one above, or stuff in general

#

also also, is there any way to make you not die when you're teleported far?

ripe badger
#

also is there a "wait a certain amount of time before something next happens" command?

ripe badger
#

also, how to put a value from a color picker/popup in a variable

wind hinge
whole tide
#

that only happens in defilante mode maps

ripe badger
#

ohhhhhhh right

ripe badger
whole tide
#

normal mode with enough length and hight

ripe badger
#

oh thanks

#

also, how to make a variable that has an individual value for each player?

#

for example if someone clicks something which causes it to change, but it would apply only for them and not everyone

#

if anyone can send me any variable tutorial that would be great

lapis shale
#

you'd create it inside a function that returns the player's name, e.g.

function eventTextAreaCallback(id,name,callback)
variable[name] = "someValue" -- makes a variable for the player only
function(name) -- calls a function using the player's name
end```
ripe badger
#

Also, would this variable work across multiple functions?

lapis shale
#

if it was first defined outside a function, yes

#

otherwise it would only exist within that function

lapis shale
#

(the real situation is a bit more complex, but in simple terms this is good enough)

ripe badger
wind hinge
ripe badger
wind hinge
#

What do you intend to do?

#

I didn't understand that well

ripe badger
#

I tried to make it so each time you summon the popup the number written in it increases

wind hinge
#

I'll test it here to see if I can find a way

wind hinge
#
b = {}

for playerName in pairs(tfm.get.room.playerList) do
   b[playerName] = 1
end

function eventChatCommand(playerName, com)
   if com == 'a' then
      b[playerName] = b[playerName] + 1
      ui.addPopup(1,0,b[playerName],playerName,350,200,100,true)
   end
end
wind hinge
#

Np! quesito

ripe badger
#

hi could someone explain what does "in pairs" do?

ripe badger
#

Hmm, so it goes through every argument in a table?

Am I understand correctly that this code goes through the player list and creates a table variable for every player in the room?


for playerName in
pairs (tfm.get.room.playerList) do
b[playerName] = 1
end``` 
Is "playerName" specifically needed for this or could "playerName" be anything in this case?
Also, if one of the names was stored in a variable "c", would variable b[c] be the same as b[playerName]?
#

@lunar ridge

wind hinge
ripe badger
#

Can 0 type popups trigger eventChatCommand ?

#

it's not working for me

ripe badger
#

also how to remove npcs?

wind hinge
#

At the moment there is no way

ripe badger
#

aw, really?

#

can you update their position, at least?

#

I checked it, you can

#

phew, my idea is saved

#

btw, how to remove arguments from a table?

lapis shale
#

set their value to nil

ripe badger
#

hmmm alright

ripe badger
#
tfm.exec.giveCheese (playerName) 
end```

How could I make it so I only get the cheese after a certain amount of seconds?
lapis shale
#

use eventLoop, it provides seconds as variables

ripe badger
#

thanks, will try it

#

also

#

how could I make added images make something happen when clicked?

#

is there a function for this tied to the image or do I need to check for distance

ripe badger
#

I'm having problems with the remove image function
I made a script in which an image appears in a random place, and when you press space near it then it vanishes and appears somehwere else. Everything else works fine but from the second time on the image doesn't dissapear (I put the layer depth in image identifier but I assume that's not how it works)

can someone explain how this image identifier thing works?

#

I think each new image has id increased by one from the previous one?

#

how can I see the id, though?

lapis shale
lapis shale
ripe badger
#

Oh nice, thanks

ripe badger
lapis shale
#

the vertically bigger the image, the more \n-s you need

#

because the \n is still only the height of a single text line

ripe badger
#

alright thanks

ripe badger
#

how does this function work?

#

could I use it to set a variable to something when space is pressed and change it back when it's not pressed anymore?

#

what am I doing wrong here?

g=0

function eventKeyboard(n, k, d)
    if d=='true' then
        g=1
    end
    if d=='false' then
        g=0
    end
    
end

for n in next, tfm.get.room.playerList do
  system.bindKeyboard(n, 32, true)
end
#

I see, thank you

although when I use else like this


function eventKeyboard(n, k, d)
    if d then
        g=1
    else
    g=0
    print(g)
    end 
end


for n in next, tfm.get.room.playerList do
  system.bindKeyboard(n, 32, true)
end

the print doesn't happen when I stop pressing the space key, would there be a way to do this?

ripe badger
#

Tysm!

radiant cradle
#

hi guys.

#

i have problem in lua script

mild sage
celest stag
#

What is the floor limit on Lua?

hard bear
#

how do u make small rat room in parkour?

#

@everyone

mild sage
mild sage
#

yw! :D

hard bear
#

<3

open cape
#

Hello, does someone know what are the admin commands for the volley room ?

vagrant hollow
spice socket
#

Are mice still playing #circuit ?
Once i saw a room with 20+ mice but this was already a few weeks ago thinking

languid mountain
#

yo anyone remember #ninja

#

or #shamousey

lapis shale
#

designed the UI for #ninja haha, how could I forget

fluid helm
#

how to open music with lua code ?

rocky hinge
#

What is shamousey? Im new idk tfm_sad

spice socket
#

sounds like the shaman but idk to be sure

languid scaffold
# fluid helm how to open music with lua code ?
tfm.exec.playMusic ( music, Channel, volume, loop, fade, targetPlayer )

music - is basically the link that needs to end in .mp3, you can get already available ones by a801 at https://audio.atelier801.com/sounds.html.

channel - not sure about this but it can be anything, mainly this is used for tfm.exec.stopMusic(channel, name) but yeah, only 1 music can be played/should be ongoing(?) per channel 

volume - should be a number from 0-100

loop - if the sound/music should loop, only will accept "true" or false"

fade - if the sound should start with a fade in (true/false)

targetPlayer - who should listen to it (e.g: "Blank#3495"), leave it nil if you want everyone in the room to hear it```
languid scaffold
fluid helm
lapis shale
#

*#shamousey is the beta version of *#utility, not *#divinity

languid scaffold
languid scaffold
whole tide
#

so helpful

languid mountain
#

and rail accepted it

#

!!!

lapis shale
#

congrats

fluid helm
#

can you come dm ?

languid scaffold
vagrant hollow
#

If I added an image, how can I get the imageID? So I can remove the image using it

tfm.exec.addImage(imageName, target, xPosition, yPosition, targetPlayer, scaleX, scaleY, angle, alpha, anchorX, anchorY)
tfm.exec.removeImage(imageID)
lapis shale
#

the function returns the ID after you execute it, so what you need to do is something like:

tfm.exec.removeImage(id)```
flat vergeBOT
#

Extremq#0000 has decided to return to the Module Team.

whole tide
#

no way

#

@tawdry slate welcome back!!

tawdry slate
#

hello!

velvet matrix
#

FIX VOLLEY PLESE

carmine socket
#

ayo can someone host the images that i sent on forum pls

rotund monolith
#

What happened?

velvet matrix
#

FIX VOLLEY!!!u_love

carmine socket
#

me waiting for the upload of images on forum tfm_sad

velvet matrix
#

FIX MODULES!!!!!! FIX THE GAME!!!!!!!!!!!

shy ridge
#
  • Game freezes in #basketball when in the lobby, it gets frozen and doesn't allow you to join the list and the timer stops
  • Bring the Global Leaderboard back in #basketball
    @shut wolf
storm bolt
#

Hi, sorry, trying to learn LUA

What does function bar(a,b,c) mean? The variables werent defined prior to the function
This is from learnxyinminutes.com in pinned post

tawdry slate
#

what exactly is not clear? @storm bolt

#

the snippet showcases how you can create a function

#

function bar(a, b, c)
  print(a, b, c)
  return 4, 8, 15, 16, 23, 42
end

x, y = bar('zaphod')  --> prints "zaphod  nil nil"
-- Now x = 4, y = 8, values 15...42 are discarded.
storm bolt
#

But here, it just has a few variables

I read it like “create function NAME and, when called, it will only occur if the if/else condition is met”

tawdry slate
#
function functionName(x) {
  if (x == 0)
    // do something
}
#

are you sure it wasnt like this?

storm bolt
#

Oh wait
I think i misremembered

tawdry slate
#

yeah, inside function paranthesis you only define parameters in JS and Lua

storm bolt
#
function functionName() {
  // commands
};```
#

I never put anytjing in the parentheses

tawdry slate
#

you can do that

#

but it is useful to have parameters

#

i recommend you research a bit

storm bolt
#

Good idea :D

#

Thank u!

shy ridge
#
  • Bring the Global Leaderboard back in #basketball
    @shut wolf

idk how many times i've made this claim and it hasn't been answered

carmine socket
#

yo is there any limit of how big a image can be in tfm?

lapis shale
#

iirc it cannot exceed 3mb when you upload it

#

unless you mean dimensions, in which case I think there aren't any explicit limits

carmine socket
#

It's because I put a really big image on forum but the size is 971 kb then should be fine

carmine socket
fierce viper
shy ridge
#
  • Bring the Global Leaderboard back in #basketball (for like the 5th time in a span of 2 years asking this)
  • Fix this issue where the entire module stops and it makes it seem like we are lagging, i double checked its NOT from the game.
    @shut wolf
fierce viper
deep kraken
#

hi, i think that uno isn't working?

open crypt
#

that's correct, we've disabled Lua for the time being to fix some bugs

deep kraken
#

alright, thank you for the answer!

wild swan
#

some of the way to crash the server is the print function (this is the unique method that i know)

so removing prettyprint from lua tables/putting a limit of chars in strings should fix

whole tide
#

hey @open crypt, modules are broken, can you fix them?

open crypt
whole tide
#

ok, thanks honey

whole tide
grim grotto
#

if coffeebot is bot or not? coz this guy sit on his own module room 24/7

proven river
golden totem
whole tide
#

great work!!

lone stream
proven river
#

I recreated the Halloween 2010 event

silk hawk
#

New semi-official module called #factions is out!

How to play: Players are divided into two teams and each team has a tower that you must protect from the other team. You have to collect money around the map to upgrade team skills that will help you both protect your tower and destroy the opposing tower.

Official forum topic: https://atelier801.com/topic?f=6&t=899272
Gameplay video: https://www.youtube.com/watch?v=lnmyhsA5GYw

I released the module last night and made some quality of life changes this morning, so here is the changelog for version 1.1
➤ Players no longer collect money for the whole team, but instead collect it in their inventory. There is a team chest near the team tower where players can put their money for everyone. Therefore, trolls cannot spend all their money on unnecessary upgrades.
➤ Boxes now behave like pumpkins for more balanced gameplay.
➤ Reduced required activity of the losing team.

Have fun! 💚

errant elk
#

I'm soooooooo fed up with parkour players who willfully ignore red bars! Something must be done to remediate that.

tawdry slate
rugged canopy
stone trout
mystic sun
#

Awesome

#
  • how can I show my module to one of the team here ?
mystic sun
#

u here ? @merry chasm

lapis shale
lapis shale
#

My module #bodykudo0catch - a gallery of maps designed for playing tag - has been available for quite a while, but I never announced it here in #modules:

The rules are simple. Tag, you're it! If you can't keep up the pace, you're going to get caught.
Want to play and read more info? Grab a friend or a few and check out the forum topic: https://atelier801.com/topic?f=6&t=898352&p=1#m1

⚠️ NOTE: The room is outdated. It is suggested you run the script from the topic instead.

mystic sun
#

Good job ♥️

mystic sun
#

Nice work

wild swan
#

achei

wild swan
#

any lua team to host lua image host?

wet mesa
vagrant hollow
modest warren
#

Do you know if there is a Pinturillo-style lua, where you draw and have to guess?

mystic sun
mystic sun
#

#micefall , a new semi-official Module!

Gameplay: All mice are flying in the sky with only 3 small boarders under them , all you have to do is using your attacking , teleportation and movement skills to push the other mice down while dodging their attacks.

Actually the module was out since two weeks but I had no time announcing it so here it is now . Have a nice time flying 🪽

Soon I will make a forum topic explaining the module more .

If you face any issues or errors in the module , feel free to DM me anytime 🫶

wet mesa
whole tide
#

nice

dire orchid
#

does mycity has discord?

grave ember
#

i think so

#

i cant find it though

open crypt
dire orchid
#

thanks

tall frost
#

there is discord server for batata module

wet mesa
#

Autocompletion for ZeroBrane studio, now up to date. Put the file in Your_Zerobrane_Folder\api\lua directory, add api = {"transformice"} to your user settings and restart, then enjoy.

wild swan
#
local loadBarSize = 5 --the size of the bar (number)
local loadBarTime = 12 --the time to complete in 0.5 seconds, so 12 = 6 seconds (int)

local _loadBarPlayers = {}

eventNewPlayer = function(playerName)
    system.bindKeyboard(playerName, 32, false, true)
    if _loadBarPlayers[playerName] == nil then
        _loadBarPlayers[playerName] = {seconds = loadBarTime, imageStorage = {}, canPressSpace = false, loadBarSpace = 0, secondsNoChange = loadBarTime} --each 10 seconds, put all players with loadBar
    end
end

for k in next, tfm.get.room.playerList do
    eventNewPlayer(k)
end

eventPlayerRespawn = function(playerName)
    _loadBarPlayers[playerName] = {seconds = loadBarTime, imageStorage = {}, canPressSpace = false, loadBarSpace = 0, secondsNoChange = loadBarTime}
end

eventLoop = function()
    for k, v in next, _loadBarPlayers do
        if _loadBarPlayers[k].seconds > 0 then
            _loadBarPlayers[k].imageStorage[(#_loadBarPlayers[k].imageStorage)+1] = tfm.exec.addImage('185269e5376.png', '$'..k, -((_loadBarPlayers[k].secondsNoChange*loadBarSize)/2)+_loadBarPlayers[k].loadBarSpace+(loadBarSize/2), -(32+(loadBarSize/2)), k, loadBarSize, loadBarSize, nil, nil, 0.5, 0.5)
            _loadBarPlayers[k].loadBarSpace = (_loadBarPlayers[k].loadBarSpace)+loadBarSize
        elseif _loadBarPlayers[k].canPressSpace == false then
            _loadBarPlayers[k].canPressSpace = true
        end
        _loadBarPlayers[k].seconds = _loadBarPlayers[k].seconds-1
    end
end

eventKeyboard = function(playerName, keyCode)
    if _loadBarPlayers[playerName].canPressSpace and keyCode == 32 then
        for i=1, #_loadBarPlayers[playerName].imageStorage do
            tfm.exec.removeImage(_loadBarPlayers[playerName].imageStorage[i])
        end
        _loadBarPlayers[playerName] = {seconds = loadBarTime, imageStorage = {}, canPressSpace = false, loadBarSpace = 0, secondsNoChange = loadBarTime}

        ----------------
        --DO SOMETHING--
        ----------------

    end
end
wet mesa
# wild swan ```lua local loadBarSize = 5 --the size of the bar (number) local loadBarTime = ...

The snippet works, but I recommend the following:

  • Use newlines and identation to separe larges pieces of code (that tfm.exec.addImage call, eventPlayerRespawn, eventNewPlayer) to help with readability. It will make it easier to maintain in the future; but it currently works as it is.
  • In evetLoop for loop, use the field v which corresponds exactly to _loadBarPlayers[k]. This saves tables accesses and makes the code less verbose, repetitive, and instead easier to follow.
  • You can get the same effect with a single image and manually scalling it on the X axis, however the math becomes more complex, so either is fine.
  • I'd swap _loadBarPlayers[playerName].canPressSpace and keyCode == 32, since if other keys ever get binded you would be unnecesarily comparing against the field canPressSpace
  • It is not necessary to create a new table each time you press space. Instead just reset the fields, but that doesn't seem necessary for most of them except for imageStorage. So I'd recommend you to use that same for loop, which is numerical, to clean up the table, adding a _loadBarPlayers[playerName].imageStorage[i] = nil after removing the image.
  • I'd personally add a local barPlayer = _loadBarPlayers[playerName] at the start of eventKeyboard, I know I'll be accessing it several times so localizing improves readability and table acceses.
wild swan
lunar ridge
proven river
#

The approach presented is not as efficient as directly calling a function when assigning a value. However, depending on the context of the script, it can be useful for situations such as setting minimum and maximum limits for numbers, adjusting text, formatting colors, among other reasons.

Example:

function _setmetatable(tbl)
    local tbl = tbl or {}
    tbl._internal = {variables = {}, functions = {}}

    setmetatable(tbl, {
        __index = function(self, key)
            return self._internal.variables[key]
        end,
        __newindex = function(self, key, value)
            local funcs = self._internal.functions
            if funcs[key] then
                self._internal.variables[key] = funcs[key](value)
            else
                self._internal.variables[key] = value
            end
        end,
        __call = function(self, ...)
            local args = { ... }
            for i = 1, #args, 3 do
                local key, func, value = args[i], args[i + 1], args[i + 2]
                if key and func then
                    self._internal.functions[key] = func
                    self[key] = value
                end
            end
        end
    })

    return tbl
end

_G = _setmetatable(_G)
_G('number', function(value)
    return math.min(math.max(tonumber(value) or 0, 0), 100)
end, 150)

print(number)
number = 55
print(number)
number = 130
print(number)
number = -40
print(number)
number = 80
print(number)
100
55
100
0
80
tame granite
#

derpy

local silly_flags = { "M1", "M2", "M5", "M6", "M_0", "M_1", "M_2", "M_3", "M_4" }
function eventChatCommand(name, cmd)
  local index = tonumber(cmd) or math.random(#silly_flags)
  tfm.exec.playEmote(name, 10, "../../" .. silly_flags[1 + ((index - 1) % #silly_flags)])
end
rugged canopy
#

insane

carmine socket
#

hey siri can you revive this topic

ripe badger
#

omg I used to play pursuit so much

#

I really loved traitor too

crystal helm
crimson finch
#

hey, i dont know if this is the correct place to say this or not, but there has been a series of hackers on guest accounts teleporting in batata and only killing specific people, basically making the game unplayable for anyone who isnt favored by them. i'd appreciate if the mods could actually watch batata a bit more closely? despite multiple reports over several weeks, this problem hasnt stopped.

#

theyre often online between 11am and 5pm EST

crystal helm
crimson finch
cold falcon
# crimson finch hey, i dont know if this is the correct place to say this or not, but there has ...

Thank you for saying this!! It is actually a big problem in batata. And as a fellow player who gets targeted from the first seconds of a round starting, it is pretty annoying and makes the module pretty unplayable. Was considering taking a break from tfm with my friends, because we only have time to play batata and the hacking problem has been getting very excessive in the last 2 weeks. Also the hacks are blatantly obvious.

crimson finch
#

(If this continues to go unaddressed, i may consider directly pinging some people, as its crazy that yall have let this go on for weeks at this point with no action taken)

wet mesa
crimson finch
#

gonna ping a few people, i will say, the guests leave and come back periodically (likely to avoid banning) so you may enter the room and see nothing amiss, but dont be deceived

wet mesa
crimson finch
#

okay, got it, tysm

wet mesa
#

oh- but not all of them lmao

crimson finch
#

oh-

craggy hare
#

Do not mass ping all of us. For rulebreakers use /report command

crimson finch
#

i understand that, but ive received no reply despite the game being basically unplayable for multiple weeks

#

i will admit, the pinging is extreme but its disappointing that no action has been taken

torn tide
#

Additionally, if the user isn’t being handled as quickly as you’d like, I suggest using the /ban user#tag command to vote-kick them from the room.

crimson finch
#

again, i understand, but removing them does nothing when they will only come back with another guest account.

#

its just incredibly disappointing to wait for weeks for action, receive nothing, and then be told that there is nobody i can speak to directly.

#

especially when the hackers are obvious and actively causing so much disturbance.

wet mesa
#

Yes, they're still open.

wet mesa
#

Sure, no problem

wet mesa
#

Hello people. I have re-established my module #indexinel.

If you have a small script that you want to see in rooms, but you don't want to make it a module yet, you can load it through my module. Send me your script, its name, the authors name and a brief description and I'll add it as a submode for #indexinel.

grave ember
#

nezu mvp

wet mesa
mild sage
wet mesa
mild sage
# wet mesa What does it track?

NONE OF THE MUSIC IN THIS VIDEO IS MY OWN. Requested by Burnt Fishy.
You can view a list of all of the requests I have yet to get to here: https://docs.google.com/document/d/171d0S-n6zj7JjbNG_9pz1PfzZnNYbkfT3tz_ibpoA-g/

A huge thank you to Skye for recording the .wav files used to create this visualization!

Oscilloscope visuals created with ji...

▶ Play video
#

it's old script

crimson finch
#

Not going to ping anyone, but just so the mods are aware, several accounts have been hacking in fake wins in batata. Diedenkevin is the main example, having hacked in literally 10,000 wins. Mega also hacked in 4,000 wins, although he attempted to make it less obvious. While this isn’t a huge thing, it is really annoying.