obj
Casino_Items
var/spinning = 0
var/Jackpot= 0
var/a1 = 0
var/a2 = 0
var/a3 = 0
var/b1 = 0
var/b2 = 0
var/b3 = 0
var/c1 = 0
var/c2 = 0
var/c3 = 0
var/PutIn = 0
icon = 'ObjsCasino.dmi'
density = TRUE
Spinning
icon_state = "spinning"
Jackpot
icon_state = "Jackpot"
a1
icon_state = "a1"
a2
icon_state = "a2"
a3
icon_state = "a3"
b1
icon_state = "b1"
b2
icon_state = "b2"
b3
icon_state = "b3"
c1
icon_state = "c1"
c2
icon_state = "c2"
c3
icon_state = "c3"
Slot_Machine
icon_state = "Machine"
verb
Play()
set src in oview(1)
if(usr.meditating)
usr<<"You cannot use this while meditating"
return
if(usr.powering)
usr<<"You cannot use this while powering"
return
if(spinning)
usr<<"This machine is already in use"
return
if(!usr.coins)
usr<<"You already Input coins in"
return
var/coin_amount = input("How many coins would you like to enter?\n- Your Coins: [cn(usr.coins)]\n- Max Limit is 777","Input Coins")as num|null
usr<<"You input [coin_amount] Coins"
if(coin_amount >= 778)
usr<<"Info: Max Limit is 777"
return
if(!coin_amount) return
if(coin_amount > usr.coins)
usr<<"You don't have that many coins!"
return
else
spinning = 1
usr.coins -= coin_amount
flick("Pull",src)
overlays += new/obj/Casino_Items/Spinning
usr.frozen = 1
sleep(50)
usr.frozen = 0
overlays = null
switch(rand(1,7))
if(1)
overlays += new/obj/Casino_Items/Jackpot
sleep(7)
overlays += new/obj/Casino_Items/a1
sleep(7)
overlays += new/obj/Casino_Items/b2
sleep(7)
overlays += new/obj/Casino_Items/c1
sleep(7)
spinning = 0
PutIn = 0
overlays = null
var/amount = coin_amount * 2
usr<<"~Jackpot! [amount] coins come tumbling out of the machine!"
usr.coins += amount
if(2)
overlays += new/obj/Casino_Items/Jackpot
sleep(7)
overlays += new/obj/Casino_Items/a1
sleep(7)
overlays += new/obj/Casino_Items/b2
sleep(7)
overlays += new/obj/Casino_Items/c1
sleep(7)
overlays = null
spinning = 0
PutIn = 0
var/amount = coin_amount * 3
usr<<"~Jackpot! [amount] coins come tumbling out of the machine!"
usr.coins += amount
if(3)
overlays += new/obj/Casino_Items/Jackpot
sleep(7)
overlays += new/obj/Casino_Items/a3
sleep(7)
overlays += new/obj/Casino_Items/b3
sleep(7)
overlays += new/obj/Casino_Items/c3
sleep(7)
overlays = null
spinning = 0
PutIn = 0
var/amount = coin_amount * 6
usr<<"~Jackpot! [amount] coins come tumbling out of the machine!"
usr.coins += amount
if(4)
overlays += new/obj/Casino_Items/Jackpot
sleep(7)
overlays += new/obj/Casino_Items/a1
sleep(7)
overlays += new/obj/Casino_Items/b2
sleep(7)
overlays += new/obj/Casino_Items/c3
sleep(7)
overlays = null
spinning = 0
PutIn = 0
usr<<"You lose. Better luck next time."
if(5)
overlays += new/obj/Casino_Items/Jackpot
sleep(7)
overlays += new/obj/Casino_Items/a3
sleep(7)
overlays += new/obj/Casino_Items/b2
sleep(7)
overlays += new/obj/Casino_Items/c1
sleep(7)
overlays = null
spinning = 0
PutIn = 0
usr<<"You lose. Better luck next time."
if(6)
overlays += new/obj/Casino_Items/Jackpot
sleep(7)
overlays += new/obj/Casino_Items/a2
sleep(7)
overlays += new/obj/Casino_Items/b2
sleep(7)
overlays += new/obj/Casino_Items/c2
sleep(7)
overlays = null
spinning = 0
PutIn = 0
var/amount = coin_amount * 2
usr<<"~Jackpot! [amount] coins come tumbling out of the machine!"
usr.coins += amount
return
if(7)
overlays += new/obj/Casino_Items/Jackpot
sleep(7)
overlays += new/obj/Casino_Items/a1
sleep(7)
overlays += new/obj/Casino_Items/b3
sleep(7)
overlays += new/obj/Casino_Items/c1
sleep(7)
overlays = null
spinning = 0
PutIn = 0
var/amount = coin_amount * 3
usr<<"~Jackpot! [amount] coins come tumbling out of the machine!"
usr.coins += amount
First you can repeatedly use the play verb, then you'll be able to spam slots.So can someone can help me fix that you won`t be able to repetedly use play verb.
ID:140039
![]() Jun 6 2010, 6:19 am
|
|
No, there's a massive difference between spawn() and sleep(), though I will wait for someone more experienced to say the difference.
Also, use the DM tags. :/ |
sleep() pauses the proc
spawn() does not pause the proc, but runs a statement after an amount of time so spawn and sleep are just ways to do things after a delay |
if you couldn't mind could you tell us what this proc is actually suppose to do so i don't have to kill my eyes reading all that code, and when i say tell us i mean explain in great detail.
|
Masschaos100 wrote:
if you couldn't mind could you tell us what this proc is actually suppose to do so i don't have to kill my eyes reading all that code, and when i say tell us i mean explain in great detail. Slot_Machine icon_state = "Machine" verb Play() set src in oview(1) if(usr.meditating) usr<<"<font color=red>You cannot use this while meditating" return if(usr.powering) usr<<"<font color=red>You cannot use this while powering" return if(spinning) usr<<"<font color=red>This machine is already in use" return if(!usr.coins) usr<<"<font color=red>You don't have any coins to play with" return if(usr.input) usr<<"<font color=red>You already Input coins in" return var/coin_amount = input("How many coins would you like to enter?\n- Your Coins: [cn(usr.coins)]\n- Max Limit is 777","Input Coins")as num|null usr<<"You input [coin_amount] Coins" if(coin_amount >= 778) usr<<"<font color=red>Info: <font color=white>Max Limit is 777" return if(!coin_amount) return if(coin_amount > usr.coins) usr<<"<font color=red>You don't have that many coins!" return If you klick on play and then on screem you can spam play verb then yust input numbers.So how to fix that ? |
By verifying the conditions of an action after control is lost by a subroutine. In this case, input() causes a loss of control, so you will need to re-verify the conditions once control is returned.
|
Garthor wrote:
By verifying the conditions of an action after control is lost by a subroutine. In this case, input() causes a loss of control, so you will need to re-verify the conditions once control is returned. Can you show me how t odo it, im a little bit lost |
Uuuuunnnggggh...
Remove all of your Casino items. Make lists containing the icons you want to add as overlays. Then use Copy(). Much more cleaner and organized code. |
Don't know where in the code (too long for me to read it XD) but at the end of the verb, you could just put spawn(), although, as i type, that may not be a 100% perfect idea....