this is going on the fact that you have seen my other how-to's on IRC bots or you have a point system and an commands list
if you see (times sighn) htat means a star sighn the markup text options have that simble a bold and yes i did soround the bold with stars
the game will be simple and external
the game is slots a commen casino game
code in the external file:
using System;
namespace openircbot
{
public class slots
{
int a=0;
int b=0;
int c=0;
public int play(){
Random rnd = new Random ();
a = rnd.Next (9);
b = rnd.Next (9);
c = rnd.Next (9);
if (a == b && a == c) {
int x = a (times sighn) 10;
return x;
} else if (a == b || b == c) {
int x = b (times sighn) 5;
return x;
} else if (a == c) {
int x = a (times sighn) 5;
return x;
} else
return 0;
}
public string ShowNumbers(){
string end = String.Format ("{0}:{1}:{2}",a,b,c);
return end;
}
}
}
code in the commands list:
if (command.StartsWith ("slots")) {
var link3 = new slots ();//the class its in a extern file
int win =link3.play (speaker);
string winnumbers = link3.ShowNumbers ();
if (win == 0) {
string end = String.Format ("{0}::bad luck", winnumbers);
SendMsg (end);
} else {
string end = String.Format ("{0}::you win {1}", winnumbers,win);
SendMsg (end);
}
removepoints (10, speaker);
addpoints (0, speaker);//the game costs 10 points
}
if you have looked at my other how-to's then you know have a bot that has commands games and a point system from now on you will have to make up the rest i hope you lernt something and you have fun.
Comments
No Comments Exist
Be the first, drop a comment!