Steam'i Yükleyin
giriş
|
dil
简体中文 (Basitleştirilmiş Çince)
繁體中文 (Geleneksel Çince)
日本語 (Japonca)
한국어 (Korece)
ไทย (Tayca)
Български (Bulgarca)
Čeština (Çekçe)
Dansk (Danca)
Deutsch (Almanca)
English (İngilizce)
Español - España (İspanyolca - İspanya)
Español - Latinoamérica (İspanyolca - Latin Amerika)
Ελληνικά (Yunanca)
Français (Fransızca)
Italiano (İtalyanca)
Bahasa Indonesia (Endonezce)
Magyar (Macarca)
Nederlands (Hollandaca)
Norsk (Norveççe)
Polski (Lehçe)
Português (Portekizce - Portekiz)
Português - Brasil (Portekizce - Brezilya)
Română (Rumence)
Русский (Rusça)
Suomi (Fince)
Svenska (İsveççe)
Tiếng Việt (Vietnamca)
Українська (Ukraynaca)
Bir çeviri sorunu bildirin
Just wanted to ask if it's possible to write a script that will deal X to a player until they hit Y cards in hand. If a game says at the start of their turn/round, they draw up to 5 cards, is it possible to write a script that can deal cards to a player whether they have 0-4 cards and always stop at 5?
global script
[code]
function onLoad()
lookedobj=getObjectFromGUID("COUNTER GUID TO WATCH")
counterLimit=10
Wait.condition(myevent,routine_limit,30,routine_timeout)
end
function routine_limit()
if lookedobj.getValue() >= counterLimit then
return true
else
return false
end
end
function myevent()
printToAll("Hurray here we do event!")
end
function routine_timeout()
Wait.condition(myevent,routine_limit,30,routine_timeout)
end
[/code]
[code]
group({getObjectFromGUID("maindeckGUID"),getObjectFromGUID("dealtcardsGUID"),getObjectFromGUID("dealtcardsGUID")})
[/code]
global xml
[code]
<VerticalLayout width="100" height="100" rectAlignment="MiddleRight">
<Button text="Change desc" onClick="desc" />
</VerticalLayout>
[/code]
global script
[code]
function onLoad()
lookedobj=getObjectFromGUID("OBJECT GUID TO WATCH DESCRIPTION CHANGE")
savedDesc=lookedobj.getDescription()
Wait.condition(mydice,routine_desc,30,routine_timeout)
end
function desc()
lookedobj.setDescription("" .. math.random(0,9) .. math.random(0,9) .. math.random(0,9))
end
function routine_desc()
local str=lookedobj.getDescription()
if str ~= savedDesc then
savedDesc=str
return true
else
return false
end
end
function mydice()
dicea,diceb=math.random(1,6),math.random(1,6)
printToAll(dicea .. " & " .. diceb .. " = " .. dicea+diceb)
Wait.condition(mydice,routine_desc,30,routine_timeout)
end
function routine_timeout()
Wait.condition(mydice,routine_desc,30,routine_timeout)
end
[/code]
global xml
[code]
<VerticalLayout width="100" height="100" rectAlignment="MiddleRight">
<Button text="Rotate" onClick="rotate" />
</VerticalLayout>
[/code]
global script
[code]
function myrotate(plr, button)
button=math.floor(button)
local obj=getObjectFromGUID("f6ecff")
local cur=obj.getRotationSmooth() or obj.getRotation()
if button ~= -3 then
obj.setRotationSmooth(cur + Vector(0,button == -1 and 10 or -10,0),false,false)
else
startLuaCoroutine(Global, "autorotate")
end
end
function autorotate()
local obj=getObjectFromGUID("f6ecff")
local start=os.time()
obj.setRotationSmooth((obj.getRotationSmooth() or obj.getRotation()) + Vector(0,10,0),false,false)
repeat
if not obj.isSmoothMoving() then
obj.setRotationSmooth((obj.getRotationSmooth() or obj.getRotation()) + Vector(0,10,0),false,false)
else
coroutine.yield(0)
end
until start + 20 < os.time()
return 1
end
[/code]
[code]
function onObjectEnterContainer(cont,obj)
if cont.script_code == "" or cont.script_code == nil then
cont.script_code = obj.script_code
cont.reload()
local str=cont.getGUID()
Wait.time(function() getObjectFromGUID(str).call("reincheck") end,0.1)
elseif cont == self then
reincheck()
end
end
function onObjectLeaveContainer(cont,obj)
if cont == self and #cont.getObjects() >= 2 then
reincheck()
end
end
function reincheck()
local val=0
local conobjs=self.getData()["ContainedObjects"]
for i, run in pairs(conobjs) do
val=val+ (tonumber(run["Nickname"]) or 0)
end
self.setDescription("" .. val)
end
[/code]