×

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
« ‹ 25 / 33 › »
Lua Snippets
Issey
« Citoyen »
1383223680000
    • Issey#0000
    • Profil
    • Derniers messages
#481
  0
a dit :
function popUp(id,type,string,name,x,y,width)
name=name or nil
width=width or nil
local px
if name then
px=tfm.get.room.playerList[name].x
px=(px>400) and (px-200) or 300
print(px)
else px=300
end
x=x or px
y=y or 180
ui.addPopup(id,type,string,name,x,y,width)
end

useful in scrolling maps, only horizontal
use popUp(int ID, int TYPE, string text) other params are optional

EDIT: kinda useless with the new commands
Fecole
1383234780000
    • Fecole#0000
    • Profil
    • Derniers messages
#482
[Modéré par Katburger, raison : Spam]
Mikuhl
« Citoyen »
1383491400000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#483
  0
Makinit a dit :
Eternal snow:

Added this. *-*
Secretuuuuul
« Citoyen »
1383999360000
    • Secretuuuuul#0000
    • Profil
    • Derniers messages
    • Tribu
#484
  0
how to use
function eventChatCommand(name, cmd)
local cmd_args = {}
for arg in cmd:gmatch("[^%s]+") do -- splits the command by spaces.
table.insert(cmd_args, arg) -- inserts them into the table
end
if cmd_args[1] == "color" then -- checks if the first word in the table is color
tfm.exec.setNameColor(cmd_args[2], tonumber("0x"..cmd_args[3])) -- uses the second argument as a name, and the third as a hex code.
end
end
Beachking
« Citoyen »
1384005720000
    • Beachking#0000
    • Profil
    • Derniers messages
    • Tribu
#485
  0
a dit :
function eventChatCommand(name, cmd)
if cmd:sub(0,4) == "chat" then
for k,chatter in pairs(devs) do
print("<font color='#FAD320'> ["..name.."]<N> "..string.sub(cmd, 6).." </font>",chatter)
end
end
end
devs = {"NAME,NAME,NAME"}
system.disableChatCommandDisplay('chat',true)

This is like whisper. Who ever runs the script will recieve a message from a certain player. Only the person who ran it can see the message unfortuantely. You can change the colour of [..name..]
Mikuhl
« Citoyen »
1384009980000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#486
  0
Secretuuuuul a dit :
how to use

When you do a command the first argument would always be the command (!color)
The second argument would be anything you put after the command with a space. (!color Jaackster)
The third argument would be anything you put after the second argument with a space. (!color Jaackster FF0000)
Spartttt
« Citoyen »
1384632540000
    • Spartttt#0000
    • Profil
    • Derniers messages
#487
  0
thanks
Safwanrockz
« Censeur »
1385768040000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#488
  0
Lua script for drawing, with !setcolor, !clear and !brush commands.
a dit :

for name,player in pairs(tfm.get.room.playerList) do
system.bindMouse(name,true)
end

id=0
color = "0xFFFFFF"
brush=1

function eventChatCommand(n,c)
local arg={}
for argument in c:gmatch("[^%s]+") do
table.insert(arg, argument)
end
if c=="clear" then
for i=1,id do
ui.removeTextArea(i)
end
elseif arg[1]=="setcolor" then
color="0x"..arg[2]
elseif arg[1]=="brush" and tonumber(arg[2])<=30 then
brush=arg[2]
end
end

function eventMouse(name,x,y)
id = id + 1
ui.addTextArea(id, "", nil, x, y, brush, brush, color, color)
end
-- !setcolor ColorCode for changing the brush color
-- !brush Size for changing the brush size
-- !clear for clearing the screen

 
Skinnyfatlegend
« Citoyen »
1385858280000
    • Skinnyfatlegend#2903
    • Profil
    • Derniers messages
    • Tribu
#489
  0
Safwanrockz a dit :
Lua script for drawing, with !setcolor, !clear and !brush commands.
 

[Thecatbot] !brush
[•] Runtime Error : transformice.lua:20: attempt to compare __le on nil and number

;n;
Safwanrockz
« Censeur »
1385901780000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#490
  0
Thecatbot a dit :
[Thecatbot] !brush
[•] Runtime Error : transformice.lua:20: attempt to compare __le on nil and number

;n;

There should be an integer following the command "!brush" (i.e !brush 5). Same goes with the "!setcolor" command.
Shamousey
« Consul »
1385936100000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#491
  0
A lot of people end up asking for their maps to be P32ed so they can test dual shamans. You can use a script like this one to give any loaded map two shamans.

a dit :
function eventNewGame()
local players={}
local shamans={}
for name,player in pairs(tfm.get.room.playerList) do
if player.isShaman then
table.insert(shamans,name)
else
table.insert(players,name)
end
end
if #shamans&lt;2 and players[1] then
table.insert(shamans,players[math.random(#players)])
tfm.exec.setShaman(shamans[2])
local shams
for k,name in pairs(shamans) do
if not shams then
shams=name
else
shams=shams.." - &lt;font color='#fdb0fb'&gt;"..name.."&lt;/font&gt;"
tfm.exec.setNameColor(name,0xFDB0FB)
end
end
tfm.exec.setUIShamanName(shams)
end
end

 
Mikuhl
« Citoyen »
1385940720000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#492
  0
Shamousey a dit :
A lot of people end up asking for their maps to be P32ed so they can test dual shamans. You can use a script like this one to give any loaded map two shamans.

 

Not quite useful until Tig fixes the bugs with setting shamans with lua. Im supprised he didnt even do anything when he was "fixing" the skills.
Abdeltif
« Citoyen »
1386092400000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#493
  0
Jaackster a dit :
Not quite useful until Tig fixes the bugs with setting shamans with lua. Im supprised he didnt even do anything when he was "fixing" the skills.

It was made for no skills so mice won't full the room with millions of balls or 50 ballons at once .

Also, I made a script that makes you set an object at a x-y at 45° away of 0-0 cordinates
That mean , if u whrite !frame 2 200 / is will spawn a box 200 pixel away from 0-0 cordinates at 45°
You can concluse that alone *-*
a dit :
function frame(of, fo)
tfm.exec.addShamanObject(of,of+fo,fo)
end
function eventChatCommand(playerName, cmd)
local cmd_args = {}
for arg in cmd:gmatch("[^%s]+") do
table.insert(cmd_args, arg)
end
if cmd_args[1] == "frame" then
frame(cmd_args[2], cmd_args[3])
end
end

frame(4,200)
Unimeowse
« Citoyen »
1386558420000
    • Unimeowse#0000
    • Profil
    • Derniers messages
    • Tribu
#494
  0
I made a superjump command if anyone is interested &amp;gt;.&amp;gt;

function eventChatCommand(name, command)
if command=="superjump" then
tfm.exec.movePlayer(name,0,0,true,0,-200,false)
end
end
Abdeltif
« Citoyen »
1386608340000
    • Abdeltif#0000
    • Profil
    • Derniers messages
    • Tribu
#495
  0
Unimeowse a dit :
I made a superjump command if anyone is interested &amp;amp;gt;.&amp;amp;gt;

if command=="superjump" then
tfm.exec.movePlayer(name,0,0,true,0,-200,false)

There is no function and no ends
fixing :
a dit :
function eventChatCommand(name, command)
if command=="superjump" then
tfm.exec.movePlayer(name,0,0,true,0,-200,false)
end
end

That should work /o\
Unimeowse
« Citoyen »
1386628320000
    • Unimeowse#0000
    • Profil
    • Derniers messages
    • Tribu
#496
  0
Abdeltif a dit :
There is no function and no ends
fixing :

That should work /o\

My bad I took it out of my script without adding that
Samandefoc
« Citoyen »
1387286400000
    • Samandefoc#0000
    • Profil
    • Derniers messages
    • Tribu
#497
  0
system.bindMouse("Samandefoc");<player name
function eventMouse(name, x, y)
tfm.exec.addShamanObject(tfm.enum.shamanObject.littleBox, x, y, 0, 0, 0, false)
end
Animaljamvid
« Citoyen »
1387482840000
    • Animaljamvid#0000
    • Profil
    • Derniers messages
    • Tribu
#498
  0
all you have to do is copy and paste those snippets? ive tried but they don work for me
Safwanrockz
« Censeur »
1387484880000
    • Safwanrockz#0095
    • Profil
    • Derniers messages
    • Tribu
#499
  0
Animaljamvid a dit :
all you have to do is copy and paste those snippets? ive tried but they don work for me

You either don't have 1000 cheese or was banned for hacking before.
Animaljamvid
« Citoyen »
1387491540000
    • Animaljamvid#0000
    • Profil
    • Derniers messages
    • Tribu
#500
  0
i was never banned for hacking before (at least i dont think so) and 1000 cheese in shop or the 1000 cheese in profile? cause in profile i have 4533 cheese .-.
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Lua Snippets
« ‹ 25 / 33 › »
© Atelier801 2018

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

Version 1.27