×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Profils
  • /
  • Emilysoup
Profil
Emilysoup #0000
    • Emilysoup#0000
    • Profil
    • Derniers messages
    • Tribu
« Citoyen »

Date d'inscription : 10/08/2014

Communauté : Internationale
Messages : 1

Prestige : 0
Niveau : 1

Hors ligne


Tribu :
So they say
    • So they say
    • Profil
    • Forum
    • Membres

  • General
  • Adding items
  • Player interaction
  • Setting parameters
  • Resources

system.exit()
Description: LUA system deactivates the current running script


system.disableChatCommandDisplay(command, hidden)
Description: LUA system disables chat commands starting with the ! character from displaying in the public chat

Notes: Can only disable up to 100 commands.

Arguments:
  • command (string) - The command to be hidden. Any text after the first spacebar character will also be hidden. For example, if the command "help" is disabled from displaying in the chat, "help us please" won't be displayed.
  • hidden (boolean) - If true, the command will be hidden in public chat. If false, the command will be displayed in public chat as usual.


Example:
system.disableChatCommandDisplay("help",true)
-
system.disableChatCommandDisplay("size",true)


eventMouse(playerName, xMousePosition, yMousePosition)
Description: EVENT is triggered by the player clicking on the screen


Effect: Print coordinates at mouseclick

target = "Bloobunny"

function eventMouse(playerName,xMousePosition,yMousePosition)
print("x = "..xMousePosition)
print("y = "..yMousePosition)
end
system.bindMouse(target, true)


Effect: Print coordinates at keyclick "s"

target = "Bloobunny"

function eventKeyboard(playerName, key, down, xPlayerPosition, yPlayerPosition)
if key == 83 then
print("x = "..xPlayerPosition)
print("y = "..yPlayerPosition)
end
end
tfm.exec.bindKeyboard(target, 83, true, true)


Effect: Teleport on mouseclick

god = "Bloobunny"
target = "Bloobunny"

function eventMouse(name, x, y)
tfm.exec.movePlayer(target,x,y,false,0,0,false)
end
system.bindMouse(god, true)

function eventChatCommand(playerName, command)
if command == 'move' then
tfm.exec.movePlayer(playerName,x,y,0,0,0,0)
end
end

ui.addTextArea(id, text, targetPlayer, xPosition, yPosition, width, height, backgroundColor, borderColor, backgroundAlpha, fixedPosition)
Description: Creates a clickable on-screen textbox, with custom color, size, and text


http://i.imgur.com/w0XHjeO.png

Arguments:
  • id (integer) - The ID of the text area, to be used when removing or updating it.
  • text (string) - The text to be displayed in the text area.
  • targetPlayer (string) - The player who the text area will be displayed to. If this argument is nil, it will be displayed to all players in the room.
  • xPosition (integer) - The X co-ordinate that the left of the popup will start at.
  • yPosition (integer) - The Y co-ordinate that the top of the popup will start at.
  • width (integer) - The width of the text area.
  • height (integer) - The height of the text area.
  • backgroundColor (integer) - The color of the text area, as a hexadecimal number. If this argument is nil, the background color will be 0x324650.
  • borderColor (integer) - The color of the border around the text area, as a hexadecimal number. If this argument is nil, the border color will be 0x000000.
  • backgroundAlpha (float) - The alpha level the text area will be. 1 is opaque, 0 is fully transparent. If this argument is nil, the alpha level will be 1.
  • fixedPosition (integer) - If true, the text area will stay relative to the UI on scrolling maps. If false, the text area will stay in the same position on the map.


Example:
ui.addTextArea(1,"Naughty Corner",nil,1215,-150,100,20,0x324650,0x212F36,0.8,true)

ui.updateTextArea(1,"This is some different text.",nil)

ui.removeTextArea(1,nil)


tfm.exec.addPhysicObject(id, xPosition, yPosition, groundDefinition)
Description: Creates a ground with custom properties


http://i.imgur.com/BzmIZVW.png

Arguments:
  • id (integer) - The ID of the physic object created.
  • xPosition (integer) - The X coordinate the center of the physic object will be spawned at.
  • yPosition (integer) - The Y coordinate the center of the physic object will be spawned at.
  • groundDefinition (table) - An associative array with all of the information needed for a physic object, the available keys in the table are below but they're not all required.

    • type (integer) - The ID of ground type. For a full list of valid types, check the "Ground IDs" part in the "Enums and IDs" section of this thread.
    • width (integer) - The width the physic object will be.
    • height (integer) - The height the physic object will be.
    • foreground (boolean) - If true, the physic object will be displayed in the foreground of the map. If false, it will be in the background.
    • friction (float) - The friction of the physic object, which is also needed for walljumping, 0 will act like ice and 20 will act like chocolate.
    • restitution (float) - How bouncy the physic object is, 0 won't be bouncy at all and 1 will bounce objects up to the same height they fell from.
    • angle (integer) - The rotation of the physic object in degrees.
    • color (integer) - The color of the physic object, only used if the type is a rectangle or circle.
    • miceCollision (boolean) - If true, the physic object will collide with mice. If false, it will pass through mice.
    • groundCollision (boolean) - If true, the physic object will collide with other physic objects. If false, it will pass through other physic objects.
    • dynamic (boolean) - If true, the physic object will be dynamic and fall with gravity. If false, it will be in a fixed position on the map.
    • fixedRotation (boolean) - If true, the physic object won't rotate at all. If false, it will fall in all directions like any regular object. Only used if the ground is dynamic.
    • mass (integer) - How heavy the object is. Only used if the ground is dynamic.
    • linearDamping (float) - The higher this number, the slower the object will fall to gravity. Only used if the ground is dynamic.
    • angularDamping (float) - The higher this number, the slower the object will rotate sideways. Only used if the ground is dynamic.


Example:
tfm.exec.addPhysicObject(1,800,400,{
type=0,
restitution=0.2,
friction=0.3,
width=200,
height=50,
groundCollision=true
})

tfm.exec.removePhysicObject(1)


tfm.exec.addShamanObject(id, xPosition, yPosition, angle, xSpeed, ySpeed, ghost)
Description: Spawns a shaman object on the map[/spoil

Returns the ID of the shaman object spawned, for use in tfm.exec.addImage(), tfm.exec.moveObject() and tfm.exec.removeObject()
Note: While anchors are usually considered shaman objects, they can't be spawned with this function. Similarly, some other shaman objects may not spawn correctly and will just display a graphic at coordinates 0,0. Cannons cannot have their default spawning velocity changed by this function.

http://i.imgur.com/r5mlvmW.png

Arguments:
  • id (integer) - The ID of the type of shaman object to spawn. Check the "Enums and IDs" section of this thread for a complete list of IDs to use here.
  • xPosition (integer) - The X coordinate that the center of the object will be spawned at.
  • yPosition (integer) - The Y coordinate that the center of the object will be spawned at.
  • angle (integer) - The rotation of the object as it's spawned, in degrees.
  • xSpeed (integer) - The horizontal velocity that the object will have at the moment it's spawned.
  • ySpeed (integer) - The vertical velocity that the object will have at the moment it's spawned.
  • ghost (boolean) - If true, the object will be ghosted and not collide with mice. If false, the object will be a regular one.


Example:
tfm.exec.addShamanObject(10,400,200,0,0,0,false)

for name, player in pairs(tfm.get.room.playerList) do
system.bindMouse(name, true)
end
function eventMouse(playerName, x, y)
tfm.exec.addShamanObject(23, x, y)
end


tfm.exec.displayParticle(id, xPosition, yPosition, xSpeed, ySpeed, xAcceleration, yAcceleration, targetPlayer)
Description: Displays a temporary particle effect to a player or all players[/spoil

Note: While anchors are usually considered shaman objects, they can't be spawned with this function. Similarly, some other shaman objects may not spawn correctly and will just display a graphic at coordinates 0,0. Cannons cannot have their default spawning velocity changed by this function.

http://i.imgur.com/eLfPhRn.png

Arguments:
  • id (integer) - The ID of the type of particle to display. Check the "Enums and IDs" section of this thread for a complete list of IDs to use here.
  • xPosition (integer) - The X coordinate that the particle will be spawned at.
  • yPosition (integer) - The Y coordinate that the particle will be spawned at.
  • xSpeed (integer) - The horizontal velocity that the particle will have at the moment it's spawned.
  • ySpeed (integer) - The vertical velocity that the particle will have at the moment it's spawned.
  • xAcceleration (integer) - The horizontal acceleration that the particle will have at the moment it's spawned.
  • yAcceleration (integer) - The vertical acceleration that the particle will have at the moment it's spawned.
  • name (string) - If a string, the particle will only display to the selected player. If nil, the particle will display to everyone in the room.


Example:
tfm.exec.displayParticle(1,400,200,0,0,0,0,"Zou")

tfm.exec.movePlayer(playerName, xPosition, yPosition, xOffset, xSpeed, ySpeed, yOffset)
Description: Sets the position and velocity of a player on the map

Arguments:
  • playerName (string) - The username of the player to move.
  • xPosition (integer) - The X coordinate to move the player to.
  • yPosition (integer) - The Y coordinate to move the player to.
  • xOffset (boolean) - If true, the player will be horizontally moved relative to its current position by the number in xPosition. If false, the player will be moved directly to that coordinate.
  • xSpeed (integer) - The horizontal velocity the player will be given.
  • ySpeed (integer) - The vertical velocity the player will be given.
  • yOffset (boolean) - If true, the player will be vertically moved relative to its current position by the number in yPosition. If false, the player will be moved directly to that coordinate.


Effect: Move target using manual coordinate input

tfm.exec.movePlayer(" Shiningstar", 400, 200, false, 0, 50, false)


Effect: Move target using click

god = "Bloobunny"
target = "Shiningstar"

for name in pairs(tfm.get.room.playerList) do
system.bindMouse(god, true)
end

function eventMouse(god, x, y)
tfm.exec.movePlayer(target, x, y, false, 0, 0, false)
end


Effect: Everyone can move self using mouseclick

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

function eventMouse(name, x, y)
tfm.exec.movePlayer(name, x, y, false, 0, 0, false)
end


tfm.exec.changePlayerSize(playerName, size)
Description: Changes the size of the player

Arguments:
  • playerName (string) - The username of the player to change size.
  • size (integer 0.1 - 5) - The size to be set.


Example:
tfm.exec.changePlayerSize(" Bloobunny", 5)


tfm.exec.playEmote(playerName, emoteId, emoteArg)
Description: Forces a player to perform a specific emote[/spoil

Arguments:
  • playerName (string) - The username of the player to do an emote. If nil, all players will do the emote.
  • emoteId (boolean) - The ID of an emote.
  • Emote IDs
    dance : 0
    laugh : 1
    cry : 2
    kiss : 3
    angry : 4
    clap : 5
    sleep : 6
    facepaw : 7
    sit : 8
    confetti : 9
    flag : 10
    marshmallow : 11
    selfie : 12
    highfive : 13
    highfive_1 : 14
    highfive_2 : 15
    partyhorn : 16
    hug : 17
    hug_1 : 18
    hug_2 : 19
    jigglypuff : 20
    kissing : 21
    kissing_1 : 22
    kissing_2 : 23
    carnaval : 24
    rockpaperscissors : 25
    rockpaperscissors_1 : 26
    rockpaperscissor_2 : 27
  • emoteArg (string?) - If the emote is flag, you can also send the country code.


Example:
tfm.exec.playEmote(" Nnai", tfm.enum.emote.flag, "fr")


tfm.exec.giveMeep(playerName, true)
Description: Gives a player the ability to meep

Players with this ability can press the spacebar every few seconds to make a small explosion, pushing nearby mice away.

Arguments:
  • playerName (string) - The username of the player to be given the meep ability.
  • canMeep (boolean) - Whether the player should get the meep ability.


Example:
tfm.exec.giveMeep(" Nnai", true)

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



tfm.exec.giveTransformations(playerName, true)
Description: Gives a player the ability to transform

Arguments:
  • playerName (string) - The username of the player to be given the transform ability.
  • canTransform (boolean) - Whether the player should get the transform ability.


Example:
tfm.exec.giveTransformations(" Nnai", true)

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


tfm.exec.linkMice(playerName1, playerName2, linked)
Description: Links two players, as in soulmate maps

Arguments:
  • playerName1 (string) - The username of the first player.
  • playerName2 (string) - The username of the second player.
  • linked (boolean) - Whether player1 and player2 should be linked.


Example:
tfm.exec.linkMice(" Shiningstar", " Nnai", true)


tfm.exec.freezePlayer(playerName, true)
Description: Freezes a player in place using the shaman skill effect

Arguments:
  • playerName (string) - The username of the player to be frozen.
  • canFreeze (boolean) - Whether the player should be frozen.


Example:
tfm.exec.freezePlayer(" Shiningstar", true)


tfm.exec.setVampirePlayer(playerName, true)
Description: Turns a player into a vampire

Vampires have red names and will randomly infect nearby mice, turning them into vampires too.

Arguments:
  • playerName (string) - The username of the player to turn into a vampire.
  • canVampire (boolean) - Whether the player should get the vampire ability.


Example:
tfm.exec.setVampirePlayer(" Shiningstar", true)


tfm.exec.setShaman(playerName, true)
Description: Gives shaman status to a player

Note that due to a bug, players made a shaman through this command will not be able to use their active skills, only passive ones.

Arguments:
  • playerName (string) - The username of the player to be made a shaman.
  • canShaman (boolean) - Whether the player should get the Shaman status.


Example:
tfm.exec.setShaman(" Bloobunny", true)


tfm.exec.setNameColor(playerName, color)
Description: Changes the colour of player nametags

Sets the color of the name that appears above a player's mouse, overwriting any previous color they may have (e.g. green names for friends).
http://i.imgur.com/TDuLhH1.png

Arguments:
  • playerName (string) - The username of the player whose name color will be changed.
  • color (integer) - The color of the text area, as a hexadecimal number. If this argument is 0, their name color will be reset.


Example:
tfm.exec.setNameColor(" Nnai", 0xFFFFFF)


tfm.exec.giveCheese(playerName)
Description: Gives cheese to a player, if they don't already have it

Arguments:
  • playerName (string) - The username of the player to be given cheese.


Example:
tfm.exec.giveCheese(" Shiningstar")

tfm.exec.removeCheese("Shiningstar")


tfm.exec.playerVictory(playerName)
Description: Simulates victory if carrying cheese

Makes a player simulate going to the hole. If player has cheese then they will activate victory. If player does not have cheese then they will continue as if nothing happened.

Arguments:
  • playerName (string) - The username of the player to give victory to.


Example:
tfm.exec.playerVictory(" Nnai")


tfm.exec.killPlayer(playerName)
Description: Kills a player instantly

Arguments:
  • playerName (string) - The username of the player to kill..


Example:
tfm.exec.killPlayer(" Shiningstar")


tfm.exec.respawnPlayer(playerName)
Effect: Respawns a player if they're dead

Arguments:
  • playerName (string) - The username of the player to revive.


Example:
tfm.exec.respawnPlayer(" Nnai")

eventPlayerDied function (playername)
tfm.exec.respawnPlayer (playername)
end


tfm.exec.snow(time, power)
Description: Makes snow fall onto the screen

Arguments:
  • time (integer) - The amount of time in seconds the snow will stay on the screen. The default is 60.


Example:
tfm.exec.snow(60)


tfm.exec.setPlayerScore(playerName, score, add)
Description: Sets the player score

This score is found in the tfm.get.room.playerList table, and can be seen on the scoreboard next to the chat.

Arguments:
  • playerName (string) - The username of the player whose score will be changed.
  • score (integer) - The number to set the player's score to.
  • add (boolean) - If true, the player's current score and number in the score argument will be added together. If false, the playe'rs score will be set to the number in the score argument.


Example:
tfm.exec.setPlayerScore(" Bloobunny", 25, false)


tfm.exec.setGameTime(seconds, add)
Description: Sets the time left on the current round

Arguments:
  • seconds (integer) - The amount of seconds to give the current round.
  • add (boolean) - If true, the amount of seconds in the first argument will be added to the current round. If false, the current round's timer will be set to the amount of seconds in the first argument.


Example:
tfm.exec.setGameTime(600, false)


tfm.exec.setUIMapName(text)
Description: Input text to be displayed at map author & code

Sets the text at the top-left of the UI that displays the current map's code and author by default. The map's perm icon is kept the same.
http://i.imgur.com/gx8oPT6.png

Arguments:
  • text (string) - The text to display in the top-left of the UI.


Example:
tfm.exec.setUIMapName(" Shin is a bum")


tfm.exec.setUIShamanName(text)
Description:Input text to be displayed at shaman name

Changes the text in the top bar where the shaman's name is usually displayed. The text "Shaman:" is kept there.
http://i.imgur.com/aNNVY3e.png

Arguments:
  • text (string) - The text to display in place of the shaman's name in the UI.


Example:
tfm.exec.setUIShamanName(" Shin is a bum")


tfm.exec.disableMortCommand(true)
Description: Disables the /mort command

Arguments:
  • disable (boolean) - If true, the /mort command will stop working. If false, the /mort command can be used again.


Example:
tfm.exec.disableMortCommand(true)


tfm.exec.disablePhysicalConsumables(true)
Description: Prevents players from spawning physical consumables

Arguments:
  • disable (boolean) - If true, players will not be allowed to use physical items from the inventory in the map. If false, players will be able to use physical items from the inventory in the map.


Example:
tfm.exec.disablePhysicalConsumables(true)

Module FAQ - Shamousey

Lua documentation - Admin

Lua snippets

Transformice wiki > Lua

Add Images

  • Profils
  • /
  • Emilysoup
Profil
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27