×

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
« ‹ 99 / 160 › »
Script Requests
Shamousey
« Consul »
1434065940000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#1961
  0
Ygtyk a dit :
What is the lua code for a picture

Check the Module FAQ, it has example code for every functions, just remember that you need to be a member of the module team to use images.

Dernière modification le 1434066000000
Ygtyk
« Citoyen »
1434117960000
    • Ygtyk#0000
    • Profil
    • Derniers messages
    • Tribu
#1962
  0
Shamousey a dit :
Ygtyk a dit :
What is the lua code for a picture

Check the Module FAQ, it has example code for every functions, just remember that you need to be a member of the module team to use images.

Thank you
Ninjasmaus
« Citoyen »
1434168060000
    • Ninjasmaus#0000
    • Profil
    • Derniers messages
#1963
  0


function eventKeyboard(playername,keyCode,down,x,y)
if keyCode == 49 then
print(playerName.." has pressed 1 at cords"..x..","..y)
end
end

tfm.exec.bindKeyboard(playerName, 32, true, true)


Why am I getting this error?
tfm.exec.bindKeyboard : argument 1 can't be NIL.
Podoko
« Citoyen »
1434185760000
    • Podoko#0000
    • Profil
    • Derniers messages
    • Tribu
#1964
  0
Because there is no value in playerName when you're out of the eventKeyboard function.
If you want to listen space key for a specific player, you can put his name as argument, like tfm.exec.bindKeyboard("Ninjasmaus", 32, true, true), or if you want to listen the key for every player in the room, you have to use a "for" loop :
for playerName in pairs(tfm.get.room.playerList) do
tfm.exec.bindKeyboard( playerName, 32, true, true )
end
Ninjasmaus
« Citoyen »
1434445440000
    • Ninjasmaus#0000
    • Profil
    • Derniers messages
#1965
  0
Why is tfm not printing out my values?

mapRot = {"@0","@1","@2","@3","@4"}
total = 0
for key,value in ipairs(mapRot) do
print(key,value)
total = total + 1
end
print("Total number of maps in queue: "..total)
if total >= 5 then
print("Table is full, please wait")
for key,value in ipairs(mapRot) do
print(key,value)
end
else
print("Table has space!")
end


http://www.lua.org/cgi-bin/demo

Using the lua demo I'm able to get both the key + values but in tfm it only gives me the key
Ninjasmaus
« Citoyen »
1434445560000
    • Ninjasmaus#0000
    • Profil
    • Derniers messages
#1966
  0
Edit:
Nevermind all I had to do was change
print(key,value)

to
print(key..value)


my bad.
Xian
« Citoyen »
1434670200000
    • Xian#9915
    • Profil
    • Derniers messages
    • Tribu
#1967
  0
Looking for a script that sets time to infinite, sets all players in the room as a shaman with their skills from skill trees, autorespawns players when they die and also doesn't refresh map when last player has died (when there is only one person in the room)

Dernière modification le 1434670320000
Shamousey
« Consul »
1434670740000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#1968
  0
Erabos a dit :
Looking for a script that sets time to infinite, sets all players in the room as a shaman with their skills from skill trees, autorespawns players when they die and also doesn't refresh map when last player has died (when there is only one person in the room)

tfm.exec.disableAfkDeath(true)
tfm.exec.disableAutoNewGame(true)
function eventPlayerDied(name) tfm.exec.respawnPlayer(name) end
function eventNewGame() for name,player in pairs(tfm.get.room.playerList) do tfm.exec.setShaman(name) end end
eventNewGame()
-- Note that it's not possible to make everyone have all the skills from their skill trees, only the passive ones.

Dernière modification le 1434677220000
Firestonnne
« Citoyen »
1434671580000
    • Firestonnne#0000
    • Profil
    • Derniers messages
    • Tribu
#1969
  0
Shamousey a dit :
Erabos a dit :
Looking for a script that sets time to infinite, sets all players in the room as a shaman with their skills from skill trees, autorespawns players when they die and also doesn't refresh map when last player has died (when there is only one person in the room)

tfm.exec.disableAutoNewGame(true)
function eventPlayerDied(name) tfm.exec.respawnPlayer(name) end
function eventNewGame() for name,player in pairs(tfm.get.room.playerList) do tfm.exec.setShaman(name) end end
eventNewGame()
-- Note that it's not possible to make everyone have all the skills from their skill trees, only the passive ones.

RIP afk mice that die...
http://i.imgur.com/cSnrJPs.png

Dernière modification le 1434671880000
Shamousey
« Consul »
1434677280000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#1970
  0
Oops, let's just add tfm.exec.disableAfkDeath(true) and pretend that never happened!
Xian
« Citoyen »
1434683700000
    • Xian#9915
    • Profil
    • Derniers messages
    • Tribu
#1971
  0
Alright thanks a million :)
Cos
« Citoyen »
1434781920000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1972
  0
How can I make a chat command with ! (Like !mort) to be seen just by the player who typed it
Also I need a Points System (Enter in the hole for one point) and a shop where you sell the points for items

Dernière modification le 1434784680000
Shamousey
« Consul »
1434817020000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#1973
  0
Cosmincreato a dit :
How can I make a chat command with ! (Like !mort) to be seen just by the player who typed it

You can hide a command for everyone like this, but how would you want the !mort to be seen by just the player who typed it, in the chat? That's not possible without tfm.exec.chatMessage, which you need to be in the module team to use.

system.disableChatCommandDisplay("mort",true)
function eventChatCommand(name,command)
if command=="mort" then
tfm.exec.killPlayer(name)
end
end

Cosmincreato a dit :
Also I need a Points System (Enter in the hole for one point) and a shop where you sell the points for items

This kind of thing is a very vague, and it'd depend on exactly how you want your shop to work, what your minigame would do, etc. Here's a basic example for you.

Shop
shop={
{name="Baseball Bat",price=6},
{name="Bottle of Vinegar",price=2},
{name="Cheese-filled pizza crust",price=99}
}

tfm.exec.disableAutoScore(true)

function eventPlayerWon(name)
tfm.exec.setPlayerScore(name,1,true)
end

function eventChatCommand(name,command)
if command=="shop" then
local str=""
for id,item in pairs(shop) do
str=str.."<a href='event:buy "..id.."'>["..item.price.."] "..item.name.."</a><br />"
end
ui.addTextArea(1, str, name, 300, 100, 200, 200, nil, nil, 1, true)
end
end

function eventTextAreaCallback(id,name,callback)
local arg={}
for args in callback:gmatch("[^%s]+") do
table.insert(arg,args:lower())
end
if arg[1]=="buy" and tonumber(arg[2]) then
if shop[tonumber(arg[2])] and tfm.get.room.playerList[name].score>=shop[tonumber(arg[2])].price then
--Do what you want with the shop item.
tfm.exec.setPlayerScore(name,-shop[tonumber(arg[2])].price,true)
print(name.." purchased "..shop[tonumber(arg[2])].name)
end
end
end
Cos
« Citoyen »
1434819720000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1974
  0
Perfect,Thanks,but how can I close the shop ?
Frozenjord
« Citoyen »
1434824340000
    • Frozenjord#0656
    • Profil
    • Derniers messages
    • Tribu
#1975
  0
Cosmincreato a dit :
Perfect,Thanks,but how can I close the shop ?

Just tweaked Shamousey's script a little and added an 'x' to the corner of the shop, you can exit it now!

shop={
{name="Baseball Bat",price=6},
{name="Bottle of Vinegar",price=2},
{name="Cheese-filled pizza crust",price=99}
}

tfm.exec.disableAutoScore(true)

function eventPlayerWon(name)
tfm.exec.setPlayerScore(name,1,true)
end

function eventChatCommand(name,command)
if command=="shop" then
local str=""
for id,item in pairs(shop) do
str=str.."<a href='event:buy "..id.."'>["..item.price.."] "..item.name.."</a><br />"
end
ui.addTextArea(1, str, name, 300, 100, 200, 200, nil, nil, 1, true)
ui.addTextArea(2, "<b><a href='event:exit'>X</a></b>", name, 485, 100, nil, nil, nil, nil, 0, true)
end
end

function eventTextAreaCallback(id,name,callback)
local arg={}
for args in callback:gmatch("[^%s]+") do
table.insert(arg,args:lower())
end
if arg[1]=="buy" and tonumber(arg[2]) then
if shop[tonumber(arg[2])] and tfm.get.room.playerList[name].score>=shop[tonumber(arg[2])].price then
--Do what you want with the shop item.
tfm.exec.setPlayerScore(name,-shop[tonumber(arg[2])].price,true)
print(name.." purchased "..shop[tonumber(arg[2])].name)
end
elseif arg[1]=="exit" then
ui.removeTextArea(1, name)
ui.removeTextArea(2, name)
end
end
Cos
« Citoyen »
1434861180000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1976
  0
Thanks <3 ~~
Whoa
« Citoyen »
1435323840000
    • Whoa#2849
    • Profil
    • Derniers messages
    • Tribu
#1977
  0
when a mouse press down,i want to appear under him a random item from the shaman's items
pls
Cos
« Citoyen »
1435346160000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1978
  0
Truckmy a dit :
when a mouse press down,i want to appear under him a random item from the shaman's items
pls

hit={0,1,2,3,4,6,10,39,40,45,46,54,57,60,61,67,69}
function eventKeyboard(name,key,down,x,y)
if key==40 then
tfm.exec.addShamanObject((hit[math.random(#hit)]),tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y+30)
end
end
Lunakami
« Citoyen »
1435504140000
    • Lunakami#1704
    • Profil
    • Derniers messages
#1979
  0
Can you give a script for leaderboard?
Thanks in advance!
Edit:Can someone give a numbering script in a text area:When you enter the hole it'll show +1 ?
Like this:score={}
ui.addTextArea(5,"<font size='20'><font face='comic sans ms'><p align='center'>0</p></font>",nil,700,30,70,30,nil,nil,nil,true)
function eventPlayerWon(name)
score = score + 1
ui.updateTextArea(5,"<font size='20'><font face='comic sans ms'><p align='center'>'score' = 'score'+1</p></font>", name)
end
Thanks

Dernière modification le 1435504560000
Frozenjord
« Citoyen »
1435512240000
    • Frozenjord#0656
    • Profil
    • Derniers messages
    • Tribu
#1980
  0
Cosmincreato a dit :
Truckmy a dit :
when a mouse press down,i want to appear under him a random item from the shaman's items
pls

hit={0,1,2,3,4,6,10,39,40,45,46,54,57,60,61,67,69}
function eventKeyboard(name,key,down,x,y)
if key==40 then
tfm.exec.addShamanObject((hit[math.random(#hit)]),tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y+30)
end
end

This is a good attempt! Although, you are missing a few key features needed for it to work:

hit={0,1,2,3,4,6,10,39,40,45,46,54,57,60,61,67,69}

for i,p in pairs(tfm.get.room.playerList) do
tfm.exec.bindKeyboard(i, 40, true, true)
end


function eventKeyboard(name,key,down,x,y)
if key==40 then
tfm.exec.addShamanObject((hit[math.random(#hit)]), x, y+30)
end
end


It is really important you bind the desired key (to all the players in the room in this case) to ensure that the eventKeyboard function runs when the desired key is pressed.

Secondly, I changed "tfm.get.room.playerList[name].x" to just "x" and the same with "y". The eventKeyboard function actually takes the x and the y as parameters, using these makes the co-ordinates more accurate as the x and y are checked the instant the key is pressed. ^^
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 99 / 160 › »
© Atelier801 2018

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

Version 1.27