Raised This Month: $134 Target: $400
 33% 

Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]


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

Dynamic 0.0.25

- Garbage collector plugin handle patch (thx KyleS)
- changed dynamic.Index to offset.Index (thx jdlovins)
- Add Get/Set by offset to sm_dynamic_selftest
- Fix Native_Dynamic_SetVectorByOffset
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 03-21-2017 , 10:51   Re: Dynamic Objects and Properties - v.0.0.26 - [2017.03.22]
Reply With Quote #242

Dynamic 0.0.26

- Add CloseHandle and CloseHandleByOffset
- Add Dynamic.IsLoaded()
- Intitalise all data along with natives in AskPluginLoad2
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-18-2017 , 20:47   Re: Dynamic Objects and Properties - v.0.0.27 - [2017.06.19]
Reply With Quote #243

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 , 10:09   Re: Dynamic Objects and Properties - v.0.0.28 - [2017.08.06]
Reply With Quote #244

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 , 18:03   Re: Dynamic Objects and Properties - v.0.0.28 - [2017.08.06]
Reply With Quote #245

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 , 06:48   Re: Dynamic Objects and Properties - v.0.0.29 - [2017.08.09]
Reply With Quote #246

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 , 18:41   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #247

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 , 11:48   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #248

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 , 15:48   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #249

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 , 02:43   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #250

https://github.com/ntoxin66/Dynamic/...ynamic-Strings
__________________
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 21:26.


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