| |
| 0 | ||
| Good to know,thanks! :D Btw how can I input different thing to the shop? For example: {name="Baseball Bat",price=6}, - it makes you die. {name="Bottle of Vinegar",price=2}, - it makes you to get the cheese. {name="Cheese-filled pizza crust",price=99} - it makes you a shaman |
| « Consul » 1435581900000
| 0 | ||
Cosmincreato a dit : shop={ {name="Baseball Bat",price=6,effect=function(name) tfm.exec.killPlayer(name) end}, {name="Bottle of Vinegar",price=2,effect=function(name) tfm.exec.giveCheese(name) end}, {name="Cheese-filled pizza crust",price=99,effect=function(name) tfm.exec.setShaman(name) end} } 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 local id=tonumber(arg[2]) if arg[1]=="buy" and id then if shop[id] and tfm.get.room.playerList[name].score>=shop[id].price then if shop[id].effect then shop[id].effect(name) end --Do what you want with the shop item. tfm.exec.setPlayerScore(name,-shop[id].price,true) print(name.." purchased "..shop[id].name) end elseif arg[1]=="exit" then ui.removeTextArea(1, name) ui.removeTextArea(2, name) end end |
| « Citoyen » 1435936440000
| 0 | ||
| Utility Help Button and Help box script? |
| 0 | ||
Shizhune 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 Dernière modification le 1436633160000 |
| « Citoyen » 1436003280000
| 0 | ||
Cosmincreato a dit : Thanks , but nothing happens when when I click the Help Button.. Could you help me? Dernière modification le 1436633160000 |
| 0 | ||
| Are you using more text Areas? |
| « Citoyen » 1436014800000
| 0 | ||
| Nope, I didn't make any change to the Script. |
| 0 | ||
| can u make nightmode for a few people but not for the rest? |
| « Consul » 1436058960000
| 0 | ||
Shizhune a dit : It's working fine for me, the script seems fine. Mousetat a dit : Only with large (and laggy) images, which you need to be on the module team to be able to use. |
| 0 | ||
| chest={Y , X , Z} ui.addTextArea(9853, math.random(#chest), n, 555, 70, nil, nil, nil, nil, 0, true) it gives me the "1" value I want to appear X,Y or Z random |
| « Citoyen » 1436787780000
| 0 | ||
Cosmincreato a dit : chests={"Y" , "X" , "Z"} chest=chests[math.random(#chests)] ui.addTextArea(9853, chest, n, 555, 70, nil, nil, nil, nil, 0, true) or chest={"Y" , "X" , "Z"} ui.addTextArea(9853, chest[math.random(#chest)], n, 555, 70, nil, nil, nil, nil, 0, true) Dernière modification le 1436787840000 |
| 1436801340000
| | ||
| [Modéré par Shamousey, raison : Not module related. If you'd like to suggest a fur, you can do so here.] |
| 0 | ||
| if it is possible , mice,can spawn at any X or Y from a list by me :? |
| « Consul » 1436898360000
| 0 | ||
Cosmincreato a dit : You could make use of the DS="" attribute of the <P /> tag in the XML, which lets you specify random spawns for mice (either in the map itself, or load the map, get the XML, alter it how you want then reload it). Another option would be to use tfm.exec.movePlayer() to move them to where you want after they've spawned. |
| 0 | ||
| DS="" needs any positions?x and y |
| « Citoyen » 1437486780000
| 0 | ||
Cosmincreato a dit : DS="x1,y1,x2,y2,x3,y3" (x1 is the position in X for the first spawn point and same for all) Dernière modification le 1437486840000 |
| 0 | ||
Cosmincreato a dit : You've got three ways to use the DS attribute: 1. Defining specific x,y coordinates for each spawn point: Rectop a dit : 2. Defining a unique X coordinate and have mice spread across a vertical line: Hina XML Manual a dit : 3. Defining a unique Y coordinate and have mice spread across a horizontal line: Hina XML Manual a dit : If you're developing a module where random spawns are important, I'd recommend not using the native DS attribute, and instead go with what Shamousey said. Load the map, read its XML (and perhaps look for a certain object to use as the spawn points) and then move the players randomly. (TFM doesn't really spread the mice randomly across the spawn points, and they may end up spawning in the same place everytime) If it sounds too complicated I can show you an example if you want. |
| « Citoyen » 1438824240000
| 0 | ||
| can i have a script similar to the cheese thief? basically a script that will give cheese to a random person. when the random person matches x and y coordinates with another person, the "another person" will get cheese and when the random person gives cheese to 10 people, they die. |
| « Citoyen » 1438825200000
| 0 | ||
Juliantwofan a dit : Here |
| « Citoyen » 1438861860000
| 0 | ||
| thanks. |