×

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
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 32 / 33 › »
Lua Snippets
Overjoy06
« Citoyen »
1517127360000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#621
  0
Also i got a lot of questions about lua codes...
What is the script to when you click a message it activates a map
Bolodefchoco
« Sénateur »
1517148840000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#622
  0
Overjoy06 a dit :
Guys is there a script that there is a text then when you click it, it will spawn a map.
Also how do you put messages? like 5 of them.

Code Lua

1
2
3
4
ui.addTextArea(0, "<a href='event:map'>Click here</a>", "Overjoy06")
eventTextAreaCallback = function(i, n, c)
tfm.exec.newGame("#1") --> Replace #1 with the @Code you want, or keep #1 if you prefer
end

use ui.addTextArea to put text messages
Lindo_luis
1517516640000
    • Lindo_luis#0000
    • Profil
    • Derniers messages
#623
[Modéré par Dracoleaf, raison : Por favor, não fale português no fórum inglês. Procure pela bandeira no canto superior direito, selecione a brasileira e vá para o fórum BR. // Off-Topic post.]
Lindo_luis
1518221520000
    • Lindo_luis#0000
    • Profil
    • Derniers messages
#624
[Modéré par Batt_mellamy, raison : Por favor, não fale português no fórum inglês. Procure pela bandeira no canto superior direito, selecione a brasileira e vá para o fórum BR.]
Themiachale
« Citoyen »
1534071600000
    • Themiachale#0000
    • Profil
    • Derniers messages
    • Tribu
#625
  0
[Message Deleted]

Got response in another post.

Dernière modification le 1534120260000
Vnklacnkfho
« Citoyen »
1538242080000
    • Vnklacnkfho#0000
    • Profil
    • Derniers messages
    • Tribu
#626
  0
hey please help me
ui.addPopup ( 1, 2, "hey", nill, 200, 200, 200, false )
function eventPopupAnswer ( 1, nill, "hey" )
end
Yolohackers
« Citoyen »
1550226480000
    • Yolohackers#0000
    • Profil
    • Derniers messages
    • Tribu
#627
  0
I got a question! can anyone tell me the id of the emote when the mice hold up a cheese (when opens cheese coin)
R0cket5
« Citoyen »
1564744680000
    • R0cket5#0000
    • Profil
    • Derniers messages
    • Tribu
#628
  0
Is there a lua script that allows you to make a certain target do a certain emote such as dancing?
Boxofkrain
« Censeur »
1564773300000
    • Boxofkrain#0000
    • Profil
    • Derniers messages
    • Tribu
#629
  0
R0cket5 a dit :
Is there a lua script that allows you to make a certain target do a certain emote such as dancing?

Yeah
Code Lua

1
tfm.exec.playEmote(player, id)
Dramacorn
« Consul »
1565439000000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#630
  0
Who have the script for lucky game from map bar , halloween 2014 ....?
Hufdasr
« Citoyen »
1588673520000
    • Hufdasr#0000
    • Profil
    • Derniers messages
    • Tribu
#631
  0
How to make command, that can give you money? For example: !give Hufdasr#0000 1000
Perfecteca
« Sénateur »
1588784220000
    • Perfecteca#0000
    • Profil
    • Derniers messages
    • Tribu
#632
  1
Hufdasr a dit :
How to make command, that can give you money? For example: !give Hufdasr#0000 1000

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
currentMoney={} --to store money information

for player in pairs(tfm.get.room.playerList) do
currentMoney[player]=0 --resets money when lua is loaded
end

function giveMoney(player,money) --creating giveMoney event
currentMoney[player]=currentMoney[player]+money --adds money to player's current money
print(player.."'s Money: "..currentMoney[player])
end

--let our command be "!give Hufdasr#0000 1000"
function eventChatCommand(player,command)
if command:sub(1,4)=="give" then --from 1st to 4th, our command must be "give"
giveMoney(command:sub(6,string.find(command,"#")+4),command:sub(string.find(command,"#")+6))
--find the first letter of the player, in this case it's always 6th letter
--find "#", use string.find(command,"#"), in this case it's 13th letter
--find the last letter the player, in this case simply add 4 to 13, use string.find(command,"#")+4, it is 17th letter
--properly combine those all and make it the first argument of the function
--find the first letter of the given money, in this case simply use string.find(command,"#")+6, it is 19th letter
--properly make it the second argument of the function
--if it's done properly, the function should trigger the giveMoney event and give the money written
end
end
--reminder: it can also take money away if you use negative numbers

Dernière modification le 1588784340000
Ayumai
« Censeur »
1589220540000
    • Ayumai#4877
    • Profil
    • Derniers messages
#633
  0
Who knows the lua code for being invincible/can't die
Boxofkrain
« Censeur »
1589299080000
    • Boxofkrain#0000
    • Profil
    • Derniers messages
    • Tribu
#634
  1
Ayumai a dit :
Who knows the lua code for being invincible/can't die

Unfortunately, it isn't possible.

I made a script for you that autosaves checkpoints and when you die, it teleports you to the position you were X seconds ago.
You can change X, using a command !freq <seconds>, e. g. !freq 3. By default, it's set to 2 seconds.

You also can turn on and turn off the script using !on and !off commands, default is ON.

Code

Code For Ayumai

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
getExecutor = function() local _,n=pcall(0);return string.match(n,"(.-)%.") end

local on = 1
local saveFrq = 2
local positions, r = {}, 0
local protected = getExecutor()

eventChatCommand = function(n, c)
if (n == protected) then
if (c:sub(1,4) == 'freq' and c:sub(6) ~= nil) then
saveFrq = c:sub(6)
positions, r = {}, 0
print('<rose>Checkpoint saving frequency set to ' .. c:sub(6) .. ' seconds!</rose>')
elseif (c == 'on') then
on = 1
print('<vp>Script turned on</vp>')
elseif (c == 'off') then
on = 0
print('<r>Script turned off</r>')
end
end
end

eventPlayerDied = function(n)
if (n == protected and r > saveFrq * 2 and on == 1) then
tfm.exec.respawnPlayer(protected)
tfm.exec.movePlayer(protected, positions[r - saveFrq * 2][1], positions[r - saveFrq * 2][2], false, 1, 1)
positions, r = {}, 0
end
end

eventLoop = function()
r = r + 1
positions[r] = {tfm.get.room.playerList[protected].x, tfm.get.room.playerList[protected].y}
end

for _, c in next, {'freq', 'on', 'off'} do system.disableChatCommandDisplay(c) end
Magdimouse
« Citoyen »
1589369040000
    • Magdimouse#0000
    • Profil
    • Derniers messages
#635
  0
How do you bind, let's say a text area, to a mouse? I mean when a mouse moves, 'his' text area to follow?
Hufdasr
« Citoyen »
1591518060000
    • Hufdasr#0000
    • Profil
    • Derniers messages
    • Tribu
#636
  0
Is possible to make text using a textarea or popup that can be copied? I need it to my saving system.
Mouseexyx
« Citoyen »
1591644840000
    • Mouseexyx#0000
    • Profil
    • Derniers messages
    • Tribu
#637
  0
is it possible to bind an arrow key (down) to kill a mouse?
Extremq
« Citoyen »
1591723800000
    • Extremq#0000
    • Profil
    • Derniers messages
    • Tribu
#638
  0
Mouseexyx a dit :
is it possible to bind an arrow key (down) to kill a mouse?

Code Lua

1
2
3
4
5
6
7
system.bindKeyboard("Name#id", 3, true, true)

function eventKeyboard(player, key, down, x, y)
if key == 3 then
tfm.exec.killPlayer(player)
end
end

This is basically the "root".
Extremq
« Citoyen »
1591749180000
    • Extremq#0000
    • Profil
    • Derniers messages
    • Tribu
#639
  0
Hufdasr a dit :
Is possible to make text using a textarea or popup that can be copied? I need it to my saving system.

Depends. You can't copy the text, but you can add a button in the textArea to print the content of the textArea in chat. Anyways, you would need Module Team/FunCorp permissions to run that.
Mouseexyx
« Citoyen »
1591823460000
    • Mouseexyx#0000
    • Profil
    • Derniers messages
    • Tribu
#640
  0
Extremq a dit :
Mouseexyx a dit :
is it possible to bind an arrow key (down) to kill a mouse?

Code Lua

1
2
3
4
5
6
7
system.bindKeyboard("Name#id", 3, true, true)

function eventKeyboard(player, key, down, x, y)
if key == 3 then
tfm.exec.killPlayer(player)
end
end

This is basically the "root".

thanks - is there a way to do it for multiple rats at a time or is it only for one rat to annihilate itself?
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 32 / 33 › »
© Atelier801 2018

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

Version 1.27