×

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
« ‹ 14 / 33 › »
Lua Snippets
Tini
« Sénateur »
1380488400000
    • Tini#0095
    • Profil
    • Derniers messages
    • Tribu
#261
  0
Epicshawty a dit :
this should help you VVV


Replace P with #.
#1 = P1, #3 = P3 etc,.

For "mort"...it's !2?
and creat « ! » for /np and mort, please.
admins = {Tinittee}


Shaman, script for "page" in Popup.
Shamousey
« Consul »
1380488520000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#262
  0
It's not a popup, it's using text areas actually.

a dit :
translations={
EN={
help={
"Here is your help.",
"What happens if the text on this second page is so insanely long, will it cut itself off to the next line? I hope so.",
"Here's a third page, oh my god!",
}
}
}

players={}
system.disableChatCommandDisplay("help")

textarea=ui.addTextArea
function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
--if not backgroundColor then backgroundColor=0x324650 end
--if not borderColor then borderColor=0x000001 end
if emboss then
textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
end
textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
end

function eventNewPlayer(name)
players[name]={helpid=1}
ui.addTextArea(0,"<p align='center'><a href='event:help'><b>?</b></a></p>",name,780,374,16,16,nil,0x324650,nil,true)
end

for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end

function trans(mes)
if translations[tfm.get.room.community] and translations[tfm.get.room.community][mes] then
return translations[tfm.get.room.community][mes]
else
return translations.EN[mes]
end
end

function eventChatCommand(name,command)
if command=="help" then
ui.addTextArea(1,trans("help")[players[name].helpid],name,250,50,300,300,nil,0x324650,nil,true)
ui.addTextArea(2,"<p align='center'><a href='event:previous'><b><</b></a></p>",name,500,365,16,16,nil,0x324650,nil,true)
ui.addTextArea(3,"<p align='center'><a href='event:next'><b>></b></a></p>",name,532,365,16,16,nil,0x324650,nil,true)
ui.addTextArea(4,"<p align='center'><a href='event:close'><b>Close</b></a></p>",name,442,365,42,16,nil,0x324650,nil,true)
ui.addTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name,250,365,42,16,nil,0x324650,nil,true)
end
end

function eventTextAreaCallback(id,name,callback)
if callback=="help" then
eventChatCommand(name,callback)
elseif callback=="close" then
players[name].helpid=1
for id=1,5 do
ui.removeTextArea(id,name)
ui.removeTextArea(6969+id,name)
ui.removeTextArea(7979+id,name)
end
elseif callback=="next" and players[name].helpid<#trans("help") then
players[name].helpid=(players[name].helpid)+1
ui.updateTextArea(1,trans("help")[players[name].helpid],name)
ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
elseif callback=="previous" and players[name].helpid>1 then
players[name].helpid=players[name].helpid-1
ui.updateTextArea(1,trans("help")[players[name].helpid],name)
ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
end
end

Here's that 2 page help you all wanted.
Yteiz
« Citoyen »
1380488700000
    • Yteiz#0000
    • Profil
    • Derniers messages
    • Tribu
#263
  0
Shamousey a dit :
It's not a popup, it's using text areas actually.
Here's that 2 page help you all wanted.

I do not get

Edit:
I want to make with vamp and fly
Tini
« Sénateur »
1380489600000
    • Tini#0095
    • Profil
    • Derniers messages
    • Tribu
#264
  0
Shaman, +2 pages, please.
Shamousey
« Consul »
1380489840000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#265
  0
Tinittee a dit :
Shaman, +2 pages, please.

Just take an element out of the translations.help table then. There's 3 in that example, so it'll be 3 pages long.
Tini
« Sénateur »
1380493800000
    • Tini#0095
    • Profil
    • Derniers messages
    • Tribu
#266
  0
Thank you, Shaman.
Trickmazter
« Citoyen »
1380494040000
    • Trickmazter#0000
    • Profil
    • Derniers messages
    • Tribu
#267
  0
Thank you,shaman.
Fluffyshine
« Citoyen »
1380498120000
    • Fluffyshine#0000
    • Profil
    • Derniers messages
    • Tribu
#268
  0
a dit :

function eventCommand(sender,val)
if (val:sub(0,3) == [[fly]]) then
for sender,_ in pairs(tfm.get.room.playerList) do
if (sender == val:sub(5)) then
tfm.exec.bindKeyboard(sender,32,true,true)
elseif (val:sub(5) == [
  • ]) then
    tfm.exec.bindKeyboard(sender,32,true,true)
    end
    end

    elseif (val:sub(0,4) == [[dfly]]) then
    for sender,_ in pairs(tfm.get.room.playerList) do
    if (sender == val:sub(6)) then
    tfm.exec.bindKeyboard(sender,32,false,false)
    elseif (val:sub(6) == [
  • ]) then
    tfm.exec.bindKeyboard(sender,32,false,false)
    end
    end
    end
    end

  • Why doesn’t dfly work? :\
    Shamousey
    « Consul »
    1380499800000
      • Shamousey#0095
      • Profil
      • Derniers messages
      • Tribu
    #269
      0
    Because you're binding the keys with tfm.exec.bindKeyboard(sender,32,true,true) and unbinding them with tfm.exec.bindKeyboard(sender,32,false,false)

    There are two booleans here, the first one binds when a player lets go of a key. When you bind false,false, you're actually unbinding that, so key binding is still set for when a player actually presses the key. Try true,false for unbinding.
    Fluffyshine
    « Citoyen »
    1380503280000
      • Fluffyshine#0000
      • Profil
      • Derniers messages
      • Tribu
    #270
      0
    Shamousey a dit :
    Because you're binding the keys with tfm.exec.bindKeyboard(sender,32,true,true) and unbindign them with tfm.exec.bindKeyboard(sender,32,false,false)

    There are two booleans here, the first one binds when a player lets go of a key. When you bind false,false, you're actually unbinding that, so key binding is still set for when a player actually presses the key. Try true,false for unbinding.

    Thank you, it worked. ^_^
    Hakureimouse
    « Citoyen »
    1380507000000
      • Hakureimouse#0000
      • Profil
      • Derniers messages
      • Tribu
    #271
      0
    I'm just going to leave some stuff here, you may find some scrips interesting or useful:


    http://i.imgur.com/onLvm6tl.png
    Object Spawner: Spawns a structure made of objects, with the dimentions specified using chat commands. For instance: "!small box 8x5" will spawn an 8 boxes wide and 5 boxes high building.


    http://i.imgur.com/fAEO5Po.png
    Disco names: Names changing colors continuously.

    !kill command: Simple kill command that will work regardless of Caps


    http://i.imgur.com/rSY5mEYl.png
    Heart with a click: I took the 'heart code' that has been circulating lately, made it smaller and made it spawn everytime someone clicks, in the place they clicked.

    btw Thank you guys for all the little and great scripts and tools some of you have been sharing :) They've proven more useful to me than the Lua documentation or anything.
    Jtojto
    « Citoyen »
    1380514020000
      • Jtojto#0000
      • Profil
      • Derniers messages
      • Tribu
    #272
      0
    Any reason why this isn't playing a P1 map when I type !new?
    a dit :
    function eventChatCommand(name,cmd)
    if cmd=="new" then
    tfm.exec.newGame("#1")
    end
    end

    None of the P categories work, but vanilla maps and @codes work fine.
    Shamousey
    « Consul »
    1380528720000
      • Shamousey#0095
      • Profil
      • Derniers messages
      • Tribu
    #273
      0
    Hakureimouse a dit :
    I'm just going to leave some stuff here, you may find some scrips interesting or useful

    Great work!

    Jtojto a dit :
    Any reason why this isn't playing a P1 map when I type !new?

    None of the P categories work, but vanilla maps and @codes work fine.

    Tribe houses were never meant to load specific perms like that (just like /np reloads the tribe house instead of loading a random map). Hopefully Tig will fix it some time soon.
    Bengalstar
    « Citoyen »
    1380531180000
      • Bengalstar#0000
      • Profil
      • Derniers messages
    #274
      0
    I need help with this

    function eventLoop()
    tfm.exec.addShamanObject(tfm.enum.shamanObject.ball, math.random()*800, 30)

    end

    function eventLoop()
    tfm.exec.addShamanObject(tfm.enum.shamanObject.anvil, math.random()*800, 30)

    end

    function eventLoop()
    tfm.exec.addShamanObject(tfm.enum.shamanObject.bomb, math.random()*800, 30)

    end

    function eventLoop()
    tfm.exec.addShamanObject(tfm.enum.shamanObject.littlebox, math.random()*800, 30)

    end

    function eventLoop()
    tfm.exec.addShamanObject(tfm.enum.shamanObject.box, math.random()*800, 30)

    end

    --
    Can someone help ?
    It keeps spawning boxes when I'd like it to spawn other objects
    Shamousey
    « Consul »
    1380531300000
      • Shamousey#0095
      • Profil
      • Derniers messages
      • Tribu
    #275
      0
    You keep redefining the eventLoop function so that it only ever uses the last one. Put all of the contents you want inside a single one.
    Bengalstar
    « Citoyen »
    1380531420000
      • Bengalstar#0000
      • Profil
      • Derniers messages
    #276
      0
    Shamousey a dit :
    You keep redefining the eventLoop function so that it only ever uses the last one. Put all of the contents you want inside a single one.

    oh ok ty sham
    --
    tfm.exec.addShamanObject(tfm.enum.shamanObject.littlebox, tfm.enum.shamanObject.anvil, tfm.enum.shamanObject.bomb, math.random()*800, 30)

    I think I'm doing this wrong
    Jordy
    « Consul »
    1380532320000
      • Jordy#0015
      • Profil
      • Derniers messages
      • Tribu
    #277
      0
    Bengalstar a dit :
    oh ok ty sham
    --
    tfm.exec.addShamanObject(tfm.enum.shamanObject.littlebox, tfm.enum.shamanObject.anvil, tfm.enum.shamanObject.bomb, math.random()*800, 30)

    I think I'm doing this wrong

    * The function "tfm.exec.addShamanObject()" can only spawn one object not multiple.
    This is how you do it:
    a dit :

    tfm.exec.addShamanObject(1, 200, 100)
    tfm.exec.addShamanObject(2, 200, 200)
    tfm.exec.addShamanObject(3, 200, 250)

    * littlebox should be littleBox.
    * anvil should be Anvil.
    * bomb should be Bomb.
    Bengalstar
    « Citoyen »
    1380532560000
      • Bengalstar#0000
      • Profil
      • Derniers messages
    #278
      0
    Jordynl a dit :
    * The function "tfm.exec.addShamanObject()" can only spawn one item.


    * littlebox should be littleBox.
    * anvil should be Anvil.
    * bomb should be Bomb.

    ty that makes more sense

    [•] Runtime Error : transformice.lua:36: attempt to index ? (a nil value)
    I'm confused
    Jordy
    « Consul »
    1380532860000
      • Jordy#0015
      • Profil
      • Derniers messages
      • Tribu
    #279
      0
    Ehm. I was wrong. Sorry

    a dit :
    tfm.exec.addShamanObject(tfm.enum.shamanObject.littleBox, math.random()*800, 30)
    tfm.exec.addShamanObject(tfm.enum.shamanObject.anvil, math.random()*800, 30)
    tfm.exec.addShamanObject(tfm.enum.shamanObject.bomb, math.random()*800, 30)

    bomb and anvil were good. -_-
    littlebox => littleBox
    Bengalstar
    « Citoyen »
    1380532980000
      • Bengalstar#0000
      • Profil
      • Derniers messages
    #280
      0
    Jordynl a dit :
    Ehm. I was wrong. Sorry
    bomb and anvil were good. -_-
    littlebox => littleBox

    oh ok thanks ^^
    • Forums
    • /
    • Transformice
    • /
    • Modules
    • /
    • Lua Snippets
    « ‹ 14 / 33 › »
    © Atelier801 2018

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

    Version 1.27