Raised This Month: $32 Target: $400
 8% 

Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-18-2017 , 19:47   Re: Dynamic Objects and Properties - v.0.0.27 - [2017.06.19]
Reply With Quote #241

Dynamic 0.0.27

- Patched Dynamic.WriteConfig
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-06-2017 , 09:09   Re: Dynamic Objects and Properties - v.0.0.28 - [2017.08.06]
Reply With Quote #242

Dynamic 0.0.28

- Fix `Not called from inside a native function` error during OnPluginEnd
- Implement Function datatype
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-06-2017 , 17:03   Re: Dynamic Objects and Properties - v.0.0.28 - [2017.08.06]
Reply With Quote #243

Just realised there was a typo in the new Function datatype.

I've updated the repo from my mobile and will compile the next version tonight after work.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-09-2017 , 05:48   Re: Dynamic Objects and Properties - v.0.0.29 - [2017.08.09]
Reply With Quote #244

Dynamic 0.0.29

- Patches to Function type
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-17-2017 , 17:41   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #245

Dynamic 0.0.30

- Fixed `Not called from inside a native function` bug (Thanks TR1D)
__________________
Neuro Toxin is offline
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 10-31-2017 , 10:48   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #246

Hello,

I love the idea of what you're trying to achieve here and I thought I'd give this a try today. I'm having some success but I'm a bit stuck on MethodMaps and Strings (sorry if you've answered this elsewhere). I've looked over the examples, grepped the inc files and see the type for string is boolean, other than char and trying to follow the prototypes, I'm just failing at this.

PHP Code:
char nameBuffer[64];

methodmap test Dynamic {
    
property char name {
        public 
get() {
            
this.GetString("name"nameBuffersizeof(nameBuffer));
        }

        public 
set(const char[] value) {
            
this.SetString("name"valuesizeof(value));
        }
    }
}

test();
x.name "Tom Foolhardy"
I've gone through a bunch of iterations of that code, with more and less arguments for the getter and setter and this is the closest I can get with the least amount of errors. How do you create a getter/setter for type string?

Thanks!
NgBUCKWANGS is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 10-31-2017 , 14:48   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #247

Your best to use the class builder.

http://console.aus-tg.com/index.php?...tedynamicclass

Code:
#if defined _dynamic_class_test_
  #endinput
#endif
#define _dynamic_class_test_

methodmap test < Dynamic
{
	public test()
	{
		// First we make a new dymanic object
		Dynamic myclass = Dynamic(512, 0);

		// Next we will define all the members
		// -> We do this to force the offsets to always be in the same location
		//    over multiple instances of the same class.
		myclass.SetString("name", "", 256);
		return view_as<test>(myclass);
	}

	// Note that I use static offsets to access members.
	// -> This improves performance by caching member offsets
	// -> This is why we force the members in during the contructor
	// -> Failure to force members in the constructor will cause corruption

	public bool Getname(char[] buffer, int length)
	{
		static DynamicOffset offset = INVALID_DYNAMIC_OFFSET;
		if (offset == INVALID_DYNAMIC_OFFSET)
		{
			offset = this.GetMemberOffset("name");
			if (offset == INVALID_DYNAMIC_OFFSET)
				SetFailState("A serious error occured in Dynamic!");
		}
		this.GetStringByOffset(offset, buffer, length);
		return true;
	}

	public void Setname(const char[] buffer)
	{
		static DynamicOffset offset = INVALID_DYNAMIC_OFFSET;
		if (offset == INVALID_DYNAMIC_OFFSET)
		{
			offset = this.GetMemberOffset("name");
			if (offset == INVALID_DYNAMIC_OFFSET)
			{
				offset = this.SetString("name", buffer);
				return;
			}
		}
		this.SetStringByOffset(offset, buffer);
	}
}
When dealing with strings, you need to realise they are a fixed length based on there size when first set. That length cant change. Notice the class builder sets the length within the methodmaps initialiser.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 11-01-2017 , 01:43   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #248

https://github.com/ntoxin66/Dynamic/...ynamic-Strings
__________________
Neuro Toxin is offline
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 11-01-2017 , 20:52   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #249

Quote:
Originally Posted by Neuro Toxin View Post
Thank you Neuro Toxin, unfortunately today I didn't have any time to check any of this out but tomorrow will hopefully be better for me to dig into it again. Thank you very much for all of your help and the interesting project here. I'll be sure to again post here when I hopefully get the ball rolling. Thanks!
NgBUCKWANGS is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-12-2018 , 19:21   Re: Dynamic Objects and Properties - v.0.0.31 - [2018.01.13]
Reply With Quote #250

Dynamic 0.0.31

- Patched FlatConfigs bugs
- Patched String->Bool datatype conversion
- Allow double forward slash comments in flatconfigs
- Patched CreateMemberFromString not reading ints/floats properly
- Removed case sensitivity in String to Bool datatype conversion
__________________

Last edited by Neuro Toxin; 01-12-2018 at 19:22.
Neuro Toxin is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode