bingo
-
Tuesday, September 18, 2012 5:16 PM
hey boys and girls,
I have a litlle questoin on the lottery I want to make in the graphicswindow, with numbers so I thought with math function I could use randomnumber but I don't now how to get that number visible on my screen and maybe If someone now how I dont get the same number 2 I would be in the sky of happyness Xd
if it is completely wrong do you want me to explain why
For testing I use the number 100 just to make it easy and only do 3 numbers
this is already what I have, so you can see what I want to do
GraphicsWindow.Show()
GraphicsWindow.DrawText(200,200, "Loterij")
' just fun XD GraphicsWindow.BackgroundColor = "yellow"
GraphicsWindow.KeyDown = lot
GraphicsWindow.DrawText(200,220, "1ste plek:")
GraphicsWindow.DrawText(200,240, "2de plek:")
GraphicsWindow.DrawText(200,260, "3de plek:")
Sub lot
if GraphicsWindow.LastKey = "1" Then
Math.GetRandomNumber(100)
ElseIf GraphicsWindow.LastKey = "2" Then
Math.GetRandomNumber(100)
ElseIf GraphicsWindow.LastKey = "3" Then
Math.GetRandomNumber(100)
EndIf
EndSub____ thx for helping me out,
All Replies
-
Tuesday, September 18, 2012 5:51 PM
You have to assign the output of Math.GetRandomNumber to a variable:
e.g. Lotnr1=Math.GetRandomNumber(100)
After that you can write that variable to the output window.
Ik hoop dat je hier iets aan hebt
Jan [ WhTurner ] The Netherlands
-
Tuesday, September 18, 2012 7:47 PMGraphicsWindow.Show()
GraphicsWindow.DrawText(200, 165, "Codes A is getal 1, B is getal 2, C is getal 3")
GraphicsWindow.DrawText(200,180, "en Z maakt het scherm leeg voor volgende ronde")
GraphicsWindow.BackgroundColor = "yellow"
GraphicsWindow.DrawText(200,200, "LOTERIJ")
GraphicsWindow.DrawText(200,220, "1ste plek:")
GraphicsWindow.DrawText(200,240, "2de plek:")
GraphicsWindow.DrawText(200,260, "3de plek:")
GraphicsWindow.KeyDown = lot
Sub lot
if GraphicsWindow.LastKey = "A" Then
Lotnr1=Math.GetRandomNumber(100)
GraphicsWindow.DrawText(260,220, Lotnr1)
ElseIf GraphicsWindow.LastKey = "B" Then
Lotnr2=Math.GetRandomNumber(100)
GraphicsWindow.DrawText(260,240, Lotnr2)
ElseIf GraphicsWindow.LastKey = "C" Then
Lotnr3=Math.GetRandomNumber(100)
GraphicsWindow.DrawText(260,260, Lotnr3)
elseif GraphicsWindow.LastKey = "Z" then
GraphicsWindow.Clear()
GraphicsWindow.Show()
GraphicsWindow.DrawText(200, 165, "Codes A is getal 1, B is getal 2, C is getal 3")
GraphicsWindow.DrawText(200,180, "en Z maakt het scherm leeg voor volgende ronde")
GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor()
GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor()
GraphicsWindow.DrawText(200,200, "LOTERIJ")
GraphicsWindow.DrawText(200,220, "1ste plek:")
GraphicsWindow.DrawText(200,240, "2de plek:")
GraphicsWindow.DrawText(200,260, "3de plek:")
EndIf
If Lotnr2 = Lotnr1 Then
Lotnr2=Math.GetRandomNumber(100)
GraphicsWindow.DrawText(285,240, Lotnr2)
EndIf
If Lotnr3 = Lotnr1 Then
Lotnr3=Math.GetRandomNumber(100)
GraphicsWindow.DrawText(285,260, Lotnr3)
EndIf
If Lotnr3 = Lotnr2 Then
Lotnr3=Math.GetRandomNumber(100)
GraphicsWindow.DrawText(310,260, Lotnr3)
EndIf
EndSub
dat is hem nu al geworden druk ik nu b of c maakt die automatisch een nieuw getal als die gelijk is aan a en met c ook als die gelijk is aan b. wat ik nu nog wil (druk 2 keer bijv. op a) is dat ie niet 2 getallen laat zien maar dan de vorige weghaalt en niet geheel de functie van z heeft dat die alles weghaalt maar echt enkel het specifieke getal dat op a zit
ik zal wel ff een verdere uitleg geven waarom ik dit maak:
het is dat ik in een spel in een gilde zit met grondstoffen en dan willen ze een bingo spel hebben dat n1 50% wint n2 30% en n3 20%
het probleem is de persoon die bingo heeft kan maar tot 60 nummers op zich niet zo erg maar het is wel zo dat als we nou 61 mensen hebben die meedoen dus niet meer mee kunnen doen.
en dat je maximaal 2x per maand een pot(je) kan winnen en als dus in een maand 2x het getal 54 bijv. is geweest en die komt dan nog eens langs dan is het makkelijker dat ie het oude getal weghaalt en er een andere terug zet kan hem wel zo zetten dat hij er een ander getal naast zet maar dan heb je uiteindelijk een langere balk nodig terwijl die met een paar regels misschien alle tekst kan laten staan en Z nood oplossing kan spelen. dus dacht ik aan een specifieke nummerweghaling waar ik nu ook vol over aan het denken ben en als dat is gedaan is ie tot dusver nagedacht af want worden het 4 prijzen dan is het kopie en paste van nummer 2 of 3 en dan ff de aanpassingen erin doen en dan kan ik hem zo lang maken als ik zelf wil.
maar echt bedankt jan was echt erg nuttig zoals je ziet ziet het er nu ook beter uit met veel minder losse eindjes
(update express het huidige resultaat erbij, zodat je kan zien wat ik uiteindelijk heb en als iemand het weer probeert dat ie ook een mooi spiekprogrammatje heeft)
gr.pk
- Edited by Pktje Tuesday, September 18, 2012 9:30 PM Update
-
Tuesday, September 18, 2012 9:43 PMAnswerer
Well, I don't know Dutch!
But perhaps this old thread can also help you out:
Random Number without replacement
Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)
-
Tuesday, September 18, 2012 10:45 PM
Translation:
that's him already become busy I b or c that automatically creates a new number as equal to a and c as equal to b. I still want (eg press 2 times to a) that he is not 2 digits show but then removes the last and not the whole function of z has that removes everything but really only the specific number that is a
I'll ff further explain why I do this:
it is that I am in a game in a guild sits with raw materials and then they want a bingo game that wins 50% n1 n2 n3 30% and 20%
the problem is the person who can only have up to 60 bingo numbers are not so bad but it is true that if we now have 61 people who participate can no longer participate.
and that you are up to 2x per month a pot (you) can win, and if so in a month 2x the number 54 for example has been and is then further along than it is easier that he take away the old number and another back can put him up so that he has a different number next move but then you eventually need a longer bar, while those with a few lines of text can perhaps all leave and Z stopgap can play. So I thought of a specific nummerweghaling where I now am full of thinking and if that is done he is so far considered to be off because the 4 prizes then the copy and paste of number 2 or 3, then ff the adjustments it and then I can do it for as long as I want.
but really thank January was really useful as you can see it looks better now with much less loose ends
(Update express the current result there, so you can see what I finally did, and if someone tries again that he also has a nice cheat program manages)
gr.pk
-Noah J. Buscher "Nothing is Impossible Until Proven Impossible."
-
Wednesday, September 19, 2012 2:28 PM
You could store the number to a variable. (or an array(this may be more easy))
Than you start a "If ... Then" commando and control if this number is already used. If yes, restart the getting number part with your subroutine.
And if the number is ok, show it on the display, and do whatever you want with it. :)
I hope this is helpful.
Ask, if you don't understand anything we all write/wrote here.
Greetings
Timo
Ich bin Neu
- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Saturday, October 06, 2012 1:31 AM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Thursday, October 18, 2012 2:58 AM

