Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
Topic closed
When I do !ssay start it starts up fine. Then when I try to stop it before It's finished I do !ssay stop and It just keeps on going. Thanks in advance.
case ".ssay":
case "!ssay":
case "#ssay":
{
if (admins.Contains(username))
{
if (arg.Length > 1)
if (arg[1] == "start")
{
carryOn = true;
for (int i = 5000 - 0; i >= 0; i -= 200)
{
int ssay = rnd.Next(1, 10);
switch (ssay)
{
case 1:
{
say("Soul says RED");
Thread.Sleep(i);
sred();
}
break;
case 2:
{
say("Slow says RED");
Thread.Sleep(i);
nred();
}
break;
case 3:
{
say("Soul says ORANGE");
Thread.Sleep(i);
sorange();
}
break;
case 4:
{
say("Slow says ORANGE");
Thread.Sleep(i);
norange();
}
break;
case 5:
{
say("Soul says YELLOW");
Thread.Sleep(i);
syellow();
}
break;
case 6:
{
say("Slow says YELLOW");
Thread.Sleep(i);
nyellow();
}
break;
case 7:
{
say("Soul says GREEN");
Thread.Sleep(i);
sgreen();
}
break;
case 8:
{
say("Slow says GREEN");
Thread.Sleep(i);
ngreen();
}
break;
case 9:
{
say("Soul says BLUE");
Thread.Sleep(i);
sblue();
}
break;
case 10:
{
say("Slow says BLUE");
Thread.Sleep(i);
nblue();
}
break;
}
if (carryOn == false)
{
break;
}
}
}
else if (arg[1] == "stop")
{
pm(username, "Stopping bot");
carryOn = false;
say(username + " has stopped the bot");
}
else
{
pm(username, "Only use start and stop please.");
}
}
else
{
pm(username, "You do not have permission to use this command");
}
}
break;
Offline
The problem is your starting a new instance of the for loop when you say "!ssay stop". It doesn't apply to the loop you already created with "!ssay".
At least that's what I got from it, I only briefly skimmed the code.
Do you have TeamViewer? Add me, my username is BuzzerBee.
EDIT: Nevermind, it was a lack of threading. I fixed it for him on TeamViewer.
Don't forget to thread your Thread.Sleeps! Or better yet, use await Task.Delay
Offline
Thank you BuzzerBee. Problem Fixed. Requesting thread lock.
Offline
Pages: 1
Topic closed
[ Started around 1734829791.6955 - Generated in 0.074 seconds, 13 queries executed - Memory usage: 1.4 MiB (Peak: 1.51 MiB) ]