×

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] lsmap Tester
[Script] lsmap Tester
Fatihmilano
« Citoyen »
1587266220000
    • Fatihmilano#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  1
(This script was coded by Lays#1146. Here is the original thread in Turkish.)
You can easily load and test your maps on /lsmap by copying the whole text on /lsmap and pasting it to the variable LSMAP.

In addition to this, there is a menu to enable disabled functions and to control respawn/teleport settings.
You can also choose the players who can use the menu by configuring AUTH like this: AUTH="Lays#1146"


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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
---
-- LSMap Tester v1.1
-- Transforlays
---

LSMAP=[[
Here is for the output of /lsmap
]]
AUTH=nil
MAPS={}

PAGES={}
KEYS={}
UI_LIST=444
UI_NEXT=445
UI_PREV=446
UI_INFO=447
UI_SETTINGS=448
UI_POS_X=-200
KEY_TELEPORT=17

AUTO_RESPAWN=true
tfm.exec.enableAutoRespawn = function(state)
AUTO_RESPAWN = state
end

ALLOW_TELEPORT=true
tfm.exec.enableTeleport = function(state)
ALLOW_TELEPORT = state
end

SETTINGS = {
["disableAfkDeath"] = true,
["disableAutoNewGame"] = true,
["disableAutoShaman"] = true,
["enableAutoRespawn"] = true,
["enableTeleport"] = true,
["disableAllShamanSkills"] = false,
["disableAutoScore"] = false,
["disableAutoTimeLeft"] = false,
["disableDebugCommand"] = false,
["disableMinimalistMode"] = false,
["disableMortCommand"] = false,
["disablePhysicalConsumables"] = false,
["disablePrespawnPreview"] = false,
["disableWatchCommand"] = false,
}

function init()
parseMaps()
generatePages()
showPage(1)

for k, v in pairs(tfm.get.room.playerList) do
eventNewPlayer(k)
end
end

function parseMaps()
local vote, percent, cat
for id, rest in LSMAP:gmatch('(@%d+)(.-)\n') do
if rest then
vote, percent, cat = rest:match('^ %- (%d+) %- (%d+)%% %- (%S+)$')
end
table.insert(MAPS, {id=id, vote=tonumber(vote) or 0, percent=tonumber(percent) or 100, cat=cat or 'P?'})
end
end

function generatePages()
local str=""
local line=""

for k, v in pairs(MAPS) do
line = string.format("<a href='event:%s'>%s\t%d\t%d%%\t%s</a>\n", v.id, v.id, v.vote, v.percent, v.cat)
if #str + #line > 2000 then
table.insert(PAGES, str)
str = ""
end
str = str .. line
end

if #str > 0 then
table.insert(PAGES, str)
end
end

function showSettings()
local str = "\n<ROSE><b><a href='event:X'>Close</a></b>"

for k, v in pairs(SETTINGS) do
tfm.exec[k](v)
str = string.format("%s<a href='event:%s'>%s</a>\n%s", v and "<VP>" or "<R>", k, k, str)
end

ui.addTextArea(UI_SETTINGS, str, AUTH, UI_POS_X+200, 30, nil, nil, 1, 0, 0.8, true)
end

function showPage(num)
if #PAGES >= num and num > 0 then
ui.addTextArea(UI_LIST, PAGES[num], AUTH, UI_POS_X, 30, nil, nil, 1, 0, 0.8, true)

if num > 1 then
ui.addTextArea(UI_PREV, string.format("<a href='event:%d'>&lt;&lt;</a>", num-1), AUTH, UI_POS_X, 0, nil, nil, 1, 0, 0.8, true)
else
ui.removeTextArea(UI_PREV, AUTH)
end

if num < #PAGES then
ui.addTextArea(UI_NEXT, string.format("<a href='event:%d'>&gt;&gt;</a>", num+1), AUTH, UI_POS_X+40, 0, nil, nil, 1, 0, 0.8, true)
else
ui.removeTextArea(UI_NEXT, AUTH)
end

ui.addTextArea(UI_INFO, string.format("<ROSE>%d <G>- <a href='event:S'>Settings</a>", num), AUTH, UI_POS_X+80, 0, nil, nil, 1, 0, 0.8, true)
end
end

function eventTextAreaCallback(textAreaId, playerName, eventName)
if AUTH and playerName ~= AUTH then
return
end

if textAreaId == UI_LIST then
tfm.exec.newGame(eventName)
elseif textAreaId == UI_NEXT or textAreaId == UI_PREV then
showPage(tonumber(eventName))
elseif textAreaId == UI_INFO then
showSettings()
elseif textAreaId == UI_SETTINGS then
if eventName == 'X' then
ui.removeTextArea(UI_SETTINGS, AUTH)
elseif SETTINGS[eventName] ~= nil then
SETTINGS[eventName] = not SETTINGS[eventName]
showSettings()
end
end
end

function eventNewPlayer(playerName)
KEYS[playerName] = {}

tfm.exec.bindKeyboard(playerName, KEY_TELEPORT, true, true)
tfm.exec.bindKeyboard(playerName, KEY_TELEPORT, false, true)
system.bindMouse(playerName, true)

if AUTO_RESPAWN then
tfm.exec.respawnPlayer(playerName)
end
end

function eventPlayerLeft(playerName)
KEYS[playerName] = nil
end

function eventPlayerDied(playerName)
if AUTO_RESPAWN then
tfm.exec.respawnPlayer(playerName)
end
end

function eventPlayerWon(playerName, timeElapsed, timeElapsedSinceRespawn)
if AUTO_RESPAWN then
tfm.exec.respawnPlayer(playerName)
end
end

function eventKeyboard(playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
KEYS[playerName][keyCode] = down
end

function eventMouse(playerName, xMousePosition, yMousePosition)
if ALLOW_TELEPORT or playerName == AUTH then
if KEYS[playerName][KEY_TELEPORT] then
tfm.exec.respawnPlayer(playerName)
tfm.exec.movePlayer(playerName, xMousePosition, yMousePosition)
end
end
end

init()
Onkei
« Citoyen »
1587284520000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
This is a really useful utility, nice job !
Aron
« Censeur »
1587289620000
    • Aron#6810
    • Profil
    • Derniers messages
    • Tribu
#3
  0
nice , I like it
Lays
« Citoyen »
1666621320000
    • Lays#1146
    • Profil
    • Derniers messages
    • Tribu
#4
  1
I have developed v2 for this script a couple months ago, you can get the code at
https://gist.github.com/webninjasi/3d9815a87348a62c57ea70a800924241
It also prints how many maps you have in each category on #lua logs along with the following help messages:
Press SHIFT to browse maps and O to change the settings
Hold CTRL and CLICK somewhere to teleport
Use + and - keys in order to open next and previous map in your list
Let your friends browse your maps: !allow [name] (also !disallow [name])
Nnaaaz
« Citoyen »
1666730880000
    • Nnaaaz#0000
    • Profil
    • Derniers messages
    • Tribu
#5
  2
Nice tool

so helpful with a 400+ map list :P

https://i.imgur.com/ehDcBUb.png
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] lsmap Tester
© Atelier801 2018

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

Version 1.27