×

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
« ‹ 100 / 160 › »
Script Requests
Cos
« Citoyen »
1435557480000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1981
  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
Shamousey
« Consul »
1435581900000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#1982
  0
Cosmincreato a dit :
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

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
Shizhune
« Citoyen »
1435936440000
    • Shizhune#0000
    • Profil
    • Derniers messages
    • Tribu
#1983
  0
Utility Help Button and Help box script?
Cos
« Citoyen »
1436000460000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1984
  0
Shizhune a dit :
Utility Help Button and Help box script?

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
Shizhune
« Citoyen »
1436003280000
    • Shizhune#0000
    • Profil
    • Derniers messages
    • Tribu
#1985
  0
Cosmincreato 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

Thanks , but nothing happens when when I click the Help Button.. Could you help me?

Dernière modification le 1436633160000
Cos
« Citoyen »
1436011080000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1986
  0
Are you using more text Areas?
Shizhune
« Citoyen »
1436014800000
    • Shizhune#0000
    • Profil
    • Derniers messages
    • Tribu
#1987
  0
Nope, I didn't make any change to the Script.
Tat
« Censeur »
1436056440000
    • Tat#0095
    • Profil
    • Derniers messages
    • Tribu
#1988
  0
can u make nightmode for a few people but not for the rest?
Shamousey
« Consul »
1436058960000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#1989
  0
Shizhune a dit :
Thanks , but nothing happens when when I click the Help Button.. Could you help me?

It's working fine for me, the script seems fine.

Mousetat a dit :
can u make nightmode for a few people but not for the rest?

Only with large (and laggy) images, which you need to be on the module team to be able to use.
Cos
« Citoyen »
1436787000000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1990
  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
Fqwzdjepzwgh
« Citoyen »
1436787780000
    • Fqwzdjepzwgh#4615
    • Profil
    • Derniers messages
#1991
  0
Cosmincreato a dit :
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


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
Reencat
1436801340000
    • Reencat#0000
    • Profil
    • Derniers messages
#1992
[Modéré par Shamousey, raison : Not module related. If you'd like to suggest a fur, you can do so here.]
Cos
« Citoyen »
1436891820000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1993
  0
if it is possible , mice,can spawn at any X or Y from a list by me :?
Shamousey
« Consul »
1436898360000
    • Shamousey#0095
    • Profil
    • Derniers messages
    • Tribu
#1994
  0
Cosmincreato a dit :
if it is possible , mice,can spawn at any X or Y from a list by me :?

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.
Cos
« Citoyen »
1437486300000
    • Cos#8400
    • Profil
    • Derniers messages
    • Tribu
#1995
  0
DS=""
needs any positions?x and y
Rectop
« Citoyen »
1437486780000
    • Rectop#0000
    • Profil
    • Derniers messages
    • Tribu
#1996
  0
Cosmincreato a dit :
DS=""
needs any positions?x and y

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
Haku
« Sénateur »
1437616680000
    • Haku#0807
    • Profil
    • Derniers messages
#1997
  0
Cosmincreato a dit :
DS=""
needs any positions?x and y

You've got three ways to use the DS attribute:

1. Defining specific x,y coordinates for each spawn point:
Rectop a dit :
Cosmincreato a dit :
DS=""
needs any positions?x and y

DS="x1,y1,x2,y2,x3,y3"

(x1 is the position in X for the first spawn point and same for all)

2. Defining a unique X coordinate and have mice spread across a vertical line:
Hina XML Manual a dit :
    DS="y;y0"

    y0 - Y coordinate for all mice

3. Defining a unique Y coordinate and have mice spread across a horizontal line:
Hina XML Manual a dit :
    DS="x;x0"

    x0 - Y coordinate for all mice.



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.
Woebegone
« Citoyen »
1438824240000
    • Woebegone#8377
    • Profil
    • Derniers messages
    • Tribu
#1998
  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.
Rectop
« Citoyen »
1438825200000
    • Rectop#0000
    • Profil
    • Derniers messages
    • Tribu
#1999
  0
Juliantwofan a dit :
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.

Here
Woebegone
« Citoyen »
1438861860000
    • Woebegone#8377
    • Profil
    • Derniers messages
    • Tribu
#2000
  0
thanks.
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 100 / 160 › »
© Atelier801 2018

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

Version 1.27