×

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
« ‹ 142 / 160 › »
Script Requests
Bolodefchoco
« Sénateur »
1522582560000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2821
  0
Vekout a dit :
Vekout a dit :
Hey guys!

I need a textArea that simulates being a cheese, when my mouse "touch the textArea" give me the cheese. Please<3

When I say "touch", I don't mean to click, I mean, the exact coordinates of textarea

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
local textAreaWIDTH = 100
local textAreaHEIGHT = 50

local textarea = setmetatable({ x = 0, y = 0, radiusX = (textAreaWIDTH+5) / 2, radiusY = (textAreaHEIGHT+5) / 2}, {
__call = function(list, objectX, objectY)
local x, y = (list.x - objectX), (list.y - objectY)

return x >= -list.radiusX and x <= list.radiusX and y >= -list.radiusY and y <= list.radiusY
end
})

textarea.x = 400
textarea.y = 350

ui.addTextArea(0, "", nil, textarea.x - textarea.radiusX , textarea.y - textarea.radiusY, textAreaWIDTH, textAreaHEIGHT, 1, 1, .5, false)

eventLoop = function()
for k, v in next, tfm.get.room.playerList do
if not v.hasCheese and textarea(v.x, v.y) then
tfm.exec.giveCheese(k)
end
end
end

Dernière modification le 1522582740000
Hackinnzkt
« Citoyen »
1522699020000
    • Hackinnzkt#0000
    • Profil
    • Derniers messages
    • Tribu
#2822
  0
Bolodefchoco a dit :
Vekout a dit :
Vekout a dit :
Hey guys!

I need a textArea that simulates being a cheese, when my mouse "touch the textArea" give me the cheese. Please<3

When I say "touch", I don't mean to click, I mean, the exact coordinates of textarea

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
local textAreaWIDTH = 100
local textAreaHEIGHT = 50

local textarea = setmetatable({ x = 0, y = 0, radiusX = (textAreaWIDTH+5) / 2, radiusY = (textAreaHEIGHT+5) / 2}, {
__call = function(list, objectX, objectY)
local x, y = (list.x - objectX), (list.y - objectY)

return x >= -list.radiusX and x <= list.radiusX and y >= -list.radiusY and y <= list.radiusY
end
})

textarea.x = 400
textarea.y = 350

ui.addTextArea(0, "", nil, textarea.x - textarea.radiusX , textarea.y - textarea.radiusY, textAreaWIDTH, textAreaHEIGHT, 1, 1, .5, false)

eventLoop = function()
for k, v in next, tfm.get.room.playerList do
if not v.hasCheese and textarea(v.x, v.y) then
tfm.exec.giveCheese(k)
end
end
end

interesting!

Dernière modification le 1522699080000
Shianinja
« Citoyen »
1522704600000
    • Shianinja#2005
    • Profil
    • Derniers messages
    • Tribu
#2823
  0
I want a script that rains lava in 30 secounds

Dernière modification le 1522705680000
Vekout
« Citoyen »
1522705620000
    • Vekout#0000
    • Profil
    • Derniers messages
    • Tribu
#2824
  0
Bolodefchoco a dit :
Vekout a dit :
Vekout a dit :
Hey guys!

I need a textArea that simulates being a cheese, when my mouse "touch the textArea" give me the cheese. Please<3

When I say "touch", I don't mean to click, I mean, the exact coordinates of textarea

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
local textAreaWIDTH = 100
local textAreaHEIGHT = 50

local textarea = setmetatable({ x = 0, y = 0, radiusX = (textAreaWIDTH+5) / 2, radiusY = (textAreaHEIGHT+5) / 2}, {
__call = function(list, objectX, objectY)
local x, y = (list.x - objectX), (list.y - objectY)

return x >= -list.radiusX and x <= list.radiusX and y >= -list.radiusY and y <= list.radiusY
end
})

textarea.x = 400
textarea.y = 350

ui.addTextArea(0, "", nil, textarea.x - textarea.radiusX , textarea.y - textarea.radiusY, textAreaWIDTH, textAreaHEIGHT, 1, 1, .5, false)

eventLoop = function()
for k, v in next, tfm.get.room.playerList do
if not v.hasCheese and textarea(v.x, v.y) then
tfm.exec.giveCheese(k)
end
end
end

Thanks bro, but, if i want to do more than one TextArea in different positions, I need to do a function for each one?
Onkei
« Citoyen »
1522705860000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2825
  0
Shianinja a dit :
I want a script that rains lava


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
local currentTime = 0

function rainLava(mapLength)
tfm.exec.addPhysicObject(0, math.random(mapLength), 0, {
type = 3,
width = 10,
height = 10,
friction = 0.2,
restitution = 20,
miceCollision = true,
groundCollision = false,
dynamic = true,
fixedRotation = true,
mass = 20,
linearDamping = 0
})
end

function eventLoop(passed, left)
currentTime = currentTime + 0.5

if currentTime == 2 then
currentTime = 0
rainLava(800)
end
end
Shianinja
« Citoyen »
1522706640000
    • Shianinja#2005
    • Profil
    • Derniers messages
    • Tribu
#2826
  1
Shianinja a dit :
I want a script that rains lava

Onkei a dit :
Shianinja a dit :
I want a script that rains lava


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
local currentTime = 0

function rainLava(mapLength)
tfm.exec.addPhysicObject(0, math.random(mapLength), 0, {
type = 3,
width = 10,
height = 10,
friction = 0.2,
restitution = 20,
miceCollision = true,
groundCollision = false,
dynamic = true,
fixedRotation = true,
mass = 20,
linearDamping = 0
})
end

function eventLoop(passed, left)
currentTime = currentTime + 0.5

if currentTime == 2 then
currentTime = 0
rainLava(800)
end
end

tank's <3 your avatar is beautiful
Bolodefchoco
« Sénateur »
1522718280000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2827
  0
Vekout a dit :
Bolodefchoco a dit :
Vekout a dit :
Vekout a dit :
Hey guys!

I need a textArea that simulates being a cheese, when my mouse "touch the textArea" give me the cheese. Please<3

When I say "touch", I don't mean to click, I mean, the exact coordinates of textarea

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
local textAreaWIDTH = 100
local textAreaHEIGHT = 50

local textarea = setmetatable({ x = 0, y = 0, radiusX = (textAreaWIDTH+5) / 2, radiusY = (textAreaHEIGHT+5) / 2}, {
__call = function(list, objectX, objectY)
local x, y = (list.x - objectX), (list.y - objectY)

return x >= -list.radiusX and x <= list.radiusX and y >= -list.radiusY and y <= list.radiusY
end
})

textarea.x = 400
textarea.y = 350

ui.addTextArea(0, "", nil, textarea.x - textarea.radiusX , textarea.y - textarea.radiusY, textAreaWIDTH, textAreaHEIGHT, 1, 1, .5, false)

eventLoop = function()
for k, v in next, tfm.get.room.playerList do
if not v.hasCheese and textarea(v.x, v.y) then
tfm.exec.giveCheese(k)
end
end
end

Thanks bro, but, if i want to do more than one TextArea in different positions, I need to do a function for each one?

so you'll need to make textarea an object. ask it and i can try something :P
Vekout
« Citoyen »
1522746480000
    • Vekout#0000
    • Profil
    • Derniers messages
    • Tribu
#2828
  0
I need several TextArea that will appeared anywhere on the map (separated) and when my mouse "touch some textArea" give me the cheese. Please
Bolodefchoco
« Sénateur »
1522755060000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2829
  0
Vekout a dit :
I need several TextArea that will appeared anywhere on the map (separated) and when my mouse "touch some textArea" give me the cheese. Please

I already answered you.........
Onkei
« Citoyen »
1522759500000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2830
  0
Vekout a dit :
I need several TextArea that will appeared anywhere on the map (separated) and when my mouse "touch some textArea" give me the cheese. Please


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
local textareaCoords = {}

local SETTINGS = {
mapLength = 800,
textareaAmount = 5,
textareaSize = 40,
}

function eventNewGame()
textareaCoords = {}

for id = 1, SETTINGS.textareaAmount do
local rand = math.random
local x, y = rand(SETTINGS.mapLength), rand(350)

textareaCoords[#textareaCoords + 1] = {x = x, y = y}
ui.addTextArea(id, "", nil, x, y, SETTINGS.textareaSize, SETTINGS.textareaSize, 0x324650, 0x212F36, 0.8, false)
end
end

function eventLoop(passed, left)
for n, data in next, tfm.get.room.playerList do
for i, coords in next, textareaCoords do

if data.x > coords.x and data.x < coords.x + SETTINGS.textareaSize and data.y > coords.y and data.y < coords.y + SETTINGS.textareaSize then
tfm.exec.giveCheese(n)
break
end
end
end
end

eventNewGame()
Shianinja
« Citoyen »
1522783860000
    • Shianinja#2005
    • Profil
    • Derniers messages
    • Tribu
#2831
  0
Bolodefchoco a dit :
Vekout a dit :
I need several TextArea that will appeared anywhere on the map (separated) and when my mouse "touch some textArea" give me the cheese. Please

I already answered you.........

I know you from somewhere haha.
Shianinja
« Citoyen »
1522786560000
    • Shianinja#2005
    • Profil
    • Derniers messages
    • Tribu
#2832
  0
Onkei a dit :
Vekout a dit :
I need several TextArea that will appeared anywhere on the map (separated) and when my mouse "touch some textArea" give me the cheese. Please


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
local textareaCoords = {}

local SETTINGS = {
mapLength = 800,
textareaAmount = 5,
textareaSize = 40,
}

function eventNewGame()
textareaCoords = {}

for id = 1, SETTINGS.textareaAmount do
local rand = math.random
local x, y = rand(SETTINGS.mapLength), rand(350)

textareaCoords[#textareaCoords + 1] = {x = x, y = y}
ui.addTextArea(id, "", nil, x, y, SETTINGS.textareaSize, SETTINGS.textareaSize, 0x324650, 0x212F36, 0.8, false)
end
end

function eventLoop(passed, left)
for n, data in next, tfm.get.room.playerList do
for i, coords in next, textareaCoords do

if data.x > coords.x and data.x < coords.x + SETTINGS.textareaSize and data.y > coords.y and data.y < coords.y + SETTINGS.textareaSize then
tfm.exec.giveCheese(n)
break
end
end
end
end

eventNewGame()


Can I ask for another script?
Vekout
« Citoyen »
1522786860000
    • Vekout#0000
    • Profil
    • Derniers messages
    • Tribu
#2833
  0
Onkei a dit :
Vekout a dit :
I need several TextArea that will appeared anywhere on the map (separated) and when my mouse "touch some textArea" give me the cheese. Please


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
local textareaCoords = {}

local SETTINGS = {
mapLength = 800,
textareaAmount = 5,
textareaSize = 40,
}

function eventNewGame()
textareaCoords = {}

for id = 1, SETTINGS.textareaAmount do
local rand = math.random
local x, y = rand(SETTINGS.mapLength), rand(350)

textareaCoords[#textareaCoords + 1] = {x = x, y = y}
ui.addTextArea(id, "", nil, x, y, SETTINGS.textareaSize, SETTINGS.textareaSize, 0x324650, 0x212F36, 0.8, false)
end
end

function eventLoop(passed, left)
for n, data in next, tfm.get.room.playerList do
for i, coords in next, textareaCoords do

if data.x > coords.x and data.x < coords.x + SETTINGS.textareaSize and data.y > coords.y and data.y < coords.y + SETTINGS.textareaSize then
tfm.exec.giveCheese(n)
break
end
end
end
end

eventNewGame()

Thanks man, but can you make the coordinates not so exact? i mean, if my mouse is 10 cm away from the textArea that gives me cheese, or some parameters to modify the radius
Onkei
« Citoyen »
1522788120000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2834
  0
Vekout a dit :
Thanks man, but can you make the coordinates not so exact? i mean, if my mouse is 10 cm away from the textArea that gives me cheese, or some parameters to modify the radius

This should do the trick :P


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
local textareaCoords = {}

local SETTINGS = {
mapLength = 800,
textareaAmount = 5,
textareaSize = 40,
}

function eventNewGame()
textareaCoords = {}

for id = 1, SETTINGS.textareaAmount do
local rand = math.random
local x, y = rand(SETTINGS.mapLength), rand(350)

textareaCoords[#textareaCoords + 1] = {x = x, y = y}
ui.addTextArea(id, "", nil, x, y, SETTINGS.textareaSize, SETTINGS.textareaSize, 0x324650, 0x212F36, 0.8, false)
end
end

function eventLoop(passed, left)
for n, data in next, tfm.get.room.playerList do
for i, coords in next, textareaCoords do

if data.x > coords.x - 10 and data.x < coords.x + SETTINGS.textareaSize + 10 and data.y > coords.y - 10 and data.y < coords.y + SETTINGS.textareaSize + 10 then
tfm.exec.giveCheese(n)
break
end
end
end
end

eventNewGame()

Shianinja a dit :
Can I ask for another script?

You can just keep posting your requests in the thread and I'll get to them eventually lol
Overjoy06
« Citoyen »
1522823160000
    • Overjoy06#8554
    • Profil
    • Derniers messages
    • Tribu
#2835
  0
Is it possible that the random person that got teleported example code :
Code Lua

1
2
3
4
5
6
players = {}
for name, data in next, tfm.get.room.playerList do
table.insert(players, name)
end
randomPlayer = players[math.random(1,#players)]
tfm.exec.movePlayer(randomPlayer,400,200,false,0,50,false)
The random person who got teleported can only see some textareas
And yes, this is a new account
Onkei
« Citoyen »
1522837620000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2836
  0
Overjoy06 a dit :
Is it possible that the random person that got teleported example code :
The random person who got teleported can only see some textareas
And yes, this is a new account

The ui.addTextArea method has an argument that you can specify which player can see the textArea. If a name is given, only that player can see the textArea, nil if you want everyone to see it.

In this case, randomPlayer is feeded into the method as the argument, so only the randomly selected player can see the textArea.


Code Lua

1
2
3
4
5
6
7
8
9
10
players = {}

for name, data in next, tfm.get.room.playerList do
table.insert(players, name)
end

randomPlayer = players[math.random(1, #players)]

tfm.exec.movePlayer(randomPlayer, 400, 200, false, 0, 50, false)
ui.addTextArea(0, "Only the randomly selected player can see this.", randomPlayer, 20, 20, nil, 30, 0x324650, 0x212F36, 0.8, false)
Overjoy06
« Citoyen »
1522914000000
    • Overjoy06#8554
    • Profil
    • Derniers messages
    • Tribu
#2837
  0
thanks
Alsalam_alaikum
« Citoyen »
1523222580000
    • Alsalam_alaikum#5209
    • Profil
    • Derniers messages
#2838
  0
Example of a !p [username] function?
Bolodefchoco
« Sénateur »
1523229480000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2839
  1
Fuzzyfirsdog a dit :
Example of a !p [username] function?

Code Lua

1
2
3
4
5
6
eventChatCommand = function(n, c)
local name = c:match("^p +([A-Za-z0-9_%+]+#%d%d%d%d)")
if name and tfm.get.room.playerList[name] then
-- do whatever you want
end
end
Alsalam_alaikum
« Citoyen »
1523236440000
    • Alsalam_alaikum#5209
    • Profil
    • Derniers messages
#2840
  0
Thanks ^
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 142 / 160 › »
© Atelier801 2018

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

Version 1.27