Jump to content

Recommended Posts

i made some usefull cs helpers classes for travel/world quests/scenario

and im wonder, how i can use it in profiles without adding this class to profiles?

its possible thru plugin ?

if yes, how i can check in quester profile that plugin installed and enabled/running ?

 

Link to comment
https://wrobot.eu/forums/topic/3834-shared-cs-code-for-all-profiles/
Share on other sites

For create you helpers class, look this sample: MyLib sample.zip (extract it in your WRobot folder, don't forget to activate plugins "MyLib Loader.cs").

This plugin contains two files, "MyLib Loader.cs" and "\MyLib\MyLib.cs".

"MyLib Loader.cs" load file "\MyLib\MyLib.cs".

"\MyLib\MyLib.cs" is your helpers class.

To try this, you can run c# code where you want:

MyLibNamespace.MyLib.Test();

(It is plugin, but you can convert "MyLib Loader.cs" to integrate it at your Quester or custom profiles).

 

To check if plugin is active use this code:

bool isActive = false;
foreach (var p in wManager.wManagerSetting.CurrentSetting.PluginsSettings)
{
  if (p.FileName == "MyLib Loader.cs" && p.Actif)
  {
    isActive = true;
    break;
  }
}

or you can use "Var", in plugin Initialize method put:

robotManager.Helpful.Var.SetVar("MyLibInitialised", true);

 and when you want check if plugin loaded (where you want in WRobot):

bool isActive = robotManager.Helpful.Var.Exist("MyLibInitialised") && robotManager.Helpful.Var.GetVar<bool>("MyLibInitialised");

 

  • 5 months later...

@Droidz

this doesnt work. maded plugin, maded lib.

if i use in quests editor, in any quest details complete or can condition return QuestHelper.SOMETHING();

on quester start, when profiles compiles in *.cs, this throw error, becouse plugin not inited and lib not loaded. i can use lib code in steps. but not in quests directly.

anything like "wrobot/SharedLibs/" possible? i mean without plugins and direct in quest profiles code. something like static class and nothing more

  • 4 weeks later...
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...