| |
| « Consul » 1434065940000
| 0 | ||
Ygtyk a dit : 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 |
| 0 | ||
Shamousey a dit : Thank you |
| « Citoyen » 1434168060000
| 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. |
| « Citoyen » 1434185760000
| 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 |
| « Citoyen » 1434445440000
| 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 |
| « Citoyen » 1434445560000
| 0 | ||
| Edit: Nevermind all I had to do was change print(key,value) to print(key..value) my bad. |
| 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 |
| « Consul » 1434670740000
| 0 | ||
Erabos a dit : 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 |
| « Citoyen » 1434671580000
| 0 | ||
Shamousey a dit : RIP afk mice that die... ![]() Dernière modification le 1434671880000 |
| « Consul » 1434677280000
| 0 | ||
| Oops, let's just add tfm.exec.disableAfkDeath(true) and pretend that never happened! |
| 0 | ||
| Alright thanks a million :) |
| 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 |
| « Consul » 1434817020000
| 0 | ||
Cosmincreato a dit : 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 : 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 |
| 0 | ||
| Perfect,Thanks,but how can I close the shop ? |
| « Citoyen » 1434824340000
| 0 | ||
Cosmincreato a dit : 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 |
| 0 | ||
| Thanks <3 ~~ |
| 0 | ||
| when a mouse press down,i want to appear under him a random item from the shaman's items pls |
| 0 | ||
Truckmy a dit : 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 |
| « Citoyen » 1435504140000
| 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 |
| « Citoyen » 1435512240000
| 0 | ||
Cosmincreato a dit : 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. ^^ |