Jump to content

Recommended Posts

Since we're not making an addon, but we're making lua in the bot and the filename changes all the time (ghuheu38.lua) we can't make a side addon  with the toc for the savedvariable
Is there some other smart way to do it with wrobot? :)

Link to comment
https://wrobot.eu/forums/topic/6855-can-we-use-savedvariables/
Share on other sites

I only use macro ingame to pass the value to the wrobot cs rotation. You can create a global variable assign a value to that variable and read it in wrobot.

Lua.LuaDoString(@"SLASH_HELLOWORLD1, SLASH_HELLOWORLD2 =  ""/Lux"",""/lux""; local function handler(msg, editbox)  setglobal( ""Lux"", msg ) end SlashCmdList[""HELLOWORLD""] = handler; ");

In that example when user in game write : /lux 1 the global value Lux will be set to 1 and then inside the cs you can read the value in something like that:

var Lux = Lua.LuaDoString<int>("value = Lux;", "value");

Of course if you make an addon which is setting the certain globals in certain way you will be able then to read the values from inside the wrobot. So something like that is possible and it was done in pqr with pqi.

 

 

 

1 minute ago, forerun said:

I only use macro ingame to pass the value to the wrobot cs rotation. You can create a global variable assign a value to that variable and read it in wrobot.

Lua.LuaDoString(@"SLASH_HELLOWORLD1, SLASH_HELLOWORLD2 =  ""/Lux"",""/lux""; local function handler(msg, editbox)  setglobal( ""Lux"", msg ) end SlashCmdList[""HELLOWORLD""] = handler; ");

In that example when user in game write : /lux 1 the global value Lux will be set to 1 and then inside the cs you can read the value in something like that:

var Lux = Lua.LuaDoString<int>("value = Lux;", "value");

Of course if you make an addon which is setting the certain globals in certain way you will be able then to read the values from inside the wrobot. So something like that is possible and it was done in pqr with pqi.

 

 

 

Of course, why didn't i think of that?
Thanks a ton mate!
I used to use PQR for WOTLK, where i made an in-game addon INSIDE pqr, i did exactly that to save my variables, i just totally forgot that i had done it, since it was ages ago. Thank you for the response! <3

  • 2 weeks later...

So i've tested this out, and ofc. it works fine it remembers the variables i set.
The problem is that it does actions based on those variables which are blocked by blizzard. So the first thing that happens when i do anything using those variables i have saved in my ToC (SavedVariables) blizzard blocks my addon.
Is there not any way to save lua variables without using SavedVariables in-game? Since addons are also checked for secure usage.

Var.SetVar

Var.GetVar

its a internal wrobot dictionary, no relation to toc or blizzard. its used as wrobot cache, you can save, modify and delete this variables while wrobot run. if wrobot closed -> all var data lost/cleared. OR when wrobot starts, its create this cache/dictionary from scratch.

dunno what variable you talking about

3 minutes ago, camelot10 said:

Var.SetVar

Var.GetVar

its a internal wrobot dictionary, no relation to toc or blizzard. its used as wrobot cache, you can save, modify and delete this variables while wrobot run. if wrobot closed -> all var data lost/cleared. OR when wrobot starts, its create this cache/dictionary from scratch.

dunno what variable you talking about

Yeah the problem here is exactly that it's cleared.
The reason i was using an addon instead was because i want it to save my variables between game sessions. When you close the game and wrobot, from what i understand Var.SetVar and Var.GetVar clears and then we're back to default, thereby losing the saved data?

lemme give you world most superior advice at all time. "use search, young padawan"

here is quick jedi trick http://lmgtfy.com/?q=site%3Awrobot.eu+"robotManager.Helpful.Settings"

Edited by camelot10
Just now, camelot10 said:

lemme give you world most superior advice at all time. "use search, young padawan"

here is quick jedi trick https://www.google.ru/search?q=site%3Awrobot.eu+"robotManager.Helpful.Settings"

No reason to be rude. I always search every bit of the internet before i begin asking quetions. I will try see if i can figure it out.

Thanks.

im not rude. i prefer to learn fly other peoples, not to carry them by myself at all time. maybe my english no so good. sorry

ps. i put correct link above.

 

Edited by camelot10
Just now, camelot10 said:

im not rude. i prefer to learn fly other peoples, not to carry then by myself at all time. maybe my english no so good. sorry

ps. i put correct link above.

 

And i allrdy did google it before you linked the "how to google" guide..
If you click your own link you will see there are 6 links, and none of them has any info on how to use robotManager.Helpful.Settings

now i can be rude, but i must say that:

 seems like you can't search correctly in the internet, first link in my search have partial code of robotManager.Helpful.Settings and lead to http://lmgtfy.com/?q=site%3Awrobot.eu+"AdviserFilePathAndName"

 

 

 

6 minutes ago, camelot10 said:

now i can be rude, but i must say that:

 seems like you can't search correctly in the internet, first link in my search have partial code of robotManager.Helpful.Settings and lead to http://lmgtfy.com/?q=site%3Awrobot.eu+"AdviserFilePathAndName"

 

 

 

What is wrong with you? There is NO reason at all to be rude at all... Being arrogant and rude has no place in a public debate area. Clearly i can't seem to get where you want me to go, you could just point me directly to where you want me to go instead of making rude gestures and posting links to a "how to use google" site.

I am not being rude to you in any way. Your behavior is so weird...

If anyone asks a question on this forum and i know the answer, i will answer the question, and i will point to where people can find the help they need if i know where.

Edit: In short: Can you just tell me weather robotManager.Helpful.Settings Can work with lua or not?
If you don't know, that is fair enough.

Edited by Ordush

god, why so agressive? there is a small bits of information on this forum, i just whant to explain you how you can solve 99% of wrobot problems by your own.

but lazy and agressive peoples like you, prefer to ask questions whats required a 5 minutes of time and brain working.

my second link, first google link lead to 

 

there is everything you need for saving and loading data/params between wrobot sessions.

second google link gives complete info too. whats wrong with you? if you can't search internet and im trying to help, why you aggroed? since 24 aug, im only one who helping with answers in this topic. sorry if i hurt your feelings in any way. i hope you understand how to search strict string on current site and follow the trail to get answers in 5-10 mins and dont wait 3 weeks for "kind stranger"

 

2 minutes ago, camelot10 said:

god, why so agressive? there is a small bits of information on this forum, i just whant to explain you how you can solve 99% of wrobot problems by your own.

but lazy and agressive peoples like you, prefer to ask questions whats required a 5 minutes of time and brain working.

my second link, first google link lead to 

 

there is everything you need for saving and loading data/params between wrobot sessions.

second google link gives complete info too. whats wrong with you? if you can't search internet and im trying to help, why you aggroed? since 24 aug, im only one who helping with answers in this topic. sorry if i hurt your feelings in any way. i hope you understand how to search strict string on current site and follow the trail to get answers in 5-10 mins and dont wait 3 weeks for "kind stranger"

 

And i appreciate any help i can get, but i don't understand why you have to be rude about it? Yes it took you 5 minutes to get how to use C# for saving/loading data/params.
What i asked was if/how i can use lua to do it. The reason i ask for lua is because i write my fightclasses in lua not C#.
Without any reason at all you keep telling me how much i suck at using google etc. I am not being aggressive, quite the opposite, i am being defensive because you keep being rude to me instead of just telling me: "I don't know if you can do it in lua".

its a very bad practice to save variables between sessions like "c# -> wrobot -> lua -> wow -> addon -> disk" for wrobot and vice versa to load it.

you can load wrobot settings and set lua vars after load for your lua-fightclass. this allow you to skip dependancy from wow addon and store everything you need for fightclass

20 minutes ago, camelot10 said:

its a very bad practice to save variables between sessions like "c# -> wrobot -> lua -> wow -> addon -> disk" for wrobot and vice versa to load it.

you can load wrobot settings and set lua vars after load for your lua-fightclass. this allow you to skip dependancy from wow addon and store everything you need for fightclass

Thank you for giving me a straight answer! It's very appreciated.

If i understand you right, i should be able to set lua vars using C#. I am obviously not very good at C#.
I will give it a try looking through the code that people used to make settings (the links you lastly provided). And see if i can figure out how to use that to set lua vars.

That was all i asked for mate. Thanks

#if VISUAL_STUDIO
using robotManager.Helpful;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using wManager.Wow.Bot.Tasks;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using wManager.Wow.Enums;
using System.Configuration;
using System.ComponentModel;
using System.IO;
#endif

[Serializable]
public class TestSettings : Settings
{
	[Setting]
	[DefaultValue(true)]
	[Category("GHOST WOLF SETTINGS")]
	[DisplayName("Ghost Wolf")]
	[Description("Use Ghost Wolf")]
	public bool UGW { get; set; }

	[Setting]
	[DefaultValue(4)]
	[Category("GHOST WOLF SETTINGS")]
	[DisplayName("Use after X secondes")]
	[Description("Use Ghost Wolf after X secondes out of combat")]
	public int TGW { get; set; }

	public static TestSettings CurrentSetting { get; set; }

	public TestSettings()
	{
	}

	public bool Save()
	{
		try
		{
			
			return Save(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
		}
		catch (Exception e)
		{
			Logging.WriteError("CustomClass_ShamanSettings > Save(): " + e);
			return false;
		}
	}
	public static bool Load()
	{
		try
		{
			if (File.Exists(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
			{
				CurrentSetting = Load<TestSettings>(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
			}
			else
			{
				CurrentSetting = new TestSettings
				{
					UGW = true,
					TGW = 4,
				};
			}
			CurrentSetting.PushToLua();
			return true;
		}
		catch (Exception e)
		{
			Logging.WriteError("CustomClass_ShamanSettings > Load(): " + e);
		}
		return false;
	}
	void PushToLua()
	{
		UGW = Lua.LuaDoString<bool>("return luaVar");
	}

	void FetchFromLua()
	{
		Lua.LuaDoString("UGW = " + UGW);
	}
}

quick and dirty example

2 minutes ago, camelot10 said:

#if VISUAL_STUDIO
using robotManager.Helpful;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using wManager.Wow.Bot.Tasks;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using wManager.Wow.Enums;
using System.Configuration;
using System.ComponentModel;
using System.IO;
#endif

[Serializable]
public class TestSettings : Settings
{
	[Setting]
	[DefaultValue(true)]
	[Category("GHOST WOLF SETTINGS")]
	[DisplayName("Ghost Wolf")]
	[Description("Use Ghost Wolf")]
	public bool UGW { get; set; }

	[Setting]
	[DefaultValue(4)]
	[Category("GHOST WOLF SETTINGS")]
	[DisplayName("Use after X secondes")]
	[Description("Use Ghost Wolf after X secondes out of combat")]
	public int TGW { get; set; }

	public static TestSettings CurrentSetting { get; set; }

	public TestSettings()
	{
	}

	public bool Save()
	{
		try
		{
			
			return Save(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
		}
		catch (Exception e)
		{
			Logging.WriteError("CustomClass_ShamanSettings > Save(): " + e);
			return false;
		}
	}
	public static bool Load()
	{
		try
		{
			if (File.Exists(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
			{
				CurrentSetting = Load<TestSettings>(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
			}
			else
			{
				CurrentSetting = new TestSettings
				{
					UGW = true,
					TGW = 4,
				};
			}
			CurrentSetting.PushToLua();
			return true;
		}
		catch (Exception e)
		{
			Logging.WriteError("CustomClass_ShamanSettings > Load(): " + e);
		}
		return false;
	}
	void PushToLua()
	{
		UGW = Lua.LuaDoString<bool>("return luaVar");
	}

	void FetchFromLua()
	{
		Lua.LuaDoString("UGW = " + UGW);
	}
}

quick and dirty example

Cheers! Makes sense!

3 hours ago, camelot10 said:

#if VISUAL_STUDIO
using robotManager.Helpful;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using wManager.Wow.Bot.Tasks;
using wManager.Wow.Class;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using wManager.Wow.Enums;
using System.Configuration;
using System.ComponentModel;
using System.IO;
#endif

[Serializable]
public class TestSettings : Settings
{
	[Setting]
	[DefaultValue(true)]
	[Category("GHOST WOLF SETTINGS")]
	[DisplayName("Ghost Wolf")]
	[Description("Use Ghost Wolf")]
	public bool UGW { get; set; }

	[Setting]
	[DefaultValue(4)]
	[Category("GHOST WOLF SETTINGS")]
	[DisplayName("Use after X secondes")]
	[Description("Use Ghost Wolf after X secondes out of combat")]
	public int TGW { get; set; }

	public static TestSettings CurrentSetting { get; set; }

	public TestSettings()
	{
	}

	public bool Save()
	{
		try
		{
			
			return Save(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
		}
		catch (Exception e)
		{
			Logging.WriteError("CustomClass_ShamanSettings > Save(): " + e);
			return false;
		}
	}
	public static bool Load()
	{
		try
		{
			if (File.Exists(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
			{
				CurrentSetting = Load<TestSettings>(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
			}
			else
			{
				CurrentSetting = new TestSettings
				{
					UGW = true,
					TGW = 4,
				};
			}
			CurrentSetting.PushToLua();
			return true;
		}
		catch (Exception e)
		{
			Logging.WriteError("CustomClass_ShamanSettings > Load(): " + e);
		}
		return false;
	}
	void PushToLua()
	{
		UGW = Lua.LuaDoString<bool>("return luaVar");
	}

	void FetchFromLua()
	{
		Lua.LuaDoString("UGW = " + UGW);
	}
}

quick and dirty example

I hit a roadblock here

It does change the setting if i click settings based on what i set HuntersMarkDisabled to in-game, but in-game doesn't change based on what it's set to in the settings (So it saves to settings, but doesn't load from settings)

[Serializable]
public class HunterBeastmasterSettings : Settings
{

        [Setting]
        [DefaultValue(true)]
        [Category("Combat Spells - Hunter Abilities")]
        [DisplayName("Hunter's Mark Disabled")]
        [Description("Is Hunter's Mark Disabled?")]
        public bool HuntersMark { get; set; }

        [Setting]
        [DefaultValue(true)]
        [Category("Combat Spells - Hunter Abilities")]
        [DisplayName("Steady Shot")]
        [Description("Is Hunter's Mark Disabled?")]
        public bool SteadyShot { get; set; }

    public static HunterBeastmasterSettings CurrentSetting { get; set; }

        private HunterBeastmasterSettings()
    {   
    }

    public bool Save()
    {
        try
        {
            return Save(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName));
        }
        catch (Exception e)
        {
            Logging.WriteError("HunterBeastmasterSettings > Save(): " + e);
            return false;
        }
    }

    public static bool Load()
    {
        try
        {
            if (File.Exists(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
            {
                CurrentSetting = Load<HunterBeastmasterSettings>(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName));
            }
            else
            {
                CurrentSetting = new HunterBeastmasterSettings
                {
                    HuntersMark = false,
                    SteadyShot = false,
                };
            }
            CurrentSetting.PushToLua();
            return true;      
        }
        catch (Exception e)
        {
            Logging.WriteError("HunterBeastmasterSettings > Load(): " + e);
        }
        return false;
    }
    void PushToLua()
    {
        HuntersMark = Lua.LuaDoString<bool>("return HuntersMarkDisabled");
    }

    void FetchFromLua()
    {
        Lua.LuaDoString("HuntersMarkDisabled = " + HuntersMark);
    }
}

I tried adding CurrentSetting.FetchFromLua(); to the "try" under load.

Do i need to rewrite the load, like the save has been rewritten for it to work? :)

2 minutes ago, camelot10 said:

oh god. whats your C# knowledge level ?

My C# Knowledge level is almost non existent, which is why i've written my fightclass in lua. This is also why i was asking if anyone knew of a way to do this with lua. :)
Edit: When it comes to C# I can read examples and modify them for my needs.

Edited by Ordush

I just went into the shower, while there i think i figured it out.
If i write the code you see above, and then start my fight class with a c# code (using the editor)
And i in that code write the following:
if (Updateloaded != true)
{
Updateloaded = true
FetchFromLua();
}
Then it should update my variables before displaying/using them for the rest of the fight class right?
Meaning that would be how i load them form last session? :)

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...