AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

virtual die gen

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
taskforce_inc



Joined: 21 Dec 2004
Posts: 6

PostPosted: Tue Dec 28, 2004 11:06 am    Post subject: virtual die gen Reply with quote

I play dnd, and find that my dice are bias, so I made this for my players(so that they would stop Bit#$ing at me for being unfair, its also useful for any type of dice rolling you may need, plus a bonus feature of making a custom die (just in case ya need to roll a 3427-sided die, by chance. anyway, enjoy...


Gui, add, button,, Exit
Gui, add, text,,You rolled:
Gui, add, text, vRoll, _____________________________________
Gui, add, tab,, D2|D3|D4|D6|D8|D10|D12|D20|D30|D100|Custom
Gui, add, text,,How many two-sided dice would you like to roll?
Gui, add, edit, vD2,
Gui, add, button,, Roll-D2
Gui, tab, 2
Gui, add, text,,How many three-sided dice would you like to roll?
Gui, add, edit, vD3,
Gui, add, button,, Roll-D3
Gui, tab, 3
Gui, add, text,,How many four-sided dice would you like to roll?
Gui, add, edit, vD4,
Gui, add, button,, Roll-D4
Gui, tab, 4
Gui, add, text,,How many six-sided dice would you like to roll?
Gui, add, edit, vD6,
Gui, add, button,, Roll-D6
Gui, tab, 5
Gui, add, text,,How many eight-sided dice would you like to roll?
Gui, add, edit, vD8,
Gui, add, button,, Roll-D8
Gui, tab, 6
Gui, add, text,,How many ten-sided dice would you like to roll?
Gui, add, edit, vD10,
Gui, add, button,, Roll-D10
Gui, tab, 7
Gui, add, text,,How many twelve-sided dice would you like to roll?
Gui, add, edit, vD12,
Gui, add, button,, Roll-D12
Gui, tab, 8
Gui, add, text,,How many twenty-sided dice would you like to roll?
Gui, add, edit, vD20,
Gui, add, button,, Roll-D20
Gui, tab, 9
Gui, add, text,,How many thirty-sided dice would you like to roll?
Gui, add, edit, vD30,
Gui, add, button,, Roll-D30
Gui, tab, 10
Gui, add, text,,How many one hundred-sided dice would you like to `nroll?
Gui, add, edit, vD100,
Gui, add, button,, Roll-D100
Gui, tab, 11
Gui, add, text,,How many sides should your dice have?
Gui, add, edit, vCside,
Gui, add, text,,How many dice would you like to roll?
Gui, add, edit, vDcust,
Gui, add, button,, Roll-Custom-Die


Gui, Show,,Virtual Die Roller
Return


;***************************Buttons********************************
ButtonRoll-D2:
GuiControlGet, D2
DiceSide = 2
Min = %D2%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%

Return
;*****************************************************************
ButtonRoll-D3:
GuiControlGet, D3
DiceSide = 3
Min = %D3%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;******************************
ButtonRoll-D4:
GuiControlGet, D4
DiceSide = 4
Min = %D4%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;***************************
ButtonRoll-D6:
GuiControlGet, D6
DiceSide = 6
Min = %D6%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;**********************
ButtonRoll-D8:
GuiControlGet, D8
DiceSide = 8
Min = %D8%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;***********************
ButtonRoll-D10:
GuiControlGet, D10
DiceSide = 10
Min = %D10%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;*************
ButtonRoll-D12:
GuiControlGet, D12
DiceSide = 12
Min = %D12%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;**********
ButtonRoll-D20:
GuiControlGet, D20
DiceSide = 20
Min = %D20%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;************
ButtonRoll-D30:
GuiControlGet, D30
DiceSide = 30
Min = %D30%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;***************
ButtonRoll-D100:
GuiControlGet, D100
DiceSide = 100
Min = %D100%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;************
ButtonRoll-Custom-Die:
GuiControlGet, Cside
GuiControlGet, Dcust
DiceSide = %Cside%
Min = %Dcust%
EnvMult, DiceSide, %Min%
Random, Output, %Min%, %DiceSide%
GuiControl,, Roll, %Output%
return
;******************************************************************
ButtonEXIT:
GuiClose:
Quit:
ExitApp



is there anything this Virtual die gen left out? please let me know and I will update the script


Last edited by taskforce_inc on Tue Dec 28, 2004 6:46 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Dec 28, 2004 12:45 pm    Post subject: Reply with quote

Looks great; thanks for posting it.
Back to top
View user's profile Send private message Send e-mail
Watcher



Joined: 28 Dec 2004
Posts: 60

PostPosted: Tue Dec 28, 2004 1:34 pm    Post subject: Reply with quote

Looks Very cool but I could only see the first digit of the output window. See if this line after the 'you rolled' command helps.

Code:

Gui, add, text, vRoll, ____
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
taskforce_inc



Joined: 21 Dec 2004
Posts: 6

PostPosted: Tue Dec 28, 2004 6:27 pm    Post subject: NONE Reply with quote

Oh there I go, being a retard while I am testing! I used really small numbers when I was testing to make sure the range didnt go above or before what it should of for what ever reason. If I used a number bigger than 3 *cough* and tested more than the d2 and custom I would have noticed this. any way, thanks for the fix, good jobs, works great now. I think I will be adding some fun graphics later on too before she gets compiled again, and put into the D & D character package I am makin... look for that! in a few months if yall are dnd players.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Dec 28, 2004 11:08 pm    Post subject: Reply with quote

Of course, before I test this I'm afraid to tell you: The Random command isn't truly random. In fact, it's impossible for any computer-based system to be truly random, since, by nature, computers are deterministic. By coincidence, I am a die collector, and I happen to know that many excellent dice manufacturers make some wonderful dice. Used with the proper rolling techniques, these dice can be more random than any program. (And they look better while doing it. Wink )

That said, I'll give this a try. It looks cool. Just keep in mind that it would probably fail the standard 10,000 roll testing that manufactured dice usually get. (Chris, if I'm wrong, please enlighten me. I'm just going off what I know.)
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Wed Dec 29, 2004 12:04 am    Post subject: Reply with quote

jonny wrote:
Of course, before I test this I'm afraid to tell you: The Random command isn't truly random.
That's true, but testing shows that the distribution of values returned is fairly even, meaning that you have the same chance of rolling a 20 as for rolling a 1. For this reason, the random number generator is probably random enough for gaming.

Also, although technically deterministic, the Mersenne Twister is far superior to many other pseudo random number generators. I'd guess that it is nearly impossible to calculate what the next random number will be without knowing the interal seed that was used originally, or without being a cryptologist and studying a very large series of random numbers produced by the algorithm.

Credit for this random number generator goes to Takuji Nishimura and Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada.
Back to top
View user's profile Send private message Send e-mail
taskforce_inc



Joined: 21 Dec 2004
Posts: 6

PostPosted: Wed Dec 29, 2004 7:33 am    Post subject: randomness Reply with quote

I understand that the only real way to game is with real die, and my die roll radom. very random, when they are not being used to determine wether the party lives or dies. Then of couse the party dies, and first off thats only fun now and then, and lots of work for me.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
savage



Joined: 02 Jul 2004
Posts: 206

PostPosted: Thu Dec 30, 2004 4:57 am    Post subject: Reply with quote

Heh, I've got a couple of dice like that. They have the incredible ability to make me miss when otherwise there would be practically no chance of failure.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group