×

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
« ‹ 123 / 160 › »
Script Requests
Onkei
« Citoyen »
1485282600000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2441
  0
Dramatotala a dit :
looking for a good script to life bar when you hit the balls, objects and other things shaman to drop you a certain number of 0 to par of life and life is attempted die

I made some assumptions that you wanted the object to only damage you if they were moving

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
local defaultMaxHealth = 20
local defaultObjectDamage = 2

local players = {}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function pythag(x1, y1, x2, y2, r)
local x = x2 - x1
local y = y2 - y1
local r = r + r
return x * x + y * y < r * r
end

function showHealthBar(n)
local player = players[n]

local healthLen = math.floor(tonumber(player.health) * (250 / defaultMaxHealth))
if healthLen < 80 then healthLen = 80 elseif healthLen > 250 then healthLen = 250 end

ui.addTextArea(0, "", n, 10, 25, 250, 20, 0x324650, 0x89a7f5, 0.7, true)
ui.addTextArea(1, "<p align='center'>"..player.health.." Health", n, 10, 25, healthLen, 20, 0x171918, 0x171918, 0.5, true)
end

function eventLoop()
for i, object in pairs(tfm.get.room.objectList) do
for n, data in pairs(tfm.get.room.playerList) do
if pythag(object.x, object.y, data.x, data.y, 50) and (math.abs(object.vx) > 2 or math.abs(object.vy) > 2) then
local player = players[n]
if player then
player.health = player.health - defaultObjectDamage
-- player.health = player.health - math.abs(object.vx) - math.abs(object.vy) - defaultObjectDamage

if player.health <= 0 then tfm.exec.killPlayer(n) end
showHealthBar(n)
end
end
end
end
end

function eventNewGame()
for n in pairs(tfm.get.room.playerList) do
eventPlayerRespawn(n)
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {health = defaultMaxHealth}
end
showHealthBar(n)
end

function eventPlayerDied(n)
players[n].health = 0
showHealthBar(n)
end

function eventPlayerRespawn(n)
players[n].health = defaultMaxHealth
showHealthBar(n)
end

main()

Dernière modification le 1486750440000
Dramacorn
« Consul »
1485332760000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#2442
  0
Onkei a dit :
Dramatotala a dit :
looking for a good script to life bar when you hit the balls, objects and other things shaman to drop you a certain number of 0 to par of life and life is attempted die

I made some assumptions that you wanted the object to only damage you if they were moving

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
local defaultMaxHealth = 20
local defaultObjectDamage = 2

local players = {}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function pythag(x1, y1, x2, y2, r)
local x = x2 - x1
local y = y2 - y1
local r = r + r
return x * x + y * y < r * r
end

function showHealthBar(n)
local player = players[n]

local healthLen = math.floor(tonumber(player.health) * (250 / defaultMaxHealth))
if healthLen < 80 then healthLen = 80 elseif healthLen > 250 then healthLen = 250 end

ui.addTextArea(0, "", n, 10, 25, 250, 20, 0x324650, 0x89a7f5, 0.7, true)
ui.addTextArea(1, "<p align='center'>"..player.health.." Health", n, 10, 25, healthLen, 20, 0x171918, 0x171918, 0.5, true)
end

function eventLoop()
for i, object in pairs(tfm.get.room.objectList) do
for n, data in pairs(tfm.get.room.playerList) do
if pythag(object.x, object.y, data.x, data.y, 50) and (math.abs(object.vx) > 2 or math.abs(object.vy) > 2) then
local player = players[n]
if player then
player.health = player.health - defaultObjectDamage
-- player.health = player.health - math.abs(object.vx) - math.abs(object.vy) - defaultObjectDamage

if player.health <= 0 then tfm.exec.killPlayer(n) end
showHealthBar(n)
end
end
end
end
end

function eventNewGame()
for n in pairs(tfm.get.room.playerList) do
eventPlayerRespawn(n)
end
end

function eventNewPlayer(n)
if not players[n] then
players[n] = {health = defaultMaxHealth}
end
showHealthBar(n)
end

function eventPlayerDied(n)
players[n].health = 0
showHealthBar(n)
end

function eventPlayerRespawn(n)
players[n].health = defaultMaxHealth
showHealthBar(n)
end

main()

do not go, do not appear nothing, no life bar
Onkei
« Citoyen »
1485339360000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2443
  0
Dramatotala a dit :
do not go, do not appear nothing, no life bar

Are you sure you've copied everything? It works for me.
Dramacorn
« Consul »
1485362220000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#2444
  0
Onkei a dit :
Dramatotala a dit :
do not go, do not appear nothing, no life bar

Are you sure you've copied everything? It works for me.

I tried again and life bar appears just as you are not subtracted from the 20 life nothing is attempted when throwing snowball or other inventory items
Onkei
« Citoyen »
1485363540000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2445
  0
Dramatotala a dit :
I tried again and life bar appears just as you are not subtracted from the 20 life nothing is attempted when throwing snowball or other inventory items

Welp. I assumed you were talking about shaman objects (e.g. Anvils). I don't think it's possible (someone pls check) to detect inventory items as far as I know, can't help you there.
Dramacorn
« Consul »
1485366000000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#2446
  0
Onkei a dit :
Dramatotala a dit :
I tried again and life bar appears just as you are not subtracted from the 20 life nothing is attempted when throwing snowball or other inventory items

Welp. I assumed you were talking about shaman objects (e.g. Anvils). I don't think it's possible (someone pls check) to detect inventory items as far as I know, can't help you there.

sorry i do not know, I tried and it worked thanks a lot ^^
(Still can not combine with scripts spawn? All are objects shaman)
Ajnoobz
« Citoyen »
1486039200000
    • Ajnoobz#0000
    • Profil
    • Derniers messages
#2447
  0
Hello i am here to request a tribe bot, for my tribe :) I want one that can chat.
Onkei
« Citoyen »
1486058700000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2448
  0
  • Main
  • Code
Ajnoobz a dit :
Hello i am here to request a tribe bot, for my tribe :) I want one that can chat.

If you want to use the bot to say something manually, do !say and a popup for you to type in something will appear. Do !close to stop the popup from appearing again.

There's also a built-in chat messages thing that prints out a response from the bot if the mice types out a triggered message. You can add and see these messages from the code.

e.g.

http://image.prntscr.com/image/892909e85ca74024b00a7ac7e77fd402.png

I basically added some more functionality from Brenower's old bot messages script which is no longer available.
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
--[[
How to add a new response to the chatbot;
1. Figure out what message to trigger the response from the chatbot. e.g. "Bananas".

2. Figure out whether you want multiple responses or just one response. e.g. "Bananas are great."

3.1. Use this syntax if you want a single response;
["Your Triggering Message"] = "Chatbot's Response to Message",
["Banana"] = "Bananas are great.",

3.2. If you want multiple responses e.g. "Bananas are great.", "Bananas are meh.", follow this example;
["Your Triggering Message"] = {"Response number 1", "Response number 2"},
["Banana"] = {"Bananas are great.", "Bananas are meh."},

4. Add the result after "local chat = {"

5. If you're getting an error, make sure that all of the double quotes are added properly.
]]

local chat = {
["Banana"] = {"Bananas are great.", "Bananas are meh."},
["Hello"] = {"Hello there.", "Hello madame.", "Hola.", "Aloha amigo."},
["How are you"] = {"I'm good.", "Fantastic.", "Fairly good.", "Amazing."},
["That's good"] = "Yup.",
["How much is that"] = "300 euros.",
}

local admin = {Onkei = true, Ajnoobz = true}
local bot = "Soupbot"
local openPopup = false

function capitalize(word)
return string.upper(word:sub(1, 1)) .. string.lower(word:sub(2));
end

function main()
system.disableChatCommandDisplay("say")
system.disableChatCommandDisplay("close")
for n in pairs(tfm.get.room.playerList) do eventNewPlayer(n) end
end

function string.prefix(str, substr)
return (str:sub(1, substr:len()) == substr)
end

function ui.addBotText(text, n)
ui.addTextArea(100, "<V>[~"..bot.."]<N> "..text, n, 6, 380, nil, 30, 0x324650, 0x89A7F5, 0.7, true)
end

function eventNewPlayer(n)
ui.addBotText("Welcome! Here, you can type out random messages and the Chat(Soup)bot will give out a response to you! e.g. Hello", n)
end

function eventChatMessage(n, msg)
local playerMsg = capitalize(msg)

for triggerMsg, response in pairs(chat) do
if string.prefix(triggerMsg, playerMsg) then
local msgBack = response

if type(response) == "table" then
msgBack = response[math.random(#response)]
end

ui.addBotText(msgBack, n)
break
end
end
end

function eventChatCommand(n, cmd)
if admin[n] then
if cmd == "say" then
openPopup = true
ui.addPopup(1, 2, "Say something using "..bot.."! e.g Hello peoples", n, 530, 30, 250, true)
elseif cmd == "close" then
openPopup = false
end
end
end

function eventPopupAnswer(id, n, text)
if openPopup and text then
ui.addBotText(text, nil)
eventChatCommand(n, "say")
end
end

main()

Dernière modification le 1486060140000
Ajnoobz
« Citoyen »
1486111920000
    • Ajnoobz#0000
    • Profil
    • Derniers messages
#2449
  0
Onkei a dit :
[#Main]
Ajnoobz a dit :
Hello i am here to request a tribe bot, for my tribe :) I want one that can chat.

If you want to use the bot to say something manually, do !say and a popup for you to type in something will appear. Do !close to stop the popup from appearing again.

There's also a built-in chat messages thing that prints out a response from the bot if the mice types out a triggered message. You can add and see these messages from the code.

e.g.

http://image.prntscr.com/image/892909e85ca74024b00a7ac7e77fd402.png

I basically added some more functionality from Brenower's old bot messages script which is no longer available.
[/#Main]

[#Code]
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
--[[
How to add a new response to the chatbot;
1. Figure out what message to trigger the response from the chatbot. e.g. "Bananas".

2. Figure out whether you want multiple responses or just one response. e.g. "Bananas are great."

3.1. Use this syntax if you want a single response;
["Your Triggering Message"] = "Chatbot's Response to Message",
["Banana"] = "Bananas are great.",

3.2. If you want multiple responses e.g. "Bananas are great.", "Bananas are meh.", follow this example;
["Your Triggering Message"] = {"Response number 1", "Response number 2"},
["Banana"] = {"Bananas are great.", "Bananas are meh."},

4. Add the result after "local chat = {"

5. If you're getting an error, make sure that all of the double quotes are added properly.
]]

local chat = {
["Banana"] = {"Bananas are great.", "Bananas are meh."},
["Hello"] = {"Hello there.", "Hello madame.", "Hola.", "Aloha amigo."},
["How are you"] = {"I'm good.", "Fantastic.", "Fairly good.", "Amazing."},
["That's good"] = "Yup.",
["How much is that"] = "300 euros.",
}

local admin = {Onkei = true, Ajnoobz = true}
local bot = "Soupbot"
local openPopup = false

function capitalize(word)
return string.upper(word:sub(1, 1)) .. string.lower(word:sub(2));
end

function main()
system.disableChatCommandDisplay("say")
system.disableChatCommandDisplay("close")
for n in pairs(tfm.get.room.playerList) do eventNewPlayer(n) end
end

function string.prefix(str, substr)
return (str:sub(1, substr:len()) == substr)
end

function ui.addBotText(text, n)
ui.addTextArea(100, "<V>[~"..bot.."]<N> "..text, n, 6, 380, nil, 30, 0x324650, 0x89A7F5, 0.7, true)
end

function eventNewPlayer(n)
ui.addBotText("Welcome! Here, you can type out random messages and the Chat(Soup)bot will give out a response to you! e.g. Hello", n)
end

function eventChatMessage(n, msg)
local playerMsg = capitalize(msg)

for triggerMsg, response in pairs(chat) do
if string.prefix(triggerMsg, playerMsg) then
local msgBack = response

if type(response) == "table" then
msgBack = response[math.random(#response)]
end

ui.addBotText(msgBack, n)
break
end
end
end

function eventChatCommand(n, cmd)
if admin[n] then
if cmd == "say" then
openPopup = true
ui.addPopup(1, 2, "Say something using "..bot.."! e.g Hello peoples", n, 530, 30, 250, true)
elseif cmd == "close" then
openPopup = false
end
end
end

function eventPopupAnswer(id, n, text)
if openPopup and text then
ui.addBotText(text, nil)
eventChatCommand(n, "say")
end
end

main()
[/#Code]

THANKS !!!!! :) It works really well. But is the bot just a chat at the bottom or can it be an actual mouse bot? Just asking.
Onkei
« Citoyen »
1486113060000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2450
  0
Ajnoobz a dit :
THANKS !!!!! :) It works really well. But is the bot just a chat at the bottom or can it be an actual mouse bot? Just asking.

Don't think it'd be possible to make an actual mouse bot without using images, so it's not possible unless you make a tribe house map using the mouse cjobject. welp
Kuyrukcuxd
« Citoyen »
1486164840000
    • Kuyrukcuxd#0000
    • Profil
    • Derniers messages
#2451
  0
How do I have the person who gains the highest score mentioned through chatMessage?

Dernière modification le 1486241580000
Dramacorn
« Consul »
1486307580000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#2452
  0
Hi, I'm looking for a script that you can give powers gender Mice
admin: dramatotala and kmaaz when one of them write! Powers x have the power to give or spawn objects! y fly fly (like utility for example)
Zzabadi
« Citoyen »
1486409940000
    • Zzabadi#0000
    • Profil
    • Derniers messages
    • Tribu
#2453
  0
please can anyone help me i want script
popup answer if the answer is "yes" give cheese to player
if answer "no" kill the player
and thank you
Onkei
« Citoyen »
1486411980000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2454
  0
Zzabadi a dit :
please can anyone help me i want script
popup answer if the answer is "yes" give cheese to player
if answer "no" kill the player
and thank you

Code Lua

1
2
3
4
5
6
7
8
9
function eventPopupAnswer(id, n, answer)
if answer == "yes" then
tfm.exec.giveCheese(n)
elseif answer == "no" then
tfm.exec.killPlayer(n)
end
end

ui.addPopup(1, 1, "<p align='center'>Do you want cheese?", nil, 20, 20, 200, true)
Dramacorn
« Consul »
1486470900000
    • Dramacorn#2857
    • Profil
    • Derniers messages
    • Tribu
#2455
  0
Dramatotala a dit :
Hi, I'm looking for a script that you can give powers gender Mice
admin: dramatotala and kmaaz when one of them write! Powers x have the power to give or spawn objects! y fly fly (like utility for example)
Massi
« Consul »
1486672800000
    • Massi#0095
    • Profil
    • Derniers messages
    • Tribu
#2456
  0
I need how to create lists of names when I click on name = change map
Zzabadi
« Citoyen »
1486677000000
    • Zzabadi#0000
    • Profil
    • Derniers messages
    • Tribu
#2457
  0
what code for this
http://www8.0zz0.com/2017/02/10/00/854211378.png
Onkei
« Citoyen »
1486716660000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2458
  0
Unlocker001 a dit :
I need how to create lists of names when I click on name = change map

I only created the list of names part since I don't exactly know what maps you would like when you click on name

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local admin = {Onkei = true, Unlocker001 = true}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function showPopup(n)
if admin[n] then
ui.addTextArea(0, "<p align='center'><font size='20'><a href='event:list'>List of Names", n, 10, 20, 200, 30, 0x324650, 0x000000, 1, true)
end
end

function eventNewPlayer(n)
showPopup(n)
end

function eventTextAreaCallback(id, n, cb)
eventChatCommand(n, cb)
end

function eventChatCommand(n, cmd)
if admin[n] then
if cmd == "list" or cmd:sub(1, 6) == "player" then
local str = ""
for n in pairs(tfm.get.room.playerList) do
str = str..""..n..", "
end
ui.addPopup(1, 0, "List of player names in the room;<br><br>( "..str..")", n, 100, 100, 600, true)
end
end
end

main()

Dernière modification le 1486735320000
Massi
« Consul »
1486718160000
    • Massi#0095
    • Profil
    • Derniers messages
    • Tribu
#2459
  0
Onkei a dit :
Unlocker001 a dit :
I need how to create lists of names when I click on name = change map

I only created the list of names part since I don't exactly know what maps you would like when you click on name

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local admin = {Onkei = true, Unlocker001 = true}

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function showPopup(n)
if admin[n] then
ui.addTextArea(0, "<p align='center'><font size='20'><a href='event:list'>List of Names", n, 10, 20, 200, 30, 0x324650, 0x000000, 1, true)
end
end

function eventNewPlayer(n)
showPopup(n)
end

function eventTextAreaCallback(id, n, cb)
eventChatCommand(n, cb)
end

function eventChatCommand(n, cmd)
if admin[n] then
if cmd == "list" or cmd:sub(1, 6) == "player" then
local str = ""
for n in pairs(tfm.get.room.playerList) do
str = str..""..n..", "
end
ui.addPopup(1, 0, "List of player names in the room;<br><br>( "..str..")", n, 100, 100, 600, true)
end
end
end

main()

No this is a list of players name in room I don't need this
I need list of names for example
List of planet <
Earth when I click on Earth = change map to @7046447
...
Etc
Saintgio
« Consul »
1486722240000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#2460
  0
Zzabadi a dit :
what code for this
http://www8.0zz0.com/2017/02/10/00/854211378.png

Example code

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local x = 0
local y = 0

ui.addTextArea(0,"\n\n<N>Settings\n\t\t<BL>•Offset X: <V>"..tostring(x).." <J><a href='event:plusX'>[+]</a> <a href='event:lessX'>[-]</a>\n\t\t<BL>•Offset Y: <V>"..tostring(y).." <J><a href='event:plusY'>[+]</a> <a href='event:lessY'>[-]</a>",nil,250,120,230,250)

function eventTextAreaCallback(id, name, event)
if event=="plusX" then
x = x + 1
elseif event=="plusY" then
y = y + 1
elseif event=="lessX" then
x = x - 1
elseif event=="lessY" then
y = y - 1
end
ui.updateTextArea(0,"\n\n<N>Settings\n\t\t<BL>•Offset X: <V>"..tostring(x).." <J><a href='event:plusX'>[+]</a> <a href='event:lessX'>[-]</a>\n\t\t<BL>•Offset Y: <V>"..tostring(y).." <J><a href='event:plusY'>[+]</a> <a href='event:lessY'>[-]</a>",nil)
end
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 123 / 160 › »
© Atelier801 2018

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

Version 1.27