slowpython
Member
Hello Everyone,
I have been looking through the forums and I notice a lot of people want a tutorial on how to use ISXEVE in .net. I have also been looking for examples and a good tutorial to use, but atlas I haven't been able to find one. So after some toying around I am going to write a quick tutorial on how to get your apps started.
First to note is that you should have the latest Innerspace (build 5513 or greater) as it allows for the use of .net framework 4.0
As well this tutorial is written in C#.
Let's start
------------------------------------------------------------
Setting up the Project
Step 1. Create a new project (windows form application, or whatever your heart desires to make).
Step 2. Right click on the project and add the following references:
(The following are found in the root of the InnerSpace Directory)
Lavish.InnerSpace.dll
Lavish.LavishNav.dll
(The Following is found in InnerSpace/.Net Programs)
ISXEVEWrapper.dll
These will allow you to use the isxeve and innerspace libraries.
For a good reference keep: http://eve.isxgames.com/wiki/index.php?title=Main_Page open as a lot of the members/methods are named the same thing as in the wiki.
Step 3. Right click the project and click properties and go to the "Build" tab.
Under the output heading where it says "Output Path:". Click the browse button and browse to the "InnerSpace/.Net Programs/" directory.
*This sets the compiler to build the program in that folder so you can build it and run it from the eve client without having to copy anything.*
That's it for setting up the program stuff, we can now do some programming!
--------------------------------------------------------------------------------
I will walk you through a very simple program that gets the names of all the pilots in local and displays it on a list. (Consider this the hello eve application)...
First thinks first, make a form with a listbox (name it with a good name) and a button.
For the sake of this application the listbox will be named PilotList and the button will be named Button1
After doing that and go double click the button (this should bring you to the code designer with a onclick event for the button)...
You should now have some that looks like the following:
Now we also want to be able to use the lavishscript / ISXEVE namespaces in our project.
At the top of the file, directly under:
Add the following:
(my one problem with the ISXEVE wrapper is that "EVE" is used as a namespace and as a object... Seems to confuse intellisense every now and then)
Ultimately we would like our program to obtain a list of pilot names when the user clicks the button on the form. So in our button_Click event method
we are going to want to do the calculations.
Before going on and showing you the code, I would like to direct you to the following website: http://www.lavishsoft.com/wiki/index.php/NET:Concepts:Frame_Locking#OnFrame_LavishScript_event
This is the most important concept to getting your .Net application to be used inside of eve.
So what is the FrameLock?
It's essentially a method to allow our thread (form/program/whatever) to read the object data from the eve client. What it does, is stops the client from advancing the frame and overwriting the object we may be wanting to use. Thus allowing us to get consistent data for that particular frame in the game loop.
Anyway, I am fairly poor at explaining these things. So I would recommend taking a read through it to get a better understanding of what it does.
So, how do we use this in our applications?
Well let's jump back to our button click method. And do the following:
Breaking this down, we declare a new FrameLock
for a section of code (again this locks the frame so we can obtain some data).
If you want to update any of the eve members, you must framelock first!
Next we create an EVE.ISXEVE.EVE object (I wrote this the long way because intellisense thought it would look better). This is basically the EVE object on the wiki, thus we are able to use all the same methods and members listed on the wiki. The one we are looking for is "GetLocalPilots", which will get a list of pilots in the current system.
Now we only want the names, so we make a list of strings that will represent the names of the each pilot.
Now we get to the loop:
What this does, is gets every Pilot (Pilot is a built-in ISXEVE datatype) from the list that is returned from GetLocalPilots. And even though this takes a parameter, it's not needed (I can only assume the parameter is for filtering).
From there we fill the list of strings that we declared earlier with the pilots name (p.Name member).
The last part is the assign the datasource for our listbox. This essentially gives the listbox it's display data, and it takes a IEnumerable, how convenient
Alright that's it!!!
you should have code that looks like the following:
You should be able to build this and run it in eve by using the DotNet command ("DotNet HelloEve").
Your form should now be launched from eve (make sure you are running in window mode!). Click the button and see the list populate with the names of all the pilots in local.
I hope some of you find this useful, I am sorry if I did not explain things very well...
This is my first tutorial, so don't be too harsh.
I will be happy to write more if people request use of different features, or post code to get people on their way.
Happy Flying!
I have been looking through the forums and I notice a lot of people want a tutorial on how to use ISXEVE in .net. I have also been looking for examples and a good tutorial to use, but atlas I haven't been able to find one. So after some toying around I am going to write a quick tutorial on how to get your apps started.
First to note is that you should have the latest Innerspace (build 5513 or greater) as it allows for the use of .net framework 4.0
As well this tutorial is written in C#.
Let's start
------------------------------------------------------------
Setting up the Project
Step 1. Create a new project (windows form application, or whatever your heart desires to make).
Step 2. Right click on the project and add the following references:
(The following are found in the root of the InnerSpace Directory)
Lavish.InnerSpace.dll
Lavish.LavishNav.dll
(The Following is found in InnerSpace/.Net Programs)
ISXEVEWrapper.dll
These will allow you to use the isxeve and innerspace libraries.
For a good reference keep: http://eve.isxgames.com/wiki/index.php?title=Main_Page open as a lot of the members/methods are named the same thing as in the wiki.
Step 3. Right click the project and click properties and go to the "Build" tab.
Under the output heading where it says "Output Path:". Click the browse button and browse to the "InnerSpace/.Net Programs/" directory.
*This sets the compiler to build the program in that folder so you can build it and run it from the eve client without having to copy anything.*
That's it for setting up the program stuff, we can now do some programming!
--------------------------------------------------------------------------------
I will walk you through a very simple program that gets the names of all the pilots in local and displays it on a list. (Consider this the hello eve application)...
First thinks first, make a form with a listbox (name it with a good name) and a button.
For the sake of this application the listbox will be named PilotList and the button will be named Button1
After doing that and go double click the button (this should bring you to the code designer with a onclick event for the button)...
You should now have some that looks like the following:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace HelloEve {
public partial class Form1 : Form
{
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
}
private void button1_Click(object sender, EventArgs e) {
}
}
}
At the top of the file, directly under:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
Code:
using EVE.ISXEVE;
using LavishScriptAPI;
using LavishVMAPI;
Ultimately we would like our program to obtain a list of pilot names when the user clicks the button on the form. So in our button_Click event method
we are going to want to do the calculations.
Before going on and showing you the code, I would like to direct you to the following website: http://www.lavishsoft.com/wiki/index.php/NET:Concepts:Frame_Locking#OnFrame_LavishScript_event
This is the most important concept to getting your .Net application to be used inside of eve.
So what is the FrameLock?
It's essentially a method to allow our thread (form/program/whatever) to read the object data from the eve client. What it does, is stops the client from advancing the frame and overwriting the object we may be wanting to use. Thus allowing us to get consistent data for that particular frame in the game loop.
Anyway, I am fairly poor at explaining these things. So I would recommend taking a read through it to get a better understanding of what it does.
So, how do we use this in our applications?
Well let's jump back to our button click method. And do the following:
Code:
private void button1_Click(object sender, EventArgs e) {
using (new FrameLock(true)) {
EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE();
List<String> pilotNames = new List<string>();
foreach (Pilot p in eve.GetLocalPilots()) {
pilotNames.Add(p.Name);
}
PilotList.DataSource = pilotNames;
}
}
Code:
using (new FrameLock(true))
If you want to update any of the eve members, you must framelock first!
Next we create an EVE.ISXEVE.EVE object (I wrote this the long way because intellisense thought it would look better). This is basically the EVE object on the wiki, thus we are able to use all the same methods and members listed on the wiki. The one we are looking for is "GetLocalPilots", which will get a list of pilots in the current system.
Now we only want the names, so we make a list of strings that will represent the names of the each pilot.
Now we get to the loop:
Code:
foreach (Pilot p in eve.GetLocalPilots()) {
pilotNames.Add(p.Name);
}
From there we fill the list of strings that we declared earlier with the pilots name (p.Name member).
The last part is the assign the datasource for our listbox. This essentially gives the listbox it's display data, and it takes a IEnumerable, how convenient
Alright that's it!!!
you should have code that looks like the following:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace HelloEve {
public partial class Form1 : Form
{
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
}
private void button1_Click(object sender, EventArgs e) {
using (new FrameLock(true)) {
EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE();
List<String> pilotNames = new List<string>();
foreach (Pilot p in eve.GetLocalPilots()) {
pilotNames.Add(p.Name);
}
PilotList.DataSource = pilotNames;
}
}
}
}
Your form should now be launched from eve (make sure you are running in window mode!). Click the button and see the list populate with the names of all the pilots in local.
I hope some of you find this useful, I am sorry if I did not explain things very well...
This is my first tutorial, so don't be too harsh.
I will be happy to write more if people request use of different features, or post code to get people on their way.
Happy Flying!