×

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
« ‹ 135 / 160 › »
Script Requests
Bolodefchoco
« Sénateur »
1516477140000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2681
  0
You can whisper me ingame too, so I can help you faster :D

What is not working?
Borntolol
« Citoyen »
1516477980000
    • Borntolol#0000
    • Profil
    • Derniers messages
    • Tribu
#2682
  0
Okay, ill do so
Borntolol
« Citoyen »
1516478940000
    • Borntolol#0000
    • Profil
    • Derniers messages
    • Tribu
#2683
  0
So for the module script, how do i make a map randomiser? And everytime the timer finishes, the map changes
Bolodefchoco
« Sénateur »
1516487160000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2684
  0
Borntolol a dit :
So for the module script, how do i make a map randomiser? And everytime the timer finishes, the map changes

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
34
35
36
37
maps = {5519723, 3189221, 1837313, 1238132} -- Put the map codes between the { }, without the "@"

alive = function()
local out = 0
for k,v in next,tfm.get.room.playerList do
if not v.isDead then
out = out + 1
end
end
return out
end

newMap = false
eventNewGame = function()
newMap = true
end

map_id = 1
eventLoop = function(current, elapsed)
-- time < 1s or alive < 1
if current <= 1000 or (current >= 3500 and alive() < 1) then
if newMap then
map_id = map_id + 1
-- Resets the rotation when all the maps were loaded
if map_id > #maps then
map_id = 1
end
newMap = false
end

tfm.exec.newGame(maps[map_id])
end
end

tfm.exec.disableAutoNewGame()
tfm.exec.disableAutoShaman()
tfm.exec.newGame(maps[map_id])

Dernière modification le 1516488300000
Borntolol
« Citoyen »
1516488120000
    • Borntolol#0000
    • Profil
    • Derniers messages
    • Tribu
#2685
  0
How would i do that but there is no shaman and the map changes when the time runs out or theres no mice left alive
Borntolol
« Citoyen »
1516489080000
    • Borntolol#0000
    • Profil
    • Derniers messages
    • Tribu
#2686
  0
This is my current code so far... Do you have any idea why the map keeps resetting after 5 mice have been reached?
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
countMice = function()
local total = 0
for k in next, tfm.get.room.playerList do
total = total + 1
end
return total
end

isWaiting = false

-- Triggered twice per second
eventLoop = function()
local totalMice = countMice()
if totalMice > 4 then
if isWaiting then
isWaiting = false
print("Now it has more than 4 mice!")
end
-- TODO Module script
tfm.exec.disableAutoShaman()
maps = {7366621, 7366621 , 7366621, 7366621} -- Put the map codes between the { }, without the "@"

alive = function()
local out = 0
for k,v in next,tfm.get.room.playerList do
if not v.isDead then
out = out
end
end
return out
end

newMap = false
eventNewGame = function()
newMap = true
end

map_id = 1
eventLoop = function(current, elapsed)
-- time < 1s or alive < 1
if current <= 1000 or (current >= 3500 and alive() < 1) then
if newMap then
map_id = map_id + 1
-- Resets the rotation when all the maps were loaded
if map_id > #maps then
map_id = 1
end
newMap = false
end

tfm.exec.newGame(maps[map_id])
end
end

tfm.exec.disableAutoNewGame()
tfm.exec.disableAutoShaman()
tfm.exec.newGame(maps[map_id])
-- time <

else -- <= 4

-- This if is needed, otherwise there'll be a newGame every single time
if not isWaiting then
isWaiting = true
tfm.exec.disableAutoShaman()
tfm.exec.disableAfkDeath()
tfm.exec.disableAutoScore()
tfm.exec.newGame("@7366519")
tfm.exec.setNameColor("Borntolol", 0xFE0000)
tfm.exec.disableAutoNewGame()
ui.setShamanName("5 mice for start!")
ui.setMapName ("Lobby")
end

end
end

Dernière modification le 1516489680000
Bolodefchoco
« Sénateur »
1516490580000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2687
  0
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
countMice = function(alive)
local total = 0
for k, v in next, tfm.get.room.playerList do
if not alive or not v.isDead then
total = total + 1
end
end
return total
end

maps = {7366621, 7366621 , 7366621, 7366621} -- Put the map codes between the { }, without the "@"
tfm.exec.disableAutoShaman()
tfm.exec.disableAfkDeath()
tfm.exec.disableAutoScore()
tfm.exec.disableAutoNewGame()

map_id = 1
first_round = true
isWaiting = false

-- Triggered twice per second
eventLoop = function(current, elapsed)
local totalMice = countMice()
if totalMice > 4 then
if isWaiting then
isWaiting = false
print("Now it has more than 4 mice!")
end

-- time < 1s or alive < 1
if first_round or elapsed <= 1000 or (current >= 3500 and countMice(true) < 1) then
first_round = false
if newMap then
map_id = map_id + 1
-- Resets the rotation when all the maps were loaded
if map_id > #maps then
map_id = 1
end
newMap = false
end

tfm.exec.newGame(maps[map_id])
end
else -- <= 4
-- This if is needed, otherwise there'll be a newGame every single time
if not isWaiting then
isWaiting = true
tfm.exec.newGame("@7366519")
tfm.exec.setNameColor("Borntolol", 0xFE0000)
ui.setShamanName("5 mice for start!")
ui.setMapName ("Lobby")
end

end
end

newMap = false
eventNewGame = function()
newMap = true
end

-- respawn
eventPlayerDied = function(n)
if isWaiting then
tfm.exec.respawnPlayer(n)
end
end
eventNewPlayer = function(n)
eventPlayerDied(n)
end

Dernière modification le 1516492380000
Hackinnzkt
« Citoyen »
1516528620000
    • Hackinnzkt#0000
    • Profil
    • Derniers messages
    • Tribu
#2688
  0
Checkpoint in the map please
Bolodefchoco
« Sénateur »
1516543260000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2689
  0
Hackinnzkt a dit :
Checkpoint in the map please

A shortcut is to use /module hardcamp and the command !checkpoint, but

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
34
35
36
37
38
39
40
41
42
43
info = {}
eventNewPlayer = function(n)
info[n] = {
checkpointCoordinates = {},
holdingShift = false
}
-- Press E to add a checkpoint and Shift + E to remove
system.bindKeyboard(n, string.byte("E"), true, true)
for i = 0, 1 do system.bindKeyboard(n, 16, i==0, true) end
end
table.foreach(tfm.get.room.playerList, eventNewPlayer)

eventKeyboard = function(n, k, d, x, y)
if k == string.byte("E") then
if info[n].holdingShift then
info[n].checkpointCoordinates = {}
ui.removeTextArea(0, n)
else
info[n].checkpointCoordinates = {x, y}
ui.addTextArea(0, "" , n, x-5, y-5, 10, 10, 0x56A75A, 0x56A75A, .5, true)
end
elseif k == 16 then
info[n].holdingShift = d
end
end

eventNewGame = function()
for k, v in next, info do
v.checkpointCoordinates = {nil, nil}
ui.removeTextArea(0, k)
end
end

eventPlayerDied = function(n)
tfm.exec.respawnPlayer(n)
if #info[n].checkpointCoordinates > 0 then
tfm.exec.movePlayer(n, info[n].checkpointCoordinates[1], info[n].checkpointCoordinates[2])
end
end

eventPlayerWon = function(n)
tfm.exec.respawnPlayer(n)
end
Hackinnzkt
« Citoyen »
1516601340000
    • Hackinnzkt#0000
    • Profil
    • Derniers messages
    • Tribu
#2690
  0
Bolodefchoco a dit :
Hackinnzkt a dit :
Checkpoint in the map please

A shortcut is to use /module hardcamp and the command !checkpoint, but

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
34
35
36
37
38
39
40
41
42
43
info = {}
eventNewPlayer = function(n)
info[n] = {
checkpointCoordinates = {},
holdingShift = false
}
-- Press E to add a checkpoint and Shift + E to remove
system.bindKeyboard(n, string.byte("E"), true, true)
for i = 0, 1 do system.bindKeyboard(n, 16, i==0, true) end
end
table.foreach(tfm.get.room.playerList, eventNewPlayer)

eventKeyboard = function(n, k, d, x, y)
if k == string.byte("E") then
if info[n].holdingShift then
info[n].checkpointCoordinates = {}
ui.removeTextArea(0, n)
else
info[n].checkpointCoordinates = {x, y}
ui.addTextArea(0, "" , n, x-5, y-5, 10, 10, 0x56A75A, 0x56A75A, .5, true)
end
elseif k == 16 then
info[n].holdingShift = d
end
end

eventNewGame = function()
for k, v in next, info do
v.checkpointCoordinates = {nil, nil}
ui.removeTextArea(0, k)
end
end

eventPlayerDied = function(n)
tfm.exec.respawnPlayer(n)
if #info[n].checkpointCoordinates > 0 then
tfm.exec.movePlayer(n, info[n].checkpointCoordinates[1], info[n].checkpointCoordinates[2])
end
end

eventPlayerWon = function(n)
tfm.exec.respawnPlayer(n)
end

It's fine, but i forgot to say: Checkpoint like a bootcamp...
Bolodefchoco
« Sénateur »
1516629720000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2691
  0
Hackinnzkt a dit :
Bolodefchoco a dit :
Hackinnzkt a dit :
Checkpoint in the map please

A shortcut is to use /module hardcamp and the command !checkpoint, but

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
34
35
36
37
38
39
40
41
42
43
info = {}
eventNewPlayer = function(n)
info[n] = {
checkpointCoordinates = {},
holdingShift = false
}
-- Press E to add a checkpoint and Shift + E to remove
system.bindKeyboard(n, string.byte("E"), true, true)
for i = 0, 1 do system.bindKeyboard(n, 16, i==0, true) end
end
table.foreach(tfm.get.room.playerList, eventNewPlayer)

eventKeyboard = function(n, k, d, x, y)
if k == string.byte("E") then
if info[n].holdingShift then
info[n].checkpointCoordinates = {}
ui.removeTextArea(0, n)
else
info[n].checkpointCoordinates = {x, y}
ui.addTextArea(0, "" , n, x-5, y-5, 10, 10, 0x56A75A, 0x56A75A, .5, true)
end
elseif k == 16 then
info[n].holdingShift = d
end
end

eventNewGame = function()
for k, v in next, info do
v.checkpointCoordinates = {nil, nil}
ui.removeTextArea(0, k)
end
end

eventPlayerDied = function(n)
tfm.exec.respawnPlayer(n)
if #info[n].checkpointCoordinates > 0 then
tfm.exec.movePlayer(n, info[n].checkpointCoordinates[1], info[n].checkpointCoordinates[2])
end
end

eventPlayerWon = function(n)
tfm.exec.respawnPlayer(n)
end

It's fine, but i forgot to say: Checkpoint like a bootcamp...

It works perfectly in any script.
If you want no shaman, just add tfm.exec.disableAutoShaman() in the last line ^_^

You may want to play hardcamp, that is what you need.
/room *#hardcamp0@Hackinnzkt
https://image.prntscr.com/image/VxWRorflQhCLREU-_W3dOw.pnghttps://image.prntscr.com/image/HPe8sqIXRUycVWerMjj48w.png

Dernière modification le 1516629780000
Heniyengui
« Citoyen »
1516640160000
    • Heniyengui#0000
    • Profil
    • Derniers messages
#2692
  0
Hey, is there a limit to the tfm.exec.addPhysicObject ? Because everytime I add a lot of physic objects with a for loop there is many grounds that are not added, and what's worse is that I can't use the tfm.exec.removePhysicObject when I reach the limit. Can someone tell me why is this?
Bolodefchoco
« Sénateur »
1516643400000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2693
  0
Heniyengui a dit :
Hey, is there a limit to the tfm.exec.addPhysicObject ? Because everytime I add a lot of physic objects with a for loop there is many grounds that are not added, and what's worse is that I can't use the tfm.exec.removePhysicObject when I reach the limit. Can someone tell me why is this?

I don't think so. Are you updating the IDs?
For example
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
start = false
eventNewGame = function()
start = true
for i = 0, 100 do
tfm.exec.addPhysicObject(i, i * 8, i * 4, { type = 0, miceCollision = true, groundCollision = true, width = 10, height = 10 })
end
end

eventLoop = function(elapsed)
if start then
if elapsed > 5000 then
for i = 0, 100 do tfm.exec.removePhysicObject(i) end
end
end
end
tfm.exec.newGame(0)

Dernière modification le 1516643460000
Heniyengui
« Citoyen »
1516644180000
    • Heniyengui#0000
    • Profil
    • Derniers messages
#2694
  0
Bolodefchoco a dit :
Heniyengui a dit :
Hey, is there a limit to the tfm.exec.addPhysicObject ? Because everytime I add a lot of physic objects with a for loop there is many grounds that are not added, and what's worse is that I can't use the tfm.exec.removePhysicObject when I reach the limit. Can someone tell me why is this?

I don't think so. Are you updating the IDs?
For example
LUA CODE

Yes, I am sure I am updating the IDS, I even tried a new script to test.
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
local a = 0
local b = 0
local c = 0
function eventLoop(ct,rt)
a = a + 1
b = b + 1
tfm.exec.addPhysicObject(b,a*10-5,c+50,{})
if a == 80 then
a = 0
c = c + 10
end
end
The result was 488. No grounds were added after the first 488 grounds.
Bolodefchoco
« Sénateur »
1516645740000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2695
  0
Heniyengui a dit :
Bolodefchoco a dit :
Heniyengui a dit :
Hey, is there a limit to the tfm.exec.addPhysicObject ? Because everytime I add a lot of physic objects with a for loop there is many grounds that are not added, and what's worse is that I can't use the tfm.exec.removePhysicObject when I reach the limit. Can someone tell me why is this?

I don't think so. Are you updating the IDs?
For example
LUA CODE

Yes, I am sure I am updating the IDS, I even tried a new script to test.
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
local a = 0
local b = 0
local c = 0
function eventLoop(ct,rt)
a = a + 1
b = b + 1
tfm.exec.addPhysicObject(b,a*10-5,c+50,{})
if a == 80 then
a = 0
c = c + 10
end
end
The result was 488. No grounds were added after the first 488 grounds.

Yeah looks like the limit is 488 :c I didn't know that
btw i can remove them
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local a = 0
local b = 0
local c = 0
local t = 0
function eventLoop(ct,rt)
for i = 1,10 do
t = t + 1
if t < 489 or b < 0 then
if b<0 then t = 1 end
a = a + 1
b = b + 1
tfm.exec.addPhysicObject(b,a*10-5,c+50,{})
if a == 80 then
a = 0
c = c + 10
end
else
tfm.exec.removePhysicObject(b)
b = b - 1
end
end
end

Dernière modification le 1516646220000
Heniyengui
« Citoyen »
1516658460000
    • Heniyengui#0000
    • Profil
    • Derniers messages
#2696
  0
is it possible to get the list of grounds in the map? as well as their propreties?
Bolodefchoco
« Sénateur »
1516659300000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2697
  0
Heniyengui a dit :
is it possible to get the list of grounds in the map? as well as their propreties?

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
string.split = function(str, pattern, f)
local out = {}
for value in string.gmatch(str, pattern) do
out[#out + 1] = not f and value or f(value)
end
return out
end
local map = {}
eventNewGame = function()
map = {}

local xml = (tfm.get.room.xmlMapInfo or {}).xml or ""

local property = {}

local setValue = function(name, _, value)
property[name] = (value:find(",") and string.split(value, "[^,]+") or tonumber(value) or value)
end

string.gsub(xml, "<S (.-)/>", function(attributes)
property = {}

string.gsub(attributes, "([%-%w]+)=([\"'])(.-)%2", setValue)
map[#map + 1] = property
end)

for i = 1, #map do
-- Prints the type of each ground in the map
print(map[i].T)
end
end
Overjoy06
« Citoyen »
1517129640000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#2698
  0
Hey, how do you make a script like this :
When you click a message it will activates a map.
Thanks if you know it, and told me ^_^
Overjoy06
« Citoyen »
1517134740000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#2699
  0
Jesus how long has this been?
Bolodefchoco
« Sénateur »
1517146680000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#2700
  0
Overjoy06 a dit :
Hey, how do you make a script like this :
When you click a message it will activates a map.
Thanks if you know it, and told me ^_^

Code Lua

1
2
3
4
system.bindMouse("Overjoy06", true)
eventMouse = function(n)
tfm.exec.newGame("#1") --> Change #1 with a @Code if you want
end

Overjoy06 a dit :
Jesus how long has this been?

be patient next time, we also sleep, eat, watch stuff and we are not really obligated to answer you all in 5 minutes :/
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 135 / 160 › »
© Atelier801 2018

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

Version 1.27