Roll The Dice


Author: riddlez1234
Created: 2013-03-11T01:48:23-0400
Edited: 2013-05-05T23:09:34-0400
Denizen Version: 8
Views: 148
Downloads: 998
Likes: 1


WGET
Description: Put in scripts folder, reload.
Use /npc assign --set RollDice on the selected npc to have a simple dice game.

Right click for info, and simply type roll to roll the dice.

Setup to roll a 20 sided die.

Used on play.addictedcrafters.ca
Visit our site @ http://www.addictedcrafters.ca

Fixed not checking player balance!
Few minor updates to code to fix a few things.
Updated with more rolls and few options.

#assignment
"RollDice":
 type: assignment

 interact scripts:
 - 10 roll_dice

 default constants:
     Cost: 500

 actions:
    on assignment:
    - trigger name:click toggle:true
    - trigger name:proximity toggle:true
    - trigger name:chat toggle:true
 
#main script
'roll_dice':
  type: interact
  Requirements:
  Mode: All
  List:
  - MONEY 500
  steps:
    'Announce Self*':
      proximity trigger:
        Entry:
          script:
          - CHAT "&a Hey welcome to the market come and roll the dice, i'm upstairs."
        Exit:
          script:
          - CHAT "&a Goodbye! Come play again."  

      click trigger:
          script:
          - random 4
          - CHAT "&a I will also steal everything on you, but thats part of the risk."
          - CHAT "&a It's wise to play with no one around. ;)"
          - CHAT "&a You may walk away rich or dead, its all luck here."
          - CHAT "&a Say &6roll&a to give the dice a toss, becareful you will die if you roll a (1)."
      chat trigger:
        1:
          trigger: /Roll/ the dice.
          script:
          - if "<player.money>" < "<cons:Cost>" chat 'You only have <red>$<player.money><green>.' else runtask "script:rollit"

'rollit':
  type: task
  script:
          - ^TAKE MONEY QTY:500
          - cooldown duration:10s "script:roll_dice"
          - CHAT "Thanks for the payment and good luck!"
          - WAIT 3
 
# Roll count down
          - CHAT "It's time to roll!"
          - WAIT 1
          - CHAT "3"
          - WAIT 1
          - CHAT "2"
          - WAIT 1
          - CHAT "1"
 
# Will pick a random task from roll scripts below.
          - random 3
          - runtask "script:random_1"
          - runtask "script:random_2"
          - runtask "script:fail"
#Roll Scripts
 
#Fail
'fail':
  type: task
  script:
          - chat "You fail to roll the dice properly, it falls and lands on the floor."
          - wait 1
          - chat "Sorry you didn't win anything, please try again."
#Randomizers
'random_1':
  type: task
  script: #set 1
          - random 10
          - runtask "script:roll_1"
          - runtask "script:roll_2"
          - runtask "script:roll_3"
          - runtask "script:roll_4"
          - runtask "script:roll_5"
          - runtask "script:roll_6"
          - runtask "script:roll_7"
          - runtask "script:roll_8"
          - runtask "script:roll_9"
          - runtask "script:roll_10"

'random_2':
  type: task
  script: #set 2
          - random 10
          - runtask "script:roll_11"
          - runtask "script:roll_12"
          - runtask "script:roll_13"
          - runtask "script:roll_14"
          - runtask "script:roll_15"
          - runtask "script:roll_16"
          - runtask "script:roll_17"
          - runtask "script:roll_18"
          - runtask "script:roll_19"
          - runtask "script:roll_20"
 
#set 1
'roll_1':
  type: task
  script:
  - chat "You have rolled a (1)"
  - chat "Aww shit that means you have to die..."
  - wait 2
  - chat "So sorry bout this."
  - wait 1
  - attack
  - wait 5
  - execute as_server "kill <player.name>"
  - attack stop
 

'roll_2':
  type: task
  script:
  - chat "You have rolled a (2)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."
 

'roll_3':
  type: task
  script:
  - chat "You have rolled a (3)"
  - wait 1
  - execute as_server "give <player.name> 388 3"
  - wait 1
  - chat "Nice you scored 3 Emeralds."
 

'roll_4':
  type: task
  script:
  - chat "You have rolled a (4)"
  - wait 1
  - chat "Hey whats that behind you, take a look."
  - wait 1
  - execute as_server "ci <player.name>"
  - wait 1
  - chat "Well i just stole all your stuff...thanks and try again."
 

'roll_5':
  type: task
  script:
  - chat "You have rolled a (5)"
  - wait 1
  - execute as_server "give <player.name> 384 10"
  - wait 1
  - chat "Nice that's 10 XP Potions you just got."
 

'roll_6':
  type: task
  script:
  - chat "You have rolled a (6)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."
 

'roll_7':
  type: task
  script:
  - chat "You have rolled a (7)"
  - wait 1
  - execute as_server "eco give <player.name> 5000"
  - wait 1
  - chat "Sweet! $5000 thats 10 times your bet back."

'roll_8':
  type: task
  script:
  - chat "you have rolled a (8)"
  - wait 1
  - execute as_server "give <player.name> 264 3"
  - wait 1
  - chat "Booyah! 3 diamonds not bad at all."

'roll_9':
  type: task
  script:
  - chat "You have rolled a (9)"
  - wait 1
  - execute as_server "give <player.name> 322:2 5"
  - wait 1
  - chat "Cool ya got some golden apples to munch on."

'roll_10':
  type: task
  script:
  - chat "You have rolled a (10)"
  - wait 1
  - execute as_server "give <player.name> 373:8262 5"
  - wait 1
  - chat "Now you can see in the dark with these potions."
 
 
 
#set 2
'roll_11':
  type: task
  script:
  - chat "You have rolled a (11)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."

'roll_12':
  type: task
  script:
  - chat "You have rolled a (12)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."

'roll_13':
  type: task
  script:
  - chat "You have rolled a (13)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."

'roll_14':
  type: task
  script:
  - chat "You have rolled a (14)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."

'roll_15':
  type: task
  script:
  - chat "You have rolled a (15)"
  - wait 1
  - execute as_server "eco give <player.name> 5000"
  - wait 1
  - chat "Sweet! $5000 thats 10 times your bet back."

'roll_16':
  type: task
  script:
  - chat "You have rolled a (16)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."

'roll_17':
  type: task
  script:
  - chat "You have rolled a (17)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."

'roll_18':
  type: task
  script:
  - chat "You have rolled a (18)"
  - wait 1
  - execute as_server "eco give <player.name> 5000"
  - wait 1
  - chat "Sweet! $5000 thats 10 times your bet back."

'roll_19':
  type: task
  script:
  - chat "You have rolled a (19)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."

'roll_20':
  type: task
  script:
  - chat "You have rolled a (20)"
  - wait 1
  - chat "Sorry you didn't win anything, please try again."




Comments
2013-03-13 04:58:56 - Flynnftw:

Cool script, but even if the player does not have 500 money it will still let them play.
2013-03-14 03:08:36 - shifty3000:

Would have been awesome if it worked, hope its fixed soon as i have no idea how to fix this myself :/
2013-03-18 15:25:00 - riddlez1234:

working on the bugs guys :) ill have a better version soon.
2013-04-05 11:59:38 - karlo7:

I can confirm that the script doesn't check if the player has enough money. Great idea still!
2013-05-06 10:32:40 - riddlez1234:

all fixed!
2013-05-06 23:15:03 - riddlez1234:

all fixed!
2013-05-07 09:58:04 - riddlez1234:

all fixed!