Solved Get Fougerite.Version?

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
86
18
California
Any way to get the version of Fougerite, so I can use specific new features for one, and if not use older features? Example:

Since MC4:
Code:
World.GetGround()
has been restored to the original Magma version. It works again.
There is also a new method
Code:
World.GetTerrainHeight(vector3 position)
I don't want to force people to use MC4< And didnt see this listed in the API...

Was hoping this existed...
Code:
Fougerite.Version(Version ver) int
 
Last edited:

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,095
4,815
113
At your house.
github.com
Any way to get the version of Fougerite, so I can use specific new features for one, and if not use older features? Example:

Since MC4:


I don't want to force people to use MC4< And didnt see this listed in the API...

Was hoping this existed...
Code:
Fougerite.Version(Version ver) int
There is a String Version variable in the Bootstrap class. It's public & static, so im pretty sure you can access it.

https://github.com/fougerite/Fougerite/blob/master/Fougerite/Fougerite/Bootstrap.cs#L15


JavaScript:
var fougeritev = Bootstrap.Version;
Python:
fougeritev =  Bootstrap.Version
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
86
18
California
JavaScript:
var fougeritev = Bootstrap.Version;
        Player.Message("This Version of Fougerite is " + fougeritev);
Returns This Version of Fougerite is undefined.:(
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,095
4,815
113
At your house.
github.com
JavaScript:
var fougeritev = Bootstrap.Version;
        Player.Message("This Version of Fougerite is " + fougeritev);
Returns This Version of Fougerite is undefined.:(
Could you put this in a try catch for me?

JavaScript:
try {
      var version =  Bootstrap.Version;
       // Try printing version
} catch(err) {
      Plugin.Log("Error", "Couldn't get it. " + err.message);
}
I'm not sure why don't we have access to that class tho.
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
86
18
California
Yeah, give me a sec, Avast! seems to think rust_server.exe is a virus o_O, I dont blame them...lol; Stupid heuristics.
 
Last edited:

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
86
18
California
JavaScript:
function On_Command(Player,cmd,args){
    if(cmd == "test"){
        try {
            var version =  Bootstrap.Version;
            Player.Message("Fougerite Version is : " + version);
        } catch(err) {
            Plugin.Log("Error", "Couldn't get it. " + err.message);
        }
     }
}
[9/26/2014 9:39 AM] Couldn't get it. Function expected.
 
Last edited:

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,095
4,815
113
At your house.
github.com
JavaScript:
function On_Command(Player,cmd,args){
    if(cmd == "test"){
        try {
            var version =  Bootstrap.Version;
            Player.Message("Fougerite Version is : " + version);
        } catch(err) {
            Plugin.Log("Error", "Couldn't get it. " + err.message);
        }
     }
}
When I tried to print it via python. :/

Code:
AttributeError: attribute 'Bootstrap' of 'namespace#' object is read-only
Process finished with exit code 1
 

mikec

Master Of All That I Survey
Retired Staff
Trusted Member
Jul 12, 2014
296
152
28
Los Angeles, California, USA
World.GetGround()
has been restored to the original Magma version. It works again.
There is also a new method
Code (Text):
World.GetTerrainHeight(vector3 position)
I don't want to force people to use MC4< And didnt see this listed in the API...
Why would that force people to use one version or the other? Existing Magma scripts were broke. I unbroke them. I introduced a new method for finding the ground. New scripts can use it. Older scripts will still use GetGround as before.
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
86
18
California
Why would that force people to use one version or the other? Existing Magma scripts were broke. I unbroke them. I introduced a new method for finding the ground. New scripts can use it. Older scripts will still use GetGround as before.
If someone wasn't using MC3< and I used the newer GetGroundHeight() without adding a check for Fougerite version, you are saying this command would STILL run? That's what I'm saying.
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
86
18
California
JavaScript:
var version = Fougerite.Bootstrap.Version;
Player.Message("This Version of Fougerite is " + version);
worked for me...:confused:
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
86
18
California
JavaScript:
                var fougver = Fougerite.Bootstrap.Version;
                var fougver_lgth = fougver.length;
                //Make sure not 1.0.5
                if(fougver_lgth > 5){
                    var mc = fougver.substr(5); // 5 chars in 1.0.5, remove them
                    var rem = /\d+/;
                    var mcver = (mc.match(rem));
                    //Make sure Mikec's version is greater than 3
                    if(mcver > 3){
                        coord.y = World.GetTerrainHeight(coord.x,coord.z); //New in MC4
                    }else{
                        coord.y = World.GetGround(coords.x,coords.z); //Old way for <MC4 or 1.0.5
                    }
                }else{
                    coord.y = World.GetGround(coords.x,coords.z); //Old way for <MC4 or 1.0.5
                }
Is this up to par? Still don't understand why it worked for me and not for you?
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,095
4,815
113
At your house.
github.com
JavaScript:
                var fougver = Fougerite.Bootstrap.Version;
                var fougver_lgth = fougver.length;
                //Make sure not 1.0.5
                if(fougver_lgth > 5){
                    var mc = fougver.substr(5); // 5 chars in 1.0.5, remove them
                    var rem = /\d+/;
                    var mcver = (mc.match(rem));
                    //Make sure Mikec's version is greater than 3
                    if(mcver > 3){
                        coord.y = World.GetTerrainHeight(coord.x,coord.z); //New in MC4
                    }else{
                        coord.y = World.GetGround(coords.x,coords.z); //Old way for <MC4 or 1.0.5
                    }
                }else{
                    coord.y = World.GetGround(coords.x,coords.z); //Old way for <MC4 or 1.0.5
                }
Is this up to par? Still don't understand why it worked for me and not for you?
Well the reason should be cause that variable is static. I think you have to call a static var different in IP.
 
Last edited:

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,095
4,815
113
At your house.
github.com
My problem was that I was trying to get the variable from the DLL. That should have worked, but you cannot call all the raw variables, or methods from the IDE.

It will require something like the GetUtil method, to get the Class Itself. As @balu92 said we cannot run RunTime enviroment methods, though that variable was a single string in static, which is not runtime, so In this case thats not true. Basically in IronPython we can do things, without starting the server, but if we want to get something directly from the class, we need a method in C#, right inside the class, which returns us the class. (Again referencing the Util.GetUtil method)

So yeah. I should add this as a note to the pycharm installation/setup.
 
  • Informative
Reactions: CorrosionX

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,095
4,815
113
At your house.
github.com
Do you think you could, to help other people out, add the new Fougerite API handles to your documentation in a new section for Fougerite only and add the above World.GetTerrainHeight for MC3< and Fougerite.Bootstrap.Version? I'm sure would help other people out.

http://fougerite.com/threads/read-me-documentation.12/
I really do want, but I'm busy with python, and the installer, and yeah..........................................

I'm too lazy to do it alone, and Idk what should i write it in.
 
  • Dislike
Reactions: CorrosionX

Snake

Moderator
Moderator
Jul 13, 2014
288
174
28
Do you think you could, to help other people out, add the new Fougerite API handles to your documentation in a new section for Fougerite only and add the above World.GetTerrainHeight for MC3< and Fougerite.Bootstrap.Version? I'm sure would help other people out.

http://fougerite.com/threads/read-me-documentation.12/
I was starting a project to document Fougerite but saw no-one was going to help. Feel free to join and write sections for the wiki. If I see activity I'll come too and help :

Link : fougerite.wikia.com
 
  • Informative
Reactions: CorrosionX