Page 2 of 6

Re: [ DEV ] InfinityScript Suggestions

Posted: Mon Feb 01, 2016 10:00 pm
by ~Lambder
c4271605 wrote:
Lambder wrote:
c4271605 wrote:- SetPersistentDvar - Sets a dvar the client saves even after leaving the server and restarting their game

Well that caught my eye. Is it a built-in function?

And about the modified IS you are coding, you might want to wait for the tg4.0 update. There are some new things in there.

P.S. Glad you aren't a .NET-sucks-scrub.

Yep, it is.

Edit, you can access client dvars tho :|


Not sure how I can read them though. Also, could you tell me in a PM or something or even publicly how to set persistent dvars and read them from clients?
Don't worry, you'll be credited. (I'm not much of a reverser, so don't hate)

Re: [ DEV ] InfinityScript Suggestions

Posted: Tue Feb 02, 2016 2:18 am
by ~Seraphim
Lambder wrote:
c4271605 wrote:
Lambder wrote:
c4271605 wrote:- SetPersistentDvar - Sets a dvar the client saves even after leaving the server and restarting their game

Well that caught my eye. Is it a built-in function?

And about the modified IS you are coding, you might want to wait for the tg4.0 update. There are some new things in there.

P.S. Glad you aren't a .NET-sucks-scrub.

Yep, it is.

Edit, you can access client dvars tho :|


Not sure how I can read them though. Also, could you tell me in a PM or something or even publicly how to set persistent dvars and read them from clients?
Don't worry, you'll be credited. (I'm not much of a reverser, so don't hate)


Image

Then you can read them:

Code: Select all

self.IPrintLnBold( "Dvar Value: " + self.Call< string >( "getDvar", "myDvar" ) );


You can optionally use the template method I wrote as a part of Entity:
Image

Thus using the above i can simply type:

Code: Select all

self.SetPersistentDvar( "myDvar", "This is an example" );

self.iPrintLnBold( "Value: " + self.GetClientDvar( "myDvar" ) );

Re: [ DEV ] InfinityScript Suggestions

Posted: Tue Feb 02, 2016 8:21 am
by ~Lambder
c4271605 wrote:
Lambder wrote:
c4271605 wrote:
Lambder wrote:
c4271605 wrote:- SetPersistentDvar - Sets a dvar the client saves even after leaving the server and restarting their game

Well that caught my eye. Is it a built-in function?

And about the modified IS you are coding, you might want to wait for the tg4.0 update. There are some new things in there.

P.S. Glad you aren't a .NET-sucks-scrub.

Yep, it is.

Edit, you can access client dvars tho :|


Not sure how I can read them though. Also, could you tell me in a PM or something or even publicly how to set persistent dvars and read them from clients?
Don't worry, you'll be credited. (I'm not much of a reverser, so don't hate)


Image

Then you can read them:

Code: Select all

self.IPrintLnBold( "Dvar Value: " + self.Call< string >( "getDvar", "myDvar" ) );


You can optionally use the template method I wrote as a part of Entity:
Image

Thus using the above i can simply type:

Code: Select all

self.SetPersistentDvar( "myDvar", "This is an example" );

self.iPrintLnBold( "Value: " + self.GetClientDvar( "myDvar" ) );


I'll check that out when I get back home and I'll report back with the results.

Since they are persistent dvars, I guess I can put any of the built in GSC types, right? like floats, ints etc. Value types, that is.

Re: [ DEV ] InfinityScript Suggestions

Posted: Tue Feb 02, 2016 10:24 am
by Slvr99
c4271605 wrote:Edit, you can access client dvars tho :|

How so? There isn't a "getClientDVAR" function and you can't even get them in the actual game's GSC. "getDVAR" gets a server DVAR, not a client one.

Re: [ DEV ] InfinityScript Suggestions

Posted: Tue Feb 02, 2016 11:47 am
by ~Seraphim
Slvr99 wrote:
c4271605 wrote:Edit, you can access client dvars tho :|

How so? There isn't a "getClientDVAR" function and you can't even get them in the actual game's GSC. "getDVAR" gets a server DVAR, not a client one.

Bet you didn't know.
Call "iprintln" via Function.Call<T> and you end up executing a global function.
But calling it on a entity allows you to execute it for the client.

Example would be in GSC:

Code: Select all

self iprintlnbold("Test");


And yes dvars support all primitive types

Re: [ DEV ] InfinityScript Suggestions

Posted: Tue Feb 02, 2016 11:51 am
by Slvr99
c4271605 wrote:Bet you didn't know.
Call "iprintln" via Function.Call<T> and you end up executing a global function.
But calling it on a entity allows you to execute it for the client.

Example would be in GSC:

Code: Select all

self iprintlnbold("Test");


And yes dvars support all primitive types

I knew that, but calling getDvar on an Entity still checks the server DVAR. That's the same reason there's a "setClientDvar" function instead of using "self setDvar"
You can tell since "getDvar" and "setDvar" are listed under "global stuff #2" in IS, not "playercmd". Trust me, I've been using IS since it's release =P

Re: [ DEV ] InfinityScript Suggestions

Posted: Tue Feb 02, 2016 1:29 pm
by ~Lambder
Slvr99 wrote:
c4271605 wrote:Bet you didn't know.
Call "iprintln" via Function.Call<T> and you end up executing a global function.
But calling it on a entity allows you to execute it for the client.

Example would be in GSC:

Code: Select all

self iprintlnbold("Test");


And yes dvars support all primitive types

I knew that, but calling getDvar on an Entity still checks the server DVAR. That's the same reason there's a "setClientDvar" function instead of using "self setDvar"
You can tell since "getDvar" and "setDvar" are listed under "global stuff #2" in IS, not "playercmd". Trust me, I've been using IS since it's release =P


Hm.
What about

Code: Select all

Function.SetEntRef(Entity.EntRef);
T = Function.Call<T>("GetDvar", string);


Afaik, this is exactly what Entity.Call does.

Re: [ DEV ] InfinityScript Suggestions

Posted: Tue Feb 02, 2016 3:06 pm
by Slvr99
Lambder wrote:
Slvr99 wrote:
c4271605 wrote:Bet you didn't know.
Call "iprintln" via Function.Call<T> and you end up executing a global function.
But calling it on a entity allows you to execute it for the client.

Example would be in GSC:

Code: Select all

self iprintlnbold("Test");


And yes dvars support all primitive types

I knew that, but calling getDvar on an Entity still checks the server DVAR. That's the same reason there's a "setClientDvar" function instead of using "self setDvar"
You can tell since "getDvar" and "setDvar" are listed under "global stuff #2" in IS, not "playercmd". Trust me, I've been using IS since it's release =P


Hm.
What about

Code: Select all

Function.SetEntRef(Entity.EntRef);
T = Function.Call<T>("GetDvar", string);


Afaik, this is exactly what Entity.Call does.

It is the same as Entity.Call. Go ahead and try it yourself if you want to see it. That doesn't get an Entity's DVAR, it gets the server's DVAR even when called on an Entity.

Re: [ DEV ] InfinityScript Suggestions

Posted: Sun Feb 07, 2016 2:58 pm
by ~Lambder
You know something I'd really like?
A working destructor for the scripts that gets called right before they are unloaded.

This way, we can do so much more stuff. Too bad it needs some kind of hooking and possibly changing the tekno source.

Re: [ DEV ] InfinityScript Suggestions

Posted: Sun Feb 07, 2016 3:23 pm
by Boboo
Lambder wrote:You know something I'd really like?
A working destructor for the scripts that gets called right before they are unloaded.

This way, we can do so much more stuff. Too bad it needs some kind of hooking and possibly changing the tekno source.


The destructor was working actually when I used it...

Code: Select all

~<Constructor> {...}