[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Error

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Error
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by WRTIII   Canada  (76 posts)  [Biography] bio
Date Sun 03 Apr 2005 08:15 AM (UTC)  quote  ]
Message
If Anyone is any good with odds..

It's a dice game.
Minimum Bet 500coins
Max Bet 4000 coins
The house rolls a single 6 sided dice
Then you either roll
Tie or Less you lose your bet
or you can CUT in which you get half your bet back
WAGER / 2 rounded down to the nearest 1

Right now
If the house rolls a 1 2 or 3 then I throw the dice
If the house rolls a 4 5 or 6 then I cut my losses

I start with a wager of 500
Anytime I win I reset my wager to 500
If I cut my dice then I take my wager that round and add 500 to it.

If I lose then I double my wager that round and double it.

WAGER WIN CUT LOSE
500 1000 1000 1000
1000 2000 1500 2000
1500 3000 2000 3000
2000 4000 2500 4000
2500 5000 3000 4000
3000 6000 3500 4000
3500 7000 4000 4000
4000 8000 4000 4000

If anyone knows a way to beat theese odds and how would be better to bet on this It would help

not too sure how my method will work or not, seems so far I am sitting pretty much even, but sitting more on the edge of slowly losing money.

thanks
[Go to top] top

Posted by WRTIII   Canada  (76 posts)  [Biography] bio
Date Sun 03 Apr 2005 07:34 AM (UTC)  quote  ]
Message
<triggers>
<trigger
enabled="y"
group="DICE GAME"
match="&quot;Winner!, We have a winner!&quot; cries the manager with excitement."
name="WINNER"
script="DICEWIN"
sequence="100"
sound="C:\Program Files\Ahead\Nero\Trumpet1.wav"
>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat two to win!&quot;"
name="TWO"
sequence="100"
>
<send>throw dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat three to win!&quot;"
name="THREE"
sequence="100"
>
<send>throw dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat six to win!&quot;"
name="SIX"
sequence="100"
>
<send>cut dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat one to win!&quot;"
name="ONE"
sequence="100"
>
<send>throw dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="*&quot;You lose&quot;, cries the manager, with unmistakable glee in his voice."
name="LOSER"
sequence="100"
sound="C:\Program Files\AIM95\Sounds\moo.wav"
>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat four to win!&quot;"
name="FOUR"
sequence="100"
>
<send>cut dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat five to win!&quot;"
name="FIVE"
sequence="100"
>
<send>cut dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="*You tell the manager you would like to cut, and take back half your stake of"
name="CUT"
script="DICECUT"
sequence="100"
sound="C:\Program Files\Ahead\Nero\DingDong.wav"
>
</trigger>
<trigger
enabled="y"
expand_variables="y"
group="DICE GAME"
match="&quot;New game!&quot;, cries the manager of the dice table, &quot;Place your bets now!&quot;"
name="BET"
sequence="100"
>
<send>bet @wager</send>
</trigger>
</triggers>

<variables>
<variable name="WAGER">500</variable>
</variables>

Dim WAGER

Sub DICECUT (sName, sLine, wildcards)
WAGER = world.GetVariable ("WAGER")

WAGER = WAGER + 500
If WAGER > 4000 then
WAGER = 4000
End if
world.SetVariable "WAGER", WAGER
world.note WAGER
End Sub

Sub DICEWIN (sName, sLine, wildcards)
WAGER = world.GetVariable ("WAGER")
WAGER = 500
world.SetVariable "WAGER", WAGER
world.note WAGER
End Sub

Sub DICELOSE (sName, sLine, wildcards)
WAGER = world.GetVariable ("WAGER")
WAGER = WAGER * 2
If WAGER > 4000 then
WAGER = 4000
End if
world.SetVariable "WAGER", WAGER
world.note WAGER
End Sub


All Seems to be working now. thanks flannel
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Sun 03 Apr 2005 07:08 AM (UTC)  quote  ]
Message
Well, that second one is largely different than the first.

What's the problem then (and how would that script be called from the BET trigger? Since that's originally what caused the problem, yet it doesn't have the script call).

Check to make sure you've got a good value in the variable, since that seems to be whats causing the problem.

Also, calling the script AND sending something (that get's modified by the script) might end with results that you don't want) you might call and then send, or vice versa, I don't remember which way they get evaluated, it's somewhere around these forums though.
Since the script doesn't use any of the variables passed (line, name, wildcards) you could call it from within your 'send' box, to specify. Although that wouldn't cause this problem.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by WRTIII   Canada  (76 posts)  [Biography] bio
Date Sun 03 Apr 2005 06:56 AM (UTC)  quote  ]
Message
<triggers>
<trigger
group="DICE GAME"
match="&quot;New game!&quot;, cries the manager of the dice table, &quot;Place your bets now!&quot;"
name="BET"
script="dicecut"
sequence="100"
>
<send>bet 500</send>
</trigger>
</triggers>


Line 55: Wager = Wager + 500


I had removed the script call from the trigger, but the script would be called from pretty much all the triggers,

Triggers:
WINNER - Would Set the Variable to 500
CUT - Would Take the Varible and add 500 to it
LOSER - Would take the varible and double it

so actually just 3 calls I guess,
and a failsafe to make sure the varible if over 4000 is set to the number 4000

So I guess my triggers would look like this:

<triggers>
<trigger
enabled="y"
group="DICE GAME"
match="&quot;Winner!, We have a winner!&quot; cries the manager with excitement."
name="WINNER"
script="DICEWIN"
sequence="100"
sound="C:\Program Files\Ahead\Nero\Trumpet1.wav"
>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="*&quot;You lose&quot;, cries the manager, with unmistakable glee in his voice."
name="LOSER"
sequence="100"
sound="C:\Program Files\AIM95\Sounds\moo.wav"
>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="*You tell the manager you would like to cut, and take back half your stake of"
name="CUT"
script="DICECUT"
sequence="100"
sound="C:\Program Files\Ahead\Nero\DingDong.wav"
>
</trigger>
<trigger
enabled="y"
expand_variables="y"
group="DICE GAME"
match="&quot;New game!&quot;, cries the manager of the dice table, &quot;Place your bets now!&quot;"
name="BET"
sequence="100"
>
<send>bet @wager</send>
</trigger>
</triggers>
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Sun 03 Apr 2005 06:48 AM (UTC)  quote  ]
Message
Where does your script get called (I don't see it anywhere).

And which line is line 55?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by WRTIII   Canada  (76 posts)  [Biography] bio
Date Sun 03 Apr 2005 06:15 AM (UTC)  quote  ]
Message
Error number: -2146828275
Event: Execution of line 55 column 1
Description: Type mismatch: 'Wager'
Called by: Function/Sub: dicecut called by trigger
Reason: processing trigger "BET"


Sub Dicecut (sName, sLine, wildcards)

dim Wager

Wager = world.GetVariable ("Wager")

if isempty (Wager) then
world.note "My wager is not defined"
end if
if isnull (Wager) then
world.note "Invalid variable wager"
end if

Wager = Wager + 500
world.note Wager
world.SetVariable "Wager", Wager

End Sub

<triggers>
<trigger
enabled="y"
group="DICE GAME"
match="&quot;Winner!, We have a winner!&quot; cries the manager with excitement."
name="WINNER"
sequence="100"
sound="C:\Program Files\Ahead\Nero\Trumpet1.wav"
>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat two to win!&quot;"
name="TWO"
sequence="100"
>
<send>throw dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat three to win!&quot;"
name="THREE"
sequence="100"
>
<send>throw dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat six to win!&quot;"
name="SIX"
sequence="100"
>
<send>cut dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat one to win!&quot;"
name="ONE"
sequence="100"
>
<send>throw dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="*&quot;You lose&quot;, cries the manager, with unmistakable glee in his voice."
name="LOSER"
sequence="100"
sound="C:\Program Files\AIM95\Sounds\moo.wav"
>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat four to win!&quot;"
name="FOUR"
sequence="100"
>
<send>cut dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="* Throw the dice and beat five to win!&quot;"
name="FIVE"
sequence="100"
>
<send>cut dice</send>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="*You tell the manager you would like to cut, and take back half your stake of"
name="CUT"
sequence="100"
sound="C:\Program Files\Ahead\Nero\DingDong.wav"
>
</trigger>
<trigger
enabled="y"
group="DICE GAME"
match="&quot;New game!&quot;, cries the manager of the dice table, &quot;Place your bets now!&quot;"
name="BET"
sequence="100"
>
<send>bet 500</send>
</trigger>
</triggers>


The Minimum Bid is 500, Maxiumum 4000
I want to make it so when one of my triggers runs that makes me CUT DICE then It takes the wager value and adds 500

If it happens that I lose, Then it takes the wager value and multiples it by 2

If I win, then the wager value is reset back to 500

I need a check on each time it adjusts the wager so that if the value is over the Number 4000, It is set to 4000

any help would be appreciated, thanks
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,678 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]