Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions objects/Search-A-Card.24051a.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"playercards/CardSearch\")",
"LuaScript": "require(\"playercards/Search-A-Card\")",
"LuaScriptState": "[true,false,\"\"]",
"MeasureMovement": false,
"Name": "Custom_Tile",
Expand All @@ -48,9 +48,9 @@
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 4,
"scaleX": 4.5,
"scaleY": 1,
"scaleZ": 4
"scaleZ": 4.5
},
"Value": 0,
"XmlUI": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ BUTTON_LABELS["search"][true] = "Name equals search term"
BUTTON_LABELS["search"][false] = "Name contains search term"

local inputParameters = {}
inputParameters.label = "Click to enter card name"
inputParameters.label = "Enter name / ID"
inputParameters.input_function = "input_func"
inputParameters.function_owner = self
inputParameters.alignment = 2
inputParameters.position = { x = 0, y = 0.1, z = -0.62 }
inputParameters.width = 3750
inputParameters.height = 380
inputParameters.font_size = 350
inputParameters.scale = { 0.1, 1, 0.1 }
inputParameters.position = { x = 0, y = 0.1, z = -0.6 }
inputParameters.width = 3500
inputParameters.height = 450
inputParameters.font_size = 400
inputParameters.scale = { 0.12, 1, 0.12 }
inputParameters.color = { 0.9, 0.7, 0.5 }
inputParameters.font_color = { 0, 0, 0 }

Expand Down Expand Up @@ -103,11 +103,13 @@ function startSearch()
return
end

-- if the search string is a number, assume it's an ID and spawn the card directly
if tonumber(inputParameters.value) then
-- if the search string doesn't contain whitespace, attempt to treat it as ID
if not string.find(inputParameters.value, "%s") then
local singleCard = allCardsBagApi.getCardById(inputParameters.value)
spawnCardList({ singleCard })
return
if singleCard ~= nil then
spawnCardList({ singleCard })
return
end
end

-- search all objects in bag
Expand Down