[Solved] Gambling using chat Substring

Status
Not open for further replies.
Level 3
Joined
Apr 1, 2017
Messages
47
So the idea is that you guess a number between 1 and 10. You get 3 tries and 2 tips.

Example: you type -5.

Shady Dealer: “Too low!”

-7

Shady Dealer: “Too High!”

-6

Shady Dealer: “You win!!!”

I kinda know how to do that… but I got lost midway xD

  • THE BEGINNING
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to Gamble 25 gold
    • Actions
      • Set Gamble25 = (Buying unit)
      • Unit - Pause Shady Dealer (Male 2) 0417 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Shady Dealer (Male 2) 0417 <gen> is paused) Equal to False
        • Then - Actions
          • Trigger - Turn on Sells <gen>
          • Cinematic - Send transmission to (All players) from Shady Dealer (Male 2) 0417 <gen> named Shady Dealer: Play No sound and display Pick a number!. Modify duration: Add 1.00 seconds and Don't wait
        • Else - Actions
          • Player - Add 25 to (Owner of Gamble25) Current gold
  • Round1
    • Events
      • Player - Player 1 (Red) types a chat message containing - as A substring
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set GambleNumber = (Integer((Substring((Entered chat string), 2, 3))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 10) Equal to GambleNumber
        • Then - Actions
          • Item - Create |cff77bbffPower Card|r at (Center of Region 014 <gen>)
          • Unit - Unpause Shady Dealer (Male 2) 0417 <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 10) Greater than GambleNumber
            • Then - Actions
              • Cinematic - Send transmission to (All players) from Shady Dealer (Male 2) 0417 <gen> named Shady Dealer: Play No sound and display Too low!. Modify duration: Add 1.00 seconds and Don't wait
              • Wait 0.01 seconds
              • Trigger - Turn on Round2 <gen>
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 10) Less than GambleNumber
                • Then - Actions
                  • Cinematic - Send transmission to (All players) from Shady Dealer (Male 2) 0417 <gen> named Shady Dealer: Play No sound and display Too High!. Modify duration: Add 1.00 seconds and Don't wait
                  • Wait 0.01 seconds
                  • Trigger - Turn on Round2 <gen>
                • Else - Actions
                  • Do nothing
  • Round2
    • Events
      • Player - Player 1 (Red) types a chat message containing - as A substring
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set GambleNumber2 = (Integer((Substring((Entered chat string), 2, 3))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between GambleNumber and 10) Equal to GambleNumber2
        • Then - Actions
          • Item - Create |cff77bbffPower Card|r at (Center of Region 014 <gen>)
          • Unit - Unpause Shady Dealer (Male 2) 0417 <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between GambleNumber and 10) Greater than GambleNumber2
            • Then - Actions
              • Cinematic - Send transmission to (All players) from Shady Dealer (Male 2) 0417 <gen> named Shady Dealer: Play No sound and display Too low!. Modify duration: Add 1.00 seconds and Don't wait
              • Wait 0.01 seconds
              • Trigger - Turn on FinalRound <gen>
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between GambleNumber and 10) Less than GambleNumber2
                • Then - Actions
                  • Cinematic - Send transmission to (All players) from Shady Dealer (Male 2) 0417 <gen> named Shady Dealer: Play No sound and display Too High!. Modify duration: Add 1.00 seconds and Don't wait
                  • Wait 0.01 seconds
                  • Trigger - Turn on FinalRound <gen>
                • Else - Actions
                  • Do nothing
  • FinalRound
    • Events
      • Player - Player 1 (Red) types a chat message containing - as A substring
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set GambleNumber3 = (Integer((Substring((Entered chat string), 2, 3))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between GambleNumber2 and 10) Equal to GambleNumber3
        • Then - Actions
          • Item - Create |cff77bbffPower Card|r at (Center of Region 014 <gen>)
          • Unit - Unpause Shady Dealer (Male 2) 0417 <gen>
        • Else - Actions
      • Unit - Unpause Shady Dealer (Male 2) 0417 <gen>
      • Cinematic - Send transmission to (All players) from Shady Dealer (Male 2) 0417 <gen> named Shady Dealer: Play No sound and display You loose!. Modify duration: Add 1.00 seconds and Don't wait
C’mon people, bail me out!
 
Last edited:
This Random Number changes every try, is that wanted?
User can cheat this by saying: 10 and 10 = 100% win. (which he won't know)

If you want that the number changes each time but stays inside two limits, best way is to define the max and min and manipulate this max/min values depending on the to high/low.
Currently you only manipulate the min even if it is to high.
  • Gamble Start
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Set GambelMax = 10
      • Set GambelMin = 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between GambelMin and GambelMax) Equal Try1
        • Then - Actions
          • -------- Win --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between GambelMin and GambelMax) smaller as Try1
            • Then - Actions
              • -------- To High --------
              • Set GambelMax = Try1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between GambelMin and GambelMax) Greater as Try1
                • Then - Actions
                  • -------- To Low --------
                  • Set GambelMin = Try1
                • Else - Actions

Or save the randomNumber at the start and only say to high/low
  • set RandomNumber = Randam integer number between 1 and 10
 
Level 3
Joined
Apr 1, 2017
Messages
47
This Random Number changes every try, is that wanted?
User can cheat this by saying: 10 and 10 = 100% win. (which he won know in most cases)

If you want that the number changes each time but stays inside two limits, best way is to define the max and min and manipulate this max/min values depending on the to high/low.
Currently you only manipulate the min even if it is to high.
  • Gamble Start
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Set GambelMax = 10
      • Set GambelMin = 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between GambelMin and GambelMax) Equal Try1
        • Then - Actions
          • -------- Win --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between GambelMin and GambelMax) smaller as Try1
            • Then - Actions
              • -------- To High --------
              • Set GambelMax = Try1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between GambelMin and GambelMax) Greater as Try1
                • Then - Actions
                  • -------- To Low --------
                  • Set GambelMin = Try1
                • Else - Actions

Or save the randomNumber at the start and only say to high/low
  • set RandomNumber = Randam integer number between 1 and 10
oh yeah, how couldn't I thought of that
 
Status
Not open for further replies.
Top