Jump to content
UBot Underground

Recommended Posts

I've been meaning to create this thread for a long while, ubot API has enabled ubot to become a lot more advanced. 

 

I'm sure there's a few people out there who would like to get started with the api for the odd function that isn't supported that they need.

 

The purpose of this thread is for me and hopefully some of the others who have built plugins to help people get started with the api and maybe the odd group project.

 

couple of questions

 

  • Is the ubot api wiki page enough for people to get started or would you like a real world example in more detail?.

 

  • Has anyone tried with the api what did you find difficult

 

  • anything specific people would like to see

 

many thanks

kev

 

 

  • Like 1
Link to post
Share on other sites

This is a great idea. I almost got all the paid plugins released here. It's better if i can customize one for my needs.

Tutorials on making plugins for c# newbies would be great kev.

 

Agree +1

Link to post
Share on other sites

That would be great Kev.

 

The main part that would interest me:

How can I convert a regular C# app into an ubot plugin. What input variables do I need. How do I hand them over from ubot into the C# code.

And what return values are supported and how does that work.

 

So mainly a guide to convert a regular c# app (a small tool of course) into an Ubot plugin.

 

Thant would be really great

 

Dan

Link to post
Share on other sites

ok cool i'll start with a simple getting started and setup with a easy example and then a converting a real world app over. Dan have you got the source code in mind you would like converting over?

Link to post
Share on other sites

API is good overall - could not create "real world" advanced bots without it.

 

It has 3 major shortcomings (at least) that I have experienced:

 

1) It allows you to create custom "commands" that integrate into UBS - nice - but you are only allowed to pass strings and list as parameters.  Where is the most useful parameter type of a "selector"?  If you want to pass a selector to your command, all you can do is a string. What is missing is for your custom command in UBS to have the "selector" capability built into the UI of your custom command in UBS - you know, the little icons that let you select an element or fine tune that selection - that is not supported in your custom command.  Major oversight in my opinion.

 

2) Similarly, when working with a complex page, in C# there is no way to tap into the "selector" capability of UBS.  All you can do is grab the entire HTML of the page in C# and perform your own DOM processing on it.  Would be SO much easier to tap into the UBS selector capabilities.

 

3) Finally, you will get an annoying popup message regarding your "unregistered plugin" every time you run your bot - even if it is a "private" plugin you don't want distributed.  I think you have to send them your source code or pay $100 or something like that - I don't know for sure because when I inquire to UBS they are very vague about it.

Link to post
Share on other sites

1/2. browser interaction aren't part of the api as well as the UI. There is ways round this or so i'm led to believe but i haven't first hand experience doing so.

3. you need to get a plugin key to stop them messages.

  • for a open plugin that is shared for free on the forum -cost nothing
  • for a private plugin -cost nothing dependant on what it is for example if its something that's unique to you and not much use to anyone else it will more than likely be free.
  • Plugin people have to purchase - paid

This is of course at ubots discretion, your key request may be rejected if its going to be included in ubot at a later date or your intentions are not clear about what the plugin will do.

 

 

you can request a key here

 

 

http://support.ubotstudio.com/index.php?/

 

I will cover the setting the plugin key up in the project for the first tutorial.

Link to post
Share on other sites

Kev,

 

Another great idea and help to the community.  Any progress?

 

Regards,

William

hi sorry got a little side tracked if I get chance tomorrow i'll do the getting started tutorial one if not next week

Link to post
Share on other sites

1.0 Getting Started.

 

Is this first part i'm going to explain how to setup the basics for a plugin and the software required.

this will get everything ready for creating are first commands and functions in the next tutorial.

Everything i'm going to explain is already on the wiki for this first tutorial but i'll run through them anyway.

 

 

getting a plugin key

 

as mentioned above you need to get a plugin key to be able to work with the api if you don't you will get the unreviewed message.

While you are learning ubots api there's no need to get a key, I would suggest getting one when you have something that works.

  • for a open plugin that is shared for free on the forum -cost nothing
  • for a private plugin -cost nothing dependant on what it is for example if its something that's unique to you and not much use to anyone else it will more than likely be free.
  • Plugin people have to purchase - paid

This is of course at ubots discretion, your key request may be rejected if its going to be included in ubot at a later date or your intentions are not clear about what the plugin will do.

 

contact support for a key http://support.ubotstudio.com/index.php?/

 

Reminder you don't need a key to learn the api only when you want a complete plugin without the unreviewed message.

 

Software required

 

download Visual C# 2010 express if you don't already have it from Microsoft.

 

http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express

 

download the api .dll file from ubot

http://www.ubotstudio.com/files/plugins/UBotPlugin.dll

 

 

Creating the base file

 

again the is covered in the wiki but so its easy to follow step by step i'll put the details here i'll add some helper comment.

 

  1. click file then new
  2. Choose the WPF Application template and name your project plugintemplate
  3. From the Solution Explorer delete App.xaml and MainWindow.xaml (the Solution Explorer is located on the far right) 
  4. From the Main Menu choose Project -> plugintemplate Properties
  5. In the Application Tab change the Output type to Class Library (this is so the file created is the correct type .dll) 
  6. From the Main Menu choose File -> Save All
  7. If desired, change the location where the project is saved. Make a note of the location as you will need it in a later step then click Save.
  8. From the Solution Explorer right click on the project and choose Add Reference.
  9. Select the UBotPlugin.dll downloaded in the first step and click OK (this is the file you downloaded from ubot)

 

now where going to add a class for the ubot plugin api key.

 

1. in the Solution Explorer in the right hand side right click on the project name plugintemplate

2.from the menu that pops up move to add and select new item select class

3.rename class1 to PluginInfo by right clicking on it and selecting rename.

4.click on the class (PluginInfo) the code should now be displayed delete everything.

5.replace with the below code

 

 

 

using System;

namespace plugintemplate

 

public class PluginInfo

{

public static string HashCode { get { return "Put your plugin key here"; } }

}

 

in the future when you get your plugin key it goes here.

 

6.save all

 

that's about it we have created the base file we need for plugins in the next tutorial we will create a basic plugin and i'll explain returning data to and from ubot.

 

Bonus but not required

should you want to create a template so that everytime you make a plugin you can select the pre created of the above.

1.click file, then export template

2.the wizard should open just keep clicking next until finish

3.the export in a zip folder should open close this

4.now when you click file ,new the template will be selectable

5.when you save the plugin you are creating change the name as required.

 

 

 

 

 

  • Like 4
Link to post
Share on other sites

Had 2 comments....

 

I don't think private plugin is free if you want it without unreviewed message. You can only get the key for free if you intend to share your plugin/code with others.

 

I would also suggest all interested to check the wiki page which you don't mention/link to (a lot of useful examples for learning there): http://wiki.ubotstudio.com/wiki/Plugin_Development

Link to post
Share on other sites

Had 2 comments....

 

I don't think private plugin is free if you want it without unreviewed message. You can only get the key for free if you intend to share your plugin/code with others.

 

I would also suggest all interested to check the wiki page which you don't mention/link to (a lot of useful examples for learning there): http://wiki.ubotstudio.com/wiki/Plugin_Development

I believe private depends on what it does for example should it have commands for your own say intranet system that's no use to anyone else and would be pointless sharing you may be eligible for a free plugin as stated in my comments.

 

Thanks for linking to the wiki I reference it above but don't link. I'm trying to refrain from saying follow xyz on the wiki because speaking to a few people they would prefer things in small easy chunks and they have struggled with the wiki.

 

Once I have finished the main three or four tutorials it would be great if people like yourself who also have worked with the API could offer up any tips they may have learnt, again after I have completed the first four tutorial which will explain most of the major parts of the api and basic c# stuff people will need to know to get values back and forth from ubot such as converting to integers etc.

Link to post
Share on other sites

1.1 Creating a basic function.

assuming you have completed the first tutorial complete the below

 

In this tutorial i'm going to go over the basics to creating a ubot function for the demo i'm using a the read number of lines function from the advanced file plugin.

 

1.create a class (as detailed in the first tutorial if you cant remember)

2.rename it to Readpartfile (as detailed in the first tutorial if you cant remember)

3.delete the code in the class and add the below

 

 

using System;

using System.Collections.Generic;

using System.IO;

using System.Linq;

using UBotPlugin;

namespace advanced.file

{

public class FileLines : IUBotFunction

{

private List<UBotParameterDefinition> _parameters = new List<UBotParameterDefinition>();

private string _returnValue;

public string Category

{

get

{

return "Advanced File Function";

}

}

public string FunctionName

{

get

{

return "file Number of lines";

}

}

public bool IsContainer

{

get

{

return false;

}

}

public IEnumerable<UBotParameterDefinition> ParameterDefinitions

{

get

{

return this._parameters;

}

}

public object ReturnValue

{

get

{

return this._returnValue;

}

}

public UBotType ReturnValueType

{

get

{

return UBotType.String;

}

}

public UBotVersion UBotVersion

{

get

{

return UBotVersion.Standard;

}

}

public FileLines()

{

this._parameters.Add(new UBotParameterDefinition("Location", UBotType.String));

}

public void Execute(IUBotStudio ubotStudio, Dictionary<string, string> parameters)

{

string path = parameters["Location"];

int test = File.ReadLines(path).Count();

 

this._returnValue = test.ToString();

 

}

}

}

 

 

4.watch the tutorial video explaining the basics to how everything works. I don't go into a massive amount of detail but you should be able to edit the template above and create a basic function following the video also in the video I say a loop is a function opps sorry :) not trying to confuse things.

 

 

5. I briefly explain in the video where to get the plugin from once complied.

to go into more detail you need to select the project folder(where you saved the project), then select the bin folder and the compiled plugin will be in either debug or release folder depending on your settings in Microsoft visual c#.

 

I tried to not use much c# programming terminology to help the less experienced people so sorry to people with c# experience if some terms I used weren't what things would normally be called.

  • Like 1
Link to post
Share on other sites
 

I believe private depends on what it does for example should it have commands for your own say intranet system that's no use to anyone else and would be pointless sharing you may be eligible for a free plugin as stated in my comments.

As far as I know that's not true.

 

Here is a quote from an email that I got from Jason a while ago:

If you wish to create open source plugins that are free to everyone, you may have as many free plugin keys as you have ideas for open source plugins. If you wish to develop a plugin privately to give away or sell, you are allowed to do so, but you must pay for your use of the API. (This is a similar model to the one github follows.)

If you merely want to make a plugin for your own use, you may consider making it open source so that others may enjoy its benefits as well. If you need it to be private, you are free to build the plugin without a key and try to ignore the nag screen. If this is unacceptable, I apologize, but these are the terms we've chosen for distributing keys.

So I'm not sure where you are getting that information from. Above it is clearly stated that you need to pay for private plugin if you don't intend to share it with other users/making it open source and you want to get rid of that annoying "un-reviewed" popup.

 

 

Thanks for linking to the wiki I reference it above but don't link. I'm trying to refrain from saying follow xyz on the wiki because speaking to a few people they would prefer things in small easy chunks and they have struggled with the wiki.

 

Once I have finished the main three or four tutorials it would be great if people like yourself who also have worked with the API could offer up any tips they may have learnt, again after I have completed the first four tutorial which will explain most of the major parts of the api and basic c# stuff people will need to know to get values back and forth from ubot such as converting to integers etc.

 

If you talk about plugins I think that should be the first page you link to, in case anyone doesn't know about it yet, since examples there nicely demonstrate most of the features of the so called API (that's why I felt I should add it).

 

Else thumbs up for opening this thread. Sure, I can give my few cents, just didn't want to steal the topic for now. :) I hope that other plugin developers will also be willing to contribute here...

Link to post
Share on other sites

 

 
If you wish to create open source plugins that are free to everyone, you may have as many free plugin keys as you have ideas for open source plugins. If you wish to develop a plugin privately to give away or sell, you are allowed to do so, but you must pay for your use of the API. (This is a similar model to the one github follows.)

If you merely want to make a plugin for your own use, you may consider making it open source so that others may enjoy its benefits as well. If you need it to be private, you are free to build the plugin without a key and try to ignore the nag screen. If this is unacceptable, I apologize, but these are the terms we've chosen for distributing keys.

So I'm not sure where you are getting that information from. Above it is clearly stated that you need to pay for private plugin if you don't intend to share it with other users/making it open source.

 

 

 

ok maybe when I asked it was before policy's where introduced or my question wasn't clear to support it was a while ago.

 

Bonus tip from the tutorial above

Bit of a obvious one disable all other plugins to speed things up. You don't need to do this but if you going back and forth testing your plugin it will save having to load all the other plugins in ubot everytime you add you plugin.

Link to post
Share on other sites

As we (all) know, the most efficient way to create multiple but related software solutions is to create and maintain your own common "base classes" which you can share among your projects and the developers who work on them.

 

Also, as we all know, UBot does not provide such capability natively.  (if you think Private Bot Bank is the answer, you have not tried to scale it among multiple projects and developers).  UBot Plugin DLL capability is the best solution available for creating common, re-usable pieces of code you can leverage into your multiple projects.  Being able to use native .NET scripting (as opposed to the awkward UBot script) is definitely the way to go, too.

 

That being said, the fact that UBot wants to charge me to use this feature for my own private projects - never intended to be sold or of any use to others - is not only annoying, it is shortsighted.  This is a powerful enhancement to their product.  Without it, we would have abandoned UBot long ago.  But, this discouraging practice of UBot to "nag" you for implementing better programming techniques is silly.

 

We need to request UBot re-think this policy.

 

Regards to getting a key, how much does it cost anyway? 

 

When I inquired, the response was "we'll determine that after you show us what you are doing".  Well, 1) they should be able to tell me the price, and 2) I have no intention of sharing my DLL code (which I use privately) and have obligations with clients preventing sharing such.

 

I don't understand their position on this.  It makes one think that coding directly against the AWESOMIUM.DLL that UBS is based on is the way to go.

 

As I said, the ability to extent UBS with .NET coding is EXTREMELY powerful.  I don't know why they are trying to squash this instead of helping promote it.

  • Like 2
Link to post
Share on other sites

To follow up from my post above, I am following this topic, and when it progresses past the "basics" (which are really covered pretty straightforward on the Wiki), I will be happy to chime in with any tips or experiences that might help.

Link to post
Share on other sites
  • 1 year later...

It is a shame this thread died - Come on ALL plugin makers, we all know you guys are the bees-knees.... Share the wealth and give us some walk throughs! Or hell, offer coaching for a fee! A lot of us want to do this but it still buzzes over our heads.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...