-
-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simple test Talkations. delete when finished
- Loading branch information
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
local talkAction = TalkAction("!testOTCR") | ||
|
||
local options = { | ||
["Creature"] = {{ | ||
name = "set attach Effect 7", | ||
action = function(player) | ||
player:attachEffectById(7) | ||
end | ||
}, { | ||
name = "get all attach Effect", | ||
action = function(player) | ||
local effects = player:getAttachedEffects() | ||
if #effects > 0 then | ||
local effectsString = "your AE are: " .. table.concat(effects, ", ") | ||
player:sendTextMessage(MESSAGE_GAMEMASTER_CONSOLE, effectsString) | ||
else | ||
player:sendTextMessage(MESSAGE_GAMEMASTER_CONSOLE, "you do not have any AE.") | ||
end | ||
|
||
end | ||
}, { | ||
name = "detach Effect 7", | ||
action = function(player) | ||
player:detachEffectById(7) | ||
end | ||
}, { | ||
name = "set Shader player", | ||
action = function(player) | ||
player:setShader("Outfit - Rainbow") | ||
end | ||
}, { | ||
name = "no shader player", | ||
action = function(player) | ||
player:setShader("") | ||
end | ||
}, { | ||
name = "get Shader player", | ||
action = function(player) | ||
player:sendTextMessage(MESSAGE_GAMEMASTER_CONSOLE, player:getShader()) | ||
end | ||
}}, | ||
["Map"] = {{ | ||
name = "set Shader Map", | ||
action = function(player) | ||
player:setMapShader("Map - Party") | ||
end | ||
}, { | ||
name = "no shader Map", | ||
action = function(player) | ||
player:setMapShader("") | ||
end | ||
}, { | ||
name = "get Shader Map", | ||
action = function(player) | ||
player:sendTextMessage(MESSAGE_GAMEMASTER_CONSOLE, player:getMapShader()) | ||
end | ||
}}, | ||
["Item"] = {{ | ||
name = "Shader", | ||
action = function(player) | ||
local item = player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK) | ||
item:setShader("Map - Party") | ||
player:sendTextMessage(MESSAGE_GAMEMASTER_CONSOLE, "item have shader : ".. item:getShader()) | ||
end | ||
}} | ||
} | ||
|
||
function talkAction.onSay(player, words, param, type) | ||
local modalWindow = ModalWindow({ | ||
title = "Fast Test", | ||
message = "Choose one of the following options:" | ||
}) | ||
|
||
for category, subOptions in pairs(options) do | ||
modalWindow:addChoice(category, function(player, button, choice) | ||
Check warning on line 75 in data/scripts/talkactions/gm/delete_test_otcr.lua GitHub Actions / luacheck
|
||
local subModalWindow = ModalWindow({ | ||
title = "Select a Sub-Option", | ||
message = "Choose one of the following sub-options for " .. category .. ":" | ||
}) | ||
|
||
for _, subOption in ipairs(subOptions) do | ||
subModalWindow:addChoice(subOption.name, function(player, button, choice) | ||
Check warning on line 82 in data/scripts/talkactions/gm/delete_test_otcr.lua GitHub Actions / luacheck
Check warning on line 82 in data/scripts/talkactions/gm/delete_test_otcr.lua GitHub Actions / luacheck
Check warning on line 82 in data/scripts/talkactions/gm/delete_test_otcr.lua GitHub Actions / luacheck
|
||
if button.name == "OK" then | ||
subOption.action(player) | ||
end | ||
end) | ||
end | ||
|
||
subModalWindow:addButton("OK") | ||
subModalWindow:addButton("Cancel") | ||
subModalWindow:sendToPlayer(player) | ||
end) | ||
end | ||
|
||
modalWindow:addButton("OK") | ||
modalWindow:addButton("Cancel") | ||
modalWindow:sendToPlayer(player) | ||
return false | ||
end | ||
|
||
talkAction:groupType("gamemaster") | ||
talkAction:separator(" ") | ||
talkAction:register() |