August 3, 20178 yr Author Thanks for the reply, but can you give me simple example ? with <QuestsSorted Action="RunCode"> ?
August 3, 20178 yr @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, 20178 yr by reapler mistaken CVar <-> Var
August 3, 20178 yr robotManager.Helpful.Var.SetVar("Test", true); if (robotManager.Helpful.Var.Exist("Test")) Logging.Write("GETVAR " + robotManager.Helpful.Var.GetVar<bool>("Test"));
August 4, 20178 yr Author 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); } }
August 4, 20178 yr @Asoter In your plugin, "using System.Linq;" must be defined at the top of your code. If not ".FirstOrDefault()" will not work.
August 4, 20178 yr Author nvm... other variable make error. Anyway, Thanks for the support! :) PS: It works perfectly!!!
August 4, 20178 yr Author 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
August 4, 20178 yr @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.
August 4, 20178 yr Author Yeah, thanks for explain, with this plugin you show that work(problem is inside my plugin...). Thanks again! :)
Create an account or sign in to comment