Jump to content
The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades. ×

[Script Command] getdconst & setdconst 1.0.0


1 Screenshot

About This File

First of all, yes, I know that this break the "const" concept, but I really miss "static values" in script engine.

Yes, I know that we can use $vars but it's a lot pretty using const logic.

If you don't know what is a "const", open your db/const.txt file

In the end of file, you can add something like this:

X_VALUE%TAB%1005

And now, you can call X_VALUE in any script and the script will know that X_VALUE is not a player script, it's a """"global"""" variable, so you can call it with or without a player attached.

And now we came to my commands.

getdsconst allow you to get a constant dynamically like getd.

For sample:

.@var = getdconst( "X" + "_" + "VALUE" );

This would return 1005.

And now with setdconst we can change those as well.

setdconst( "X_VALUE", 2020 );

Remember, when you restar t your server, this constant will be 1005 again!
 

Here another sample script:

prontera,150,150,5	Script	CommandsTest	90,{

	.@const$[0] = "SWORDCLAN";
	.@const$[1] = "ARCWANDCLAN";
	.@const$[2] = "GOLDENMACECLAN";
	
	for( ; .@i < getarraysize( .@const$ ); .@i++ )
		mes "Contant Value of ["  + .@const$[.@i] + "] is " + getdconst( .@const$[.@i] );
	
	next;
	
	mes "I will now, change all const values to +1";
	
	for( .@i = 0; .@i < getarraysize( .@const$ ); .@i++ )
		setdconst( .@const$[.@i], getdconst( .@const$[.@i] ) + 1 );
	
	close;
}

 

  • Like 1

×
×
  • Create New...