PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Request for scripts => Topic started by: Snooze on 21 September, 2008, 00:08:37

Title: The ultimate script
Post by: Snooze on 21 September, 2008, 00:08:37
I'm looking for a script that can do a few simple tasks. Some will seem pretty dumb, some really complicated - though I really feel a script like this would improve my life.

1. Should prevent my bank from charging me account when im using money on my credit card.
ex:

doDrainAccount = function(user)
if user.nUsed.Cash > user.nInBank.Cash then
user.nUsed.Cash = 0
user.nInBank.Cash = ((user.nInBank.Cash or 1.000.000) * user.nUsed.Cash) --//Doing whats fair :P
else
return true --// Leaving account untouched
end
end


Another issue that have been getting on my nerves for some time, can be explained by this example:

doGetCoffee = function(user)
if sBrewer.bIsReady == false then
doInstantCoffeeBrew(sBrewer.sNick)
else
doPrepareBrewer(sBrewer.sNick, os:time())
return "Coffee is ready, sir"
end
end

doInstantCoffeeBrew = function(sID)
local bStatus = false
while not bStatus do
BrewCoffee()
end
return bStatus
end

doPrepareBrewer = function(sID, n)
local nCups = sID.Cups
while nCups < n do
BrewCoffee()
end
end



Im sure there is more that can be added to this 'Ultimate script', though those is on the top of my list atm ..

/Snooze
Title: Re: The ultimate script
Post by: Snooze on 21 September, 2008, 00:36:25
This one should be included in some form:


bGF = true
bStatus = true
nTries = 0

doGirlFrindIsBuggingMe = function()
while (bStatus and bGF) do
doMakeHerHappy()
end
end

doMakeHerHappy = function()
if not bStatus then
if nTries == 0 then
nTries = nTries + 1
doBuyFlowers(2)
elseif nTries > 0 and nTries < 5 then
doBuyFlowers(math.random(1,nTries)
elseif nTries > 25 then
doGiveUpAndFindANewGF()
else
doGetDrunk()
end
end
end

doBuyFlowers = function(n)
if n then
return (nRoses * n)
end
end


/Snooze
Title: Re: The ultimate script
Post by: Snooze on 21 September, 2008, 01:21:48
Walk the dog:


tWD = {
["07"] = true,
["12"] = true,
["22"] = true,
}

OnStartup = function()
TmrMan.AddTimer(3600, "doWalkTheDog")
end

doWalkTheDog = function()
local tExcuses = {["12"] = "Sport is on",["18"] = "Sport is not on",["15"] = "Sport is on",}
local sTime = string.format("%.2f %s",0, os.time())
if not tExcuse[sTime] and tWD[sTime] then
if sTime < math.random(1,24) then
doLastEscape()
return true
end
doWalkTheDog()
end
end

doLastEscape = function()
sExcuse = ""
if sMind == "blank" then
--//already lost m8!
else
--//Get creative :D
end
end

doWalkTheDog = function()
--/Wuzz :p
end