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.
Hey, Tako. If you would like me to I could make an in-depth description as well as instructions for each of the methods in In.cs and Out.cs
Wait... We are supposed to comment and maintain code?
Also Tako, If you want too you can leave a link to my old bot ideas thread in the "What should I made" section.
Last edited by Cyral (Jun 13 2013 12:56:00 pm)
Player Since 2011. I used to make bots and stuff.
Offline
Tako, if you want some source codes for AG login system to implement into Skylight, Capasha made this sample / tutorial:
http://pastebin.com/QDzmb3qM
I'll be willing to test it out if implemented.
This actually looks really good, even though as simple as it seems, being the programming nub that I am, I probably won't be able to understand it
thx for sig bobithan
Offline
This actually looks really good, even though as simple as it seems, being the programming nub that I am, I probably won't be able to understand it
See my previous post if you're interested in learning C#.
If you want to have any type of involvement with programming and developing bots or applications, then a language is necessary. Most of it seems completely alien at first, but naturally once you start using it and looking at examples and learning the lingo, you become as versed in it as you are English.
However, if you want to attempt to make a very simple bot just to see how you like it, check out the second-to-last code block on the guide after reading up on some basic C# principals such as "if statements", "object declaration", and "method calls".
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Oh, I just forgot to link the ArmorGames login guide: http://dl.dropbox.com/u/25388939/EEA%20 … ation.html
(As it's supported now )
The tutorial will need updated because this line:
static Bot MyBot = new Bot("hiddenEmail", "hiddenPassword", MyRoom);
is supposed to be this:
static Bot MyBot = new Bot(MyRoom, "hiddenEmail", "hiddenPassword");
Kentiya / Atikyne — EE & EEU lead artist 2018-2020
Offline
The tutorial will need updated because this line:
static Bot MyBot = new Bot("hiddenEmail", "hiddenPassword", MyRoom);
is supposed to be this:
static Bot MyBot = new Bot(MyRoom, "hiddenEmail", "hiddenPassword");
Ah, yes, thank you for reminding me.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
I do know the simple stuff about C# like if statements and switch statements but not much more than that.
I'll read up on the other stuff you mentioned, thanks.
thx for sig bobithan
Offline
I do know the simple stuff about C# like if statements and switch statements but not much more than that.
I'll read up on the other stuff you mentioned, thanks.
Honestly, you can make a ton of things using very few C# elements.
That's what's great about programming... once you learn something, you don't stop using it. Everything that you learn is added to your inventory of knowledge, and eventually you end up with this nice array of things to choose from, just like buying clothes or whatever.
After like a day or two of learning C# you can accomplish myriad of tasks. I know this from experience and also from watching other people learn C#.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
How do I do an ArmorGames login, since it was added but not explained...?
How do I do an ArmorGames login, since it was added but not explained...?
You will have to ask Jojatekok (or ArmorGames support) how to get tokens. I am unfamiliar with it.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Already PM'ed him. Thanks.
Here are some mini-guides on how to do specific things:
Create a chat command
General idea: You're the only one who can command your bot. If you want to extend the control to other people, that is best accomplished through the in-game chat system. Here is how you create a chat-command with or without parameters:
public static void ChatHandler(ChatEventArgs e) { string line = e.Message.ToLower(); string[] args = line.Split(' '); // Example 1: a command that has no arguments. if (args[0] == "!ping") { MyBot.Push.Say("Pong!"); } // Example 2: a command with one argument, // Verify that there is indeed an extra argument. if (args[0] == "!kick" && args.Length == 2) { Player p = Tools.GetPlayerByName(args[1]); if (p != null) { MyBot.Push.Kick(p); Console.WriteLine("Kicked {0}.", p.Name); } else { MyBot.Push.Say("Cannot find " + args[1] + "."); } } // Example 3: a command with a special argument. // Since the args are in string form, you need to use Convert.ToInt32. // If Convert.ToInt32 cannot convert it (i.e., if someone puts in a non-number where there should be one), // the program will stop. Here is how you can prevent that: // Verify that there are enough arguments. if (args[0] == "!ban" && args.Length == 3) { Player p = Tools.GetPlayerByName(args[1]); if (p != null) { try { int duration = Convert.ToInt32(args[2]); // This method needs to be added yourself. Ban(p, duration); MyBot.Push.Say("Successfully banned " + p.Name + "."); } catch (FormatException) { MyBot.Push.Say("Did not recognize duration - try using a number."); } } else { MyBot.Push.Say("Cannot find " + args[1] + "."); } } }
Usage:
!ping
!kick takoman02
!ban takoman02 10
Move a block
General idea: delete the block, and place a new block one block in the direction you pick.
public enum Direction { UP, DOWN, LEFT, RIGHT } public static void MoveBlock(Block b, Direction d) { // Leave an empty space where the old block was. Block oldBlock = new Block(0, b.X, b.Y); int newX = b.X, newY = b.Y; switch (d) { case Direction.UP: newY--; break; case Direction.DOWN: newY++; break; case Direction.LEFT: newX--; break; case Direction.RIGHT: newX++; break; } Block newBlock = new Block(b.Id, newX, newY); <BOT>.Push.Build(oldBlock); <BOT>.Push.Build(newBlock); }
Usage:
Block testBlock = new Block(BlockIds.Blocks.Basic.DARKGRAY, 10, 10); MoveBlock(testBlock, Direction.DOWN);
Create an invisible portal that only works for certain people*
General idea: If the player jumps into the "portal" (which is just an non-solid block in-game), and they fit a certain criteria, then they are teleported. No need for actual portals, much more flexible.
public static void JumpEventHandler(PlayerEventArgs e) { // If they jump from below the portal... if (e.Subject.X == <PORTAL_X> && e.Subject.Y > <PORTAL_Y>) { // ...and they fit whatever criteria... (this is just an example) if (e.Subject.CollectedMagic > 0) { // ...teleport them to the exit... <BOT>.Push.Teleport(<DESTINATION_X>, <DESTINATION_Y>, e.Subject); } } }
Usage:
Where the jail-window-background-thing is the "portal". It doesn't need to have a background, but it's probably best that it does so players know what it is.
*Disclaimer: The player shouldn't be able to hold a key from far away and access it that way. In other words, it should be in closed-off areas.
Automatically save the level
General idea: Sometimes you just forget to save and end up losing lots of work. Add this simple bit of code to automatically save after certain intervals.
// using statements... using System.Threading; class MyClass { // Use a thread so it runs in the background. public static Thread AutoSaveThread = new Thread(AutoSave); // Should it be auto-saving? public static bool ShouldBeAutoSaving = true; // Should it say "Saved." every time it saves? public static bool AnnounceAutosaves = false; // How long should it wait before it saves again? One minute? Ten minutes? One hour? public static int MinutesAutoSaveDelays = 5; public static void AutoSave() { while (ShouldBeAutoSaving) { Thread.Sleep(MinutesAutoSaveDelays * 60000); MyBot.Push.Save(); if (AnnounceAutosaves) { MyBot.Push.Say("Saved."); } } } }
Usage:
public static void Main(string[] args) { // do things // Begin auto-saving immediately. AutoSaveThread.Start(); }
-----
More to come (when I think of some things that people would like to do).
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
<L33T codez and stoof>
Nice ideas
Player Since 2011. I used to make bots and stuff.
Offline
I randomly decided to make my first bot today, which was pretty successful. Got the connection working, and some console commands.
I'm trying to do chat commands now, but no idea how to. I used your ping-pong example but it didn't work. I don't really understand what arguments are or any of that stuff. If I understood what I was writing, maybe I would be able to figure it out.
Help?
EDIT: Confused about a few stuff with blocks as well, I really suck at this.
Last edited by skullz16 (Jul 13 2013 11:56:10 am)
thx for sig bobithan
Offline
yaH rly cool takO i lik it thanx );;0))
You can create a block just by typing:
Block b = new Block(id, x, y);
But if that's a declaration I'm confused as to how you would use it for something like a chat command making a block appear somewhere.
thx for sig bobithan
Offline
I randomly decided to make my first bot today, which was pretty successful. Got the connection working, and some console commands.
I'm trying to do chat commands now, but no idea how to. I used your ping-pong example but it didn't work. I don't really understand what arguments are or any of that stuff. If I understood what I was writing, maybe I would be able to figure it out.
Help?
EDIT: Confused about a few stuff with blocks as well, I really suck at this.
Well I really haven't used this API much, so I'm not sure the exact functions but here is something to help you out.
Arguments are usually the chat message split by spaces and put into an array, for example:
/somecommand derp lol
Will return for the args[]
args[0] = /somecommand args[1] = derp args[2] = lol
For placing blocks on a command (like /placeblock type x y), you could do something like
if (Message.Args[0] == "/placeblock")
{
Block b = new Block(args[1], args[2], args[3]);
}
Thats just my 2 cents, I'm sure Tako could help you if you post your code to pastbin (or what I suggest, stypi for collaborating)
Last edited by Cyral (Jul 14 2013 12:46:43 pm)
Player Since 2011. I used to make bots and stuff.
Offline
I understand how the chat commands work now, but looking at my code, it seems it should work for me but it isn't.
And for the block placing, args has to be declared as string for the "!placeblock" part but for the x and the y values it has to be declared as int. This doesn't really make sense to me.
EDIT: Oops, never mind about the block placing thing, I forgot about the simple int.Parse
EDIT 2: I just made a !placeblock command, and have realised that none of the chat commands that I am creating are working, however they both look perfectly fine.
Last edited by skullz16 (Jul 16 2013 11:55:49 am)
thx for sig bobithan
Offline
I understand how the chat commands work now, but looking at my code, it seems it should work for me but it isn't.
And for the block placing, args has to be declared as string for the "!placeblock" part but for the x and the y values it has to be declared as int. This doesn't really make sense to me.
EDIT: Oops, never mind about the block placing thing, I forgot about the simple int.Parse
EDIT 2: I just made a !placeblock command, and have realised that none of the chat commands that I am creating are working, however they both look perfectly fine.
Go ahead and PM me your code and I'll see if there are any problems (don't forget to snip the password and email).
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
I'm currently running .NET Framework 4.0, and I have tried multiple times to download .NET Framework 4.5 so I can use this SDK. Any ideas? I've tried completely redoing the Framework too.
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
I'm currently running .NET Framework 4.0, and I have tried multiple times to download .NET Framework 4.5 so I can use this SDK. Any ideas? I've tried completely redoing the Framework too.
Hm... it should be using 4.0 already.
https://github.com/Seist/Skylight/blob/ … csproj#L12
I would recommend reinstalling the SDK.
I don't know when the last time the puush download link was updated. You could have downloaded it before I downgraded from 4.5 to 4.0, which would create a problem.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
So I'm beginning to understand.
I'm making a forms application
If I'm getting my bot to connect, I do:
private void ConnectButton_Click(object sender, EventArgs e) { Room MyRoom = new Room(WorldIdBox.Text); Bot MyBot = new Bot(MyRoom, EmailBox.Text, PasswordBox.Text); MyBot.LogIn(); MyBot.Join();
When I look on EE, the bot has joined just fine. Next I have:
MyBot.Push.Say("Joined successfully!");
But it sends me an error message saying:
"Object reference not set to an instance of the object."
Help?
So I'm beginning to understand.
I'm making a forms application
If I'm getting my bot to connect, I do:private void ConnectButton_Click(object sender, EventArgs e) { Room MyRoom = new Room(WorldIdBox.Text); Bot MyBot = new Bot(MyRoom, EmailBox.Text, PasswordBox.Text); MyBot.LogIn(); MyBot.Join();
When I look on EE, the bot has joined just fine. Next I have:
MyBot.Push.Say("Joined successfully!");
But it sends me an error message saying:
"Object reference not set to an instance of the object."Help?
How up-to-date is the SDK? I fixed the problem you seem to be getting on June 24th.
If updating does not fix the problem, I will need to see the entire code because I can't recreate the error.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
[ Started around 1732213695.6809 - Generated in 0.456 seconds, 10 queries executed - Memory usage: 1.83 MiB (Peak: 2.11 MiB) ]