×

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
  • /
  • Script Requests
« ‹ 137 / 160 › »
Script Requests
Overjoy06
« Citoyen »
1517580300000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#2721
  0
When you click space to someone the button i mean and when you click on a person example (you clicked space on me) i will get teleported back somewhere
Bolodefchoco
« Sénateur »
1517582460000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2722
  0
Overjoy06 a dit :
like when you have meep it will make the player get teleported to the coordinate that is on the lua script

if you want more specific then when a player clicked space (number 32) on a player it will make them get teleported on the coordinate based on the lua script

Assuming everyone can press space
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
math.pythag = function(x1,y1,x2,y2,range)
return (x1-x2)^2 + (y1-y2)^2 <= (range^2)
end

eventNewPlayer = function(n)
system.bindKeyboard(n, 32, true, true)
end
table.foreach(tfm.get.room.playerList, eventNewPlayer)

eventKeyboard = function(n, k, d, x, y)
for k, v in next, tfm.get.room.playerList do
if math.pythag(x, y, v.x, v.y, 35) then
tfm.exec.movePlayer(k, 400, 200) -- 400 = x, 200 = y
break
end
end
end


Marciskris a dit :
A script that makes certain chat commands (!mapname, !cname) only available to players in the mod = {Marciskris = true} table.

Including the scripts they give you above, I'd say mod[n] is better than a function because it's faster.
Also, you can use a string.split to make the command management easier:

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
26
27
28
29
30
31
32
33
mod = {Name1 = true, Name2 = true}

string.split = function(s, p)
local out = {}
for k in s:gmatch(p) do
out[#out + 1] k
end
return out
end

eventChatCommand = function(n, c)
c = string.split(c, "[^%s]+")
-- In a command like
-- "mapname this is my name"
-- c[1] = "mapname"
-- c[2] = "this"
-- ... splited by spaces

if mod[n] then
if c[1] == "mod_command" then
-- do what ever you want here
elseif c[1] == "another_mod_command" then
-- do what ever you want here
elseif c[1] == "another_mod_command" then
-- do what ever you want here
end
end
if c[1] == "normal_mice_command" then

elseif c[1] == "another_normal_mice_command" then

end
end
Overjoy06
« Citoyen »
1517621340000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#2723
  0
Is there a script that does this :
theres a message saying you can be a guard or a prisoner then when you click guard it will teleport you somewhere
Overjoy06
« Citoyen »
1517624760000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#2724
  0
Can a joint be deadly?
Bolodefchoco
« Sénateur »
1517625180000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2725
  0
Overjoy06 a dit :
Can a joint be deadly?

You mean removed or something that kills you when you touch that?
Ozan
« Citoyen »
1517679060000
    • Ozan#2513
    • Profil
    • Derniers messages
#2726
  0
Hello. I have a problem with Lua.
function eventEmotePlayed(player, emote)
if emote == 3 then
tfm.exec.chatMessage(player .. " aşık gibi *-*")
tfm.exec.giveCheese(player)
end
end
I want to run this code, when is the mouse on the chair (Valentine Day's Chair). How can i do this ?

Dernière modification le 1517679420000
Bolodefchoco
« Sénateur »
1517680380000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2727
  0
Ozalla a dit :
Hello. I have a problem with Lua.
function eventEmotePlayed(player, emote)
if emote == 3 then
tfm.exec.chatMessage(player .. " aşık gibi *-*")
tfm.exec.giveCheese(player)
end
end
I want to run this code, when is the mouse on the chair (Valentine Day's Chair). How can i do this ?

You cannot use tfm.exec.chatMessage

Also, what do you mean? This function is triggered when you play a emote no matter the location...
Write in detail what you need

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
math.pythag = function(x1,y1,x2,y2,range)
return (x1-x2)^2 + (y1-y2)^2 <= (range^2)
end

eventEmotePlayed = function(n, e)
if e == 3 then
for k, v in next,{{460, 280}, {370, 280}} do
if math.pythag(tfm.get.room.playerList[n].x, tfm.get.room.playerList[n].y, v[1], v[2], 40) then
tfm.exec.giveCheese(n)
break
end
end
end
end

Dernière modification le 1517762220000
Heniyengui
« Citoyen »
1517863920000
    • Heniyengui#0000
    • Profil
    • Derniers messages
#2728
  0
Is it possible to add or remove decorations in the map ? like tables and chairs... (Without loading a new map)
Also, is it possible to add a ground that looks like a dynamic ground but it is not dynamic. (dynamic grounds has a better look than normal grounds)
Honorabilis
« Consul »
1517868180000
    • Honorabilis#0000
    • Profil
    • Derniers messages
    • Tribu
#2729
  0
I don't think that we can do it directly but if we use images instead of objects, it will be OK.

-› I'm just thinking not answering. I'm not a pro of this.
Bolodefchoco
« Sénateur »
1517869440000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2730
  0
Heniyengui a dit :
Is it possible to add or remove decorations in the map ? like tables and chairs... (Without loading a new map)
Also, is it possible to add a ground that looks like a dynamic ground but it is not dynamic. (dynamic grounds has a better look than normal grounds)

Adding or removing decorations without a new game is impossible, but you can use (create) other tags in the XML to spawn images of the decorations, just like #hidenseek, or i don't know...

You can set a negative mass for dynamic grounds and they will be stable, but I don't think they'll look like dynamic grounds :/
Heniyengui
« Citoyen »
1517945940000
    • Heniyengui#0000
    • Profil
    • Derniers messages
#2731
  0
I don't know where to report this, Lua isn't working, there is a problem in the game.
Bolodefchoco
« Sénateur »
1517947260000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2732
  0
Heniyengui a dit :
I don't know where to report this, Lua isn't working, there is a problem in the game.

Indeed. I heard that some friends were testing coroutines and lua stopped working.. so fragile :c
Overjoy06
« Citoyen »
1518157380000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#2733
  0
Is there a lua script that divides the mices on 2 teams?
Koruto
« Citoyen »
1518157980000
    • Koruto#2851
    • Profil
    • Derniers messages
    • Tribu
#2734
  0
Can anyone tell me whats the code for :
If i pressed 5 then to show 5 emoticon

how to do this
Bolodefchoco
« Sénateur »
1518185100000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2735
  0
Overjoy06 a dit :
Is there a lua script that divides the mices on 2 teams?

Squalleze's code:
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
setTeams = function(quantity)
local t, teams, i = 0, {}
for n in next, tfm.get.room.playerList do
i = t % n + 1
t = t + 1
teams[i] = teams[i] or {}
teams[i][#teams[i] + 1] = n
end

return team
end

teams = {}
eventNewGame = function()
teams = setTeams(2)

if teams[1] then
print(teams[1][1] .. " is in the team 1")
end
if teams[2] then
print(teams[2][1] .. " is in the team 2")
end
end

Hemant2002 a dit :
Can anyone tell me whats the code for :
If i pressed 5 then to show 5 emoticon

how to do this

Code Lua

1
2
3
4
system.bindKeyboard("Hemant2002", string.byte('5'), true, true)
eventKeyboard = function(n, k)
tfm.exec.playEmote(n, 4)
end

There's no way to display those rat faces you call emoticon tho

Dernière modification le 1518185340000
Koruto
« Citoyen »
1518232260000
    • Koruto#2851
    • Profil
    • Derniers messages
    • Tribu
#2736
  0
No I meant that when I press 97 key than the person should play 1 emote

The code was like this .
Tfm.emote.emoji=5 something like this.
Can u tell me the proper version of it
Overjoy06
« Citoyen »
1518240360000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#2737
  0
Is there a script of making the meep kill people?
Bolodefchoco
« Sénateur »
1518275580000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2738
  0
Hemant2002 a dit :
No I meant that when I press 97 key than the person should play 1 emote

The code was like this .
Tfm.emote.emoji=5 something like this.
Can u tell me the proper version of it

Doesn't exist

Overjoy06 a dit :
Is there a script of making the meep kill people?

What's sense? When I press space it kills instead of the explosion, it's easier to press space and kill only, meep becomes awful, unless you're looking for a timer.. if so, you can do that without meep!
Koruto
« Citoyen »
1518361860000
    • Koruto#2851
    • Profil
    • Derniers messages
    • Tribu
#2739
  0
Shamousey a dit :
tfm
enum
emote
dance : 0
laugh : 1
cry : 2
kiss : 3
angry : 4
clap : 5
sleep : 6
facepaw : 7
sit : 8
confetti : 9

Whats this then?
Bolodefchoco
« Sénateur »
1518362220000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2740
  0
Hemant2002 a dit :
Shamousey a dit :
tfm
enum
emote
dance : 0
laugh : 1
cry : 2
kiss : 3
angry : 4
clap : 5
sleep : 6
facepaw : 7
sit : 8
confetti : 9

Whats this then?

Emote, not emoji.

Do tfm.exec.playEmote("Hemant2002", 0)
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 137 / 160 › »
© Atelier801 2018

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

Version 1.27