Random Integer Error? I think?

Posts 1–10 of 10 · Page 1 of 1
Random Integer Error? I think?
First of all, my gf has a wierd obsession with cones. don't ask.
My "Epilepsy" button isn't working right, and I was hoping someone here could tell me what is wrong with it.

Screen Shot:


Virus Scan!

Code:
Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim afd As Integer
        Form2.Show()
        EpiOff.Hide()
        afd = 1
    End Sub

    Private Sub CC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CC.Click
        Dim rgb1, rgb2, rgb3 As Integer
        If TextBox1.Text = "" Then
            TextBox1.Text = "0"
        End If
        If TextBox2.Text = "" Then
            TextBox2.Text = "0"
        End If
        If TextBox3.Text = "" Then
            TextBox3.Text = "0"
        End If

        rgb1 = TextBox1.Text
        rgb2 = TextBox2.Text
        rgb3 = TextBox3.Text

        If rgb1 > 255 Or rgb1 < 0 Then
            rgb1 = 255
            TextBox1.Text = rgb1
        End If
        If rgb2 > 255 Or rgb2 < 0 Then
            rgb2 = 255
            TextBox2.Text = rgb2
        End If
        If rgb3 > 255 Or rgb3 < 0 Then
            rgb3 = 255
            TextBox3.Text = rgb3
        End If

        Form2.BackColor = Color.FromArgb(rgb1, rgb2, rgb3)
    End Sub

    Private Sub CL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CL.Click
        Dim xloc, yloc As Integer
        If TextBox4.Text = "" Then
            TextBox4.Text = "0"
        End If
        If TextBox5.Text = "" Then
            TextBox5.Text = "0"
        End If

        xloc = TextBox4.Text
        yloc = TextBox5.Text

        If xloc < 0 Then
            xloc = 0
            TextBox4.Text = xloc
        End If
        If yloc < 0 Then
            yloc = 0
            TextBox5.Text = yloc
        End If

        Form2.Location = New Point(xloc, yloc)
    End Sub

    Private Sub CS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CS.Click
        Dim xsize, ysize As Integer
        If TextBox6.Text = "" Then
            TextBox6.Text = "0"
        End If
        If TextBox7.Text = "" Then
            TextBox7.Text = "0"
        End If

        xsize = TextBox6.Text
        ysize = TextBox7.Text

        If xsize < 0 Then
            xsize = 0
            TextBox6.Text = xsize
        End If
        If ysize < 0 Then
            ysize = 0
            TextBox7.Text = ysize
        End If

        Form2.Size = New Size(xsize, ysize)
    End Sub

    Private Sub rand_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rand.Click
        Dim rgb1, rgb2, rgb3 As Integer
        Randomize()
        rgb1 = Int(Rnd() * 1000)
        While rgb1 > 255
            rgb1 = Int(Rnd() * 1000)
        End While
        TextBox1.Text = rgb1

        rgb2 = Int(Rnd() * 1000)
        While rgb2 > 255
            rgb2 = Int(Rnd() * 1000)
        End While
        TextBox2.Text = rgb2

        rgb3 = Int(Rnd() * 1000)
        While rgb3 > 255
            rgb3 = Int(Rnd() * 1000)
        End While
        TextBox3.Text = rgb3

        Form2.BackColor = Color.FromArgb(rgb1, rgb2, rgb3)
    End Sub

    Public Sub Epi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Epi.Click
        Dim afd, rgb1, rgb2, rgb3 As Integer
        afd = 0
        Epi.Hide()
        EpiOff.Show()
        While afd = 0
            Randomize()
            rgb1 = Int(Rnd() * 1000)
            While rgb1 > 255
                rgb1 = Int(Rnd() * 1000)
            End While
            TextBox1.Text = rgb1

            rgb2 = Int(Rnd() * 1000)
            While rgb2 > 255
                rgb2 = Int(Rnd() * 1000)
            End While
            TextBox2.Text = rgb2

            rgb3 = Int(Rnd() * 1000)
            While rgb3 > 255
                rgb3 = Int(Rnd() * 1000)
            End While
            TextBox3.Text = rgb3

            Form2.BackColor = Color.FromArgb(rgb1, rgb2, rgb3)
        End While
    End Sub

    Public Sub EpiOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EpiOff.Click
        Dim afd As Integer
        afd = 1
        EpiOff.Hide()
        Epi.Show()
    End Sub
End Class
And the Program:
Cones.zipattachment deleted · 6 downloads before removal
Quote Originally Posted by gwentravolta View Post
First of all, my gf has a wierd obsession with cones. don't ask.
My "Epilepsy" button isn't working right, and I was hoping someone here could tell me what is wrong with it.

Screen Shot:


Virus Scan!

Code:
Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim afd As Integer
        Form2.Show()
        EpiOff.Hide()
        afd = 1
    End Sub

    Private Sub CC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CC.Click
        Dim rgb1, rgb2, rgb3 As Integer
        If TextBox1.Text = "" Then
            TextBox1.Text = "0"
        End If
        If TextBox2.Text = "" Then
            TextBox2.Text = "0"
        End If
        If TextBox3.Text = "" Then
            TextBox3.Text = "0"
        End If

        rgb1 = TextBox1.Text
        rgb2 = TextBox2.Text
        rgb3 = TextBox3.Text

        If rgb1 > 255 Or rgb1 < 0 Then
            rgb1 = 255
            TextBox1.Text = rgb1
        End If
        If rgb2 > 255 Or rgb2 < 0 Then
            rgb2 = 255
            TextBox2.Text = rgb2
        End If
        If rgb3 > 255 Or rgb3 < 0 Then
            rgb3 = 255
            TextBox3.Text = rgb3
        End If

        Form2.BackColor = Color.FromArgb(rgb1, rgb2, rgb3)
    End Sub

    Private Sub CL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CL.Click
        Dim xloc, yloc As Integer
        If TextBox4.Text = "" Then
            TextBox4.Text = "0"
        End If
        If TextBox5.Text = "" Then
            TextBox5.Text = "0"
        End If

        xloc = TextBox4.Text
        yloc = TextBox5.Text

        If xloc < 0 Then
            xloc = 0
            TextBox4.Text = xloc
        End If
        If yloc < 0 Then
            yloc = 0
            TextBox5.Text = yloc
        End If

        Form2.Location = New Point(xloc, yloc)
    End Sub

    Private Sub CS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CS.Click
        Dim xsize, ysize As Integer
        If TextBox6.Text = "" Then
            TextBox6.Text = "0"
        End If
        If TextBox7.Text = "" Then
            TextBox7.Text = "0"
        End If

        xsize = TextBox6.Text
        ysize = TextBox7.Text

        If xsize < 0 Then
            xsize = 0
            TextBox6.Text = xsize
        End If
        If ysize < 0 Then
            ysize = 0
            TextBox7.Text = ysize
        End If

        Form2.Size = New Size(xsize, ysize)
    End Sub

    Private Sub rand_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rand.Click
        Dim rgb1, rgb2, rgb3 As Integer
        Randomize()
        rgb1 = Int(Rnd() * 1000)
        While rgb1 > 255
            rgb1 = Int(Rnd() * 1000)
        End While
        TextBox1.Text = rgb1

        rgb2 = Int(Rnd() * 1000)
        While rgb2 > 255
            rgb2 = Int(Rnd() * 1000)
        End While
        TextBox2.Text = rgb2

        rgb3 = Int(Rnd() * 1000)
        While rgb3 > 255
            rgb3 = Int(Rnd() * 1000)
        End While
        TextBox3.Text = rgb3

        Form2.BackColor = Color.FromArgb(rgb1, rgb2, rgb3)
    End Sub

    Public Sub Epi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Epi.Click
        Dim afd, rgb1, rgb2, rgb3 As Integer
        afd = 0
        Epi.Hide()
        EpiOff.Show()
        While afd = 0
            Randomize()
            rgb1 = Int(Rnd() * 1000)
            While rgb1 > 255
                rgb1 = Int(Rnd() * 1000)
            End While
            TextBox1.Text = rgb1

            rgb2 = Int(Rnd() * 1000)
            While rgb2 > 255
                rgb2 = Int(Rnd() * 1000)
            End While
            TextBox2.Text = rgb2

            rgb3 = Int(Rnd() * 1000)
            While rgb3 > 255
                rgb3 = Int(Rnd() * 1000)
            End While
            TextBox3.Text = rgb3

            Form2.BackColor = Color.FromArgb(rgb1, rgb2, rgb3)
        End While
    End Sub

    Public Sub EpiOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EpiOff.Click
        Dim afd As Integer
        afd = 1
        EpiOff.Hide()
        Epi.Show()
    End Sub
End Class
And the Program:
Um idk about ur code but that fucking cone looks weird
I'm not sure if this is it, but,

Epi.Hide()
EpiOff.Show()

If those are two different things, I believe you can't have something that builds off of something else's name

Like Epi and EpiOff.

So, I suggest changing it to EpiOn and EpiOff

I'm not sure if that will change anything, and I might be completely wrong, but it's worth a try.

If I see anything else, I'll post back.
Quote Originally Posted by That0n3Guy View Post
I'm not sure if this is it, but,

Epi.Hide()
EpiOff.Show()

If those are two different things, I believe you can't have something that builds off of something else's name

Like Epi and EpiOff.

So, I suggest changing it to EpiOn and EpiOff

I'm not sure if that will change anything, and I might be completely wrong, but it's worth a try.

If I see anything else, I'll post back.
Ill try that. Is it possible that it is freezing up the CPU because it cycles through the number generation over and over? Is there a way to "pause" an action for a quarter second?

Edit: Changing the names doesn't fix it. So 1)The Load and Epi_click are conflicting with each other or 2) The While cycle is freezing my computer. Again... a pause should do the trick
Quote Originally Posted by gwentravolta View Post
Ill try that. Is it possible that it is freezing up the CPU because it cycles through the number generation over and over? Is there a way to "pause" an action for a quarter second?

Edit: Changing the names doesn't fix it. So 1)The Load and Epi_click are conflicting with each other or 2) The While cycle is freezing my computer. Again... a pause should do the trick
I have just the thing,
one moment.

Put this in the form you need it in:

Code:
Sub Wait(seconds As Long)
    Dim start As Long
    start = GetTickCount() + (seconds * 1000)
    
    Do While start > GetTickCount()
        DoEvents
    Loop
End Sub
Make sure you put this at the top of the form:

Code:
Option Explicit

Private Declare Function GetTickCount Lib "kernel32" () As Long
And to use that just send this code in a button or whatever.

Code:
Wait (How Many Seconds)
This won't actually stop it, just pause it for a set number of seconds.
Thanks. But i think i figured something else out... I'm telling it to do it when there is a click, but a click lasts a second, while the stuff its told to do continues? so i should tell it to do a defined function for a click, not the actual function. get it?
I would personally contain them in separate modules, makes the code a lot cleaner.
Quote Originally Posted by That0n3Guy View Post
I would personally contain them in separate modules, makes the code a lot cleaner.
Uhm, im a choob. Ill stick to what i can do. which is the basics. The VERY BASICS. That and making phishers.
lol wow a cone
wdf. that cone is weird. And why the fk woud u want a cone program ? XD
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us