Yamo
New Member
- Joined
- Jun 8, 2008
- Messages
- 77
- Reaction score
- 2
Heyo all,
I want to learn to script in lua for ot's and I think the best way to learn is by just trying.
My first script is a modify on the actionscript of the dice, which makes it a roulette (table)
Feedback is appreciated.
[/CODE]
EDIT:
Oops, I think I created this topic on the wrong (sub)forum
I want to learn to script in lua for ot's and I think the best way to learn is by just trying.
My first script is a modify on the actionscript of the dice, which makes it a roulette (table)
Feedback is appreciated.
Code:
[code=lua]
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x ~= CONTAINER_POSITION) then
doSendMagicEffect(fromPosition, CONST_ME_CRAPS)
end
local value = math.random(5700, 5736) - 5700
local color = ""
if(value == 0) then
color = "green"
elseif(value <= 10 and value % 2 == 0) then
color = "black"
elseif(value >= 11 and value <= 19 and value % 2 == 1) then
color = "black"
elseif(value >= 26 and value % 2 == 0) then
color = "black"
else
color="red"
end
doCreatureSay(cid, getCreatureName(cid) .. ' rolled ' .. value .. ', ' .. color .. '!', TALKTYPE_ORANGE_1)
return true
end
EDIT:
Oops, I think I created this topic on the wrong (sub)forum
Last edited: