Asoter 3 Posted August 2, 2017 Share Posted August 2, 2017 as in title, is that possible? if yes, then how? Link to comment Share on other sites More sharing options...
camelot10 155 Posted August 3, 2017 Share Posted August 3, 2017 Var.SetVar Var.GetVar Link to comment Share on other sites More sharing options...
Asoter 3 Posted August 3, 2017 Author Share Posted August 3, 2017 Thanks for the reply, but can you give me simple example ? with <QuestsSorted Action="RunCode"> ? Link to comment Share on other sites More sharing options...
reapler 153 Posted August 3, 2017 Share Posted August 3, 2017 (edited) @Asoter Hello, in order to make a variable changeable by quester, you can transform your current variable into an property. Let's say you have an quest counter in your plugin defined as int: public int QuestCounter = 0; So you need to change this into this: public int QuestCounter { get { return robotManager.Helpful.Var.GetVar<int>(this.GetType().GetProperties().FirstOrDefault()?.Name); } set { robotManager.Helpful.Var.SetVar(this.GetType().GetProperties().FirstOrDefault()?.Name, value); } } You can still treat as an normal variable. And in Quester it looks like this: robotManager.Helpful.Var.SetVar("QuestCounter", 12); Edited August 3, 2017 by reapler mistaken CVar <-> Var Asoter 1 Link to comment Share on other sites More sharing options...
camelot10 155 Posted August 3, 2017 Share Posted August 3, 2017 robotManager.Helpful.Var.SetVar("Test", true); if (robotManager.Helpful.Var.Exist("Test")) Logging.Write("GETVAR " + robotManager.Helpful.Var.GetVar<bool>("Test")); Link to comment Share on other sites More sharing options...
Asoter 3 Posted August 4, 2017 Author Share Posted August 4, 2017 got error when definie this :( public int QuestCounter { get { return robotManager.Helpful.Var.GetVar<int>(this.GetType().GetProperties().FirstOrDefault()?.Name); } set { robotManager.Helpful.Var.SetVar(this.GetType().GetProperties().FirstOrDefault()?.Name, value); } } Link to comment Share on other sites More sharing options...
reapler 153 Posted August 4, 2017 Share Posted August 4, 2017 @Asoter In your plugin, "using System.Linq;" must be defined at the top of your code. If not ".FirstOrDefault()" will not work. Link to comment Share on other sites More sharing options...
Asoter 3 Posted August 4, 2017 Author Share Posted August 4, 2017 nvm... other variable make error. Anyway, Thanks for the support! :) PS: It works perfectly!!! Link to comment Share on other sites More sharing options...
Asoter 3 Posted August 4, 2017 Author Share Posted August 4, 2017 Hey Again, anyway, got another problem, got no errors but variable finaly didnt change, Im trying to debuging this...: 20:34:55 - readyIntoDungeon False 20:34:57 - [PartyChatCommand] Run [CSharp] go to dungeon > robotManager.Helpful.Var.SetVar("readyIntoDungeon", true); 20:34:59 - readyIntoDungeon False 20:35:03 - readyIntoDungeon False 20:35:07 - readyIntoDungeon False and secondly i define this without question mark after First or Default(beacause with mark I got error from WRobot): public bool readyIntoDungeon { get { return Var.GetVar<bool>(this.GetType().GetProperties().FirstOrDefault().Name); } set { Var.SetVar(this.GetType().GetProperties().FirstOrDefault().Name, value); } } btw trying with profile but didnt work Link to comment Share on other sites More sharing options...
reapler 153 Posted August 4, 2017 Share Posted August 4, 2017 @Asoter Everything looks fine, checked names and values. For me it works: doesn't matter in "RunCode" or in plugin. You may try this snippet: using System; using System.Linq; using robotManager.Helpful; using wManager.Plugin; public class Main : IPlugin { public bool readyIntoDungeon { get { Logging.Write(this.GetType().GetProperties().FirstOrDefault().Name); return Var.GetVar<bool>(this.GetType().GetProperties().FirstOrDefault().Name); } set { Logging.Write(this.GetType().GetProperties().FirstOrDefault().Name); Var.SetVar(this.GetType().GetProperties().FirstOrDefault().Name, value); } } public void Initialize() { Logging.Write(""+readyIntoDungeon); } public void Dispose() { } public void Settings() { readyIntoDungeon = true; } } Click on settings button then start bot. If it's not printing "true", then something else could be wrong with your plugin. But without an insight into your code, i can't really define the problem. Asoter 1 Link to comment Share on other sites More sharing options...
Asoter 3 Posted August 4, 2017 Author Share Posted August 4, 2017 Yeah, thanks for explain, with this plugin you show that work(problem is inside my plugin...). Thanks again! :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now