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
http://capasha.com/eeinformation.php is a very useful website because it has a list for many of everybody edits stuff.
im not very good with all the correct code using ee info so
# team - UserID joins a team
[0] <Integer> UserID
[1] <Integer> Color, Sheet-List: Disabled = 0, Red = 1, Blue = 2, Green = 3, Cyan = 4, Magenta = 5, Yellow = 6
how would you go about using this for a "if a user becomes a team color do {what ever code i want}"
it may be something like
if (m.Type == "team ")
{
if (m.GetString(1) = 5)
say("hello");
}
or maybe its nothing like that at all.
color = #1E1E1E
Offline
http://capasha.com/eeinformation.php is a very useful website because it has a list for many of everybody edits stuff.
im not very good with all the correct code using ee info so
# team - UserID joins a team [0] <Integer> UserID [1] <Integer> Color, Sheet-List: Disabled = 0, Red = 1, Blue = 2, Green = 3, Cyan = 4, Magenta = 5, Yellow = 6
how would you go about using this for a "if a user becomes a team color do {what ever code i want}"
it may be something like
if (m.Type == "team ") { if (m.GetString(1) = 5) say("hello"); }
or maybe its nothing like that at all.
# Means what m.Type or case "": is
[0] means the number that goes inside the "()"
<Integer> means the type the "m.Get" is
You have m.GetString(1) which is wrong as in the website, it's stated as an Integer.
There's also a space after 'team' which shouldn't be there; Here's a sample of what it should look like:
if(m.Type == "team")
{
if (m.GetInt(1) == 5)
{
conn.Send("say", "hello");
}
}
thanks zoey aaaaaaaaaaaand thanks latif for the avatar
Offline
Most coders that know what they're doing use a switch statement rather than lots of ifs to check for different message types:
http://www.dotnetperls.com/string-switch
Like so:
switch (m.Type)
{
case "team":
if (m.GetInt(1) == 5) //If you use m.GetString() to retrieve an integer, it'll crash.
{
//Something
}
break;
}
And "//Something" will run every time someone joins the magenta team.
One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.
Offline
Most coders that know what they're doing use a switch statement rather than lots of ifs to check for different message types:
http://www.dotnetperls.com/string-switchLike so:
switch (m.Type) { case "team": if (m.GetInt(1) == 5) //If you use m.GetString() to retrieve an integer, it'll crash. { //Something } break; }
And "//Something" will run every time someone joins the magenta team.
Please don't make any assumptions.
Everybody has their own style of coding.
I personally prefer if-statements because I can collapse those (without using ugly block comments).
Offline
I personally prefer if-statements because I can collapse those (without using ugly block comments).
Here's a tip:
#region Collapsible Region which can be given any name
Code
Code
Code
Code
Code
#endregion
A switch beats if/else if you're using more than 5 message types.
One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.
Offline
thanks everyone. i got it.
if (m.Type == "team")
{
switch (m.GetInt(1))
{
case 1:
con.Send("say", "Fire");
break;
case 2:
con.Send("say", "Water");
break;
case 3:
con.Send("say", "Grass");
break;
case 5:
con.Send("say", "Dark");
break;
case 6:
con.Send("say", "Light");
break;
}
}
color = #1E1E1E
Offline
den3107 wrote:I personally prefer if-statements because I can collapse those (without using ugly block comments).
Here's a tip:
#region Collapsible Region which can be given any name Code Code Code Code Code #endregion
A switch beats if/else if you're using more than 5 message types.
that's what I meant with ugly block quotes
I hate useless comments, even though it's only when it's unfolded.
But yes (mostly with strings) a switch is way faster when you have a decent amount of cases, but this isn't really an argument on the program size you work here.
Pretty much no bot really needs such kinds of optimizations since it's practically impossible to make such a big bot (maybe if you'd make a REAL full-scale RPG where EVERYBODY could play simultaneously and the bot is to monitor multiple rooms).
Offline
that's what I meant with ugly block quotes
I hate collapsing if-statements by themselves, just looks weird.
thanks zoey aaaaaaaaaaaand thanks latif for the avatar
Offline
Pages: 1
[ Started around 1732445223.5724 - Generated in 0.081 seconds, 12 queries executed - Memory usage: 1.55 MiB (Peak: 1.73 MiB) ]