Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Это затратно, и будет загружать игру
там при нажатии вещи раскладываются по столу, но при этом все и все при загрузке лежит в мешочках
удобно
-- Universal Counter Tokens
--Saves the count value into a table (data_to_save) then encodes it into the Tabletop save
function onSave()
local data_to_save = {saved_count = count}
saved_data = JSON.encode(data_to_save)
return saved_data
end
--Loads the saved data then creates the buttons
function onload(saved_data)
generateButtonParamiters()
--Checks if there is a saved data. If there is, it gets the saved value for 'count'
if saved_data != '' then
local loaded_data = JSON.decode(saved_data)
count = loaded_data.saved_count
else
--If there wasn't saved data, the default value is set to 10.
count = 10
end
--Generates the buttons after putting the count value onto the 'display' button
b_display.label = tostring(count)
if count >= 100 then
b_display.font_size = 100
else
b_display.font_size = 100
end
self.createButton(b_display)
self.createButton(b_plus)
self.createButton(b_minus)
self.createButton(b_plus5)
self.createButton(b_minus5)
self.createButton(b_plus100)
self.createButton(b_minus100)
self.createButton(b_plus1000)
self.createButton(b_minus1000)
end
--Activates when + is hit. Adds 1 to 'count' then updates the display button.
function increase()
count = count + 1
updateDisplay()
end
--Activates when - is hit. Subtracts 1 from 'count' then updates the display button.
function decrease()
--Prevents count from going below 0
if count > 0 then
count = count - 1
updateDisplay()
end
end
--Activates when + is hit. Adds 5 to 'count' then updates the display button.
function increase5()
count = count + 10
updateDisplay()
end
--Activates when + is hit. Adds 5 to 'count' then updates the display button.
function increase1000()
count = count + 1000
updateDisplay()
end
--Activates when - is hit. Subtracts 5 from 'count' then updates the display button.
function decrease5()
--Prevents count from going below 0
if count > 9 then
count = count - 10
else
count = 0
end
updateDisplay()
end
function increase100()
count = count + 100
updateDisplay()
end
--Activates when - is hit. Subtracts 5 from 'count' then updates the display button.
function decrease100()
--Prevents count from going below 0
if count > 99 then
count = count - 100
else
count = 0
end
updateDisplay()
end
--Activates when - is hit. Subtracts 5 from 'count' then updates the display button.
function decrease1000()
--Prevents count from going below 0
if count > 999 then
count = count - 1000
else
count = 0
end
updateDisplay()
end
function customSet()
local description = self.getDescription()
if description != '' and type(tonumber(description)) == 'number' then
self.setDescription('')
count = tonumber(description)
updateDisplay()
end
end
--function that updates the display. I trigger it whenever I change 'count'
function updateDisplay()
--If statement to resize font size if it gets too long
if count >= 100 then
b_display.font_size = 100
else
b_display.font_size = 100
end
b_display.label = tostring(count)
self.editButton(b_display)
end
--This is activated when onload runs. This sets all paramiters for our buttons.
--I do not have to put this all into a function, but I prefer to do it this way.
function generateButtonParamiters()
b_display = {
index = 0, click_function = 'customSet', function_owner = self, label = '',
position = {0,0.1,0.65}, width = 325, height = 200, font_size = 10
}
b_plus = {
click_function = 'increase', function_owner = self, label = '+1',
position = {0.8,0.1,0.75}, width = 150, height = 150, font_size = 90
}
b_minus = {
click_function = 'decrease', function_owner = self, label = '-1',
position = {-0.8,0.1,0.75}, width = 150, height = 150, font_size = 90
}
b_plus5 = {
click_function = 'increase5', function_owner = self, label = '+10',
position = {0.8,0.1,0.25}, width = 150, height = 150, font_size = 90
}
b_minus5 = {
click_function = 'decrease5', function_owner = self, label = '-10',
position = {-0.8,0.1,0.25}, width = 150, height = 150, font_size = 90
}
b_plus100 = {
click_function = 'increase100', function_owner = self, label = '+100',
position = {0.78,0.1,-0.25}, width = 250, height = 150, font_size = 90
}
b_minus100 = {
click_function = 'decrease100', function_owner = self, label = '-100',
position = {-0.78,0.1,-0.25}, width = 250, height = 150, font_size = 90
}
b_plus1000 = {
click_function = 'increase1000', function_owner = self, label = '+1000',
position = {0.72,0.1,-0.75}, width = 300, height = 150, font_size = 90
}
b_minus1000 = {
click_function = 'decrease1000', function_owner = self, label = '-1000',
position = {-0.72,0.1,-0.75}, width = 300, height = 150, font_size = 90
}
end