Zell Posted April 4, 2020 Group: Members Topic Count: 53 Topics Per Day: 0.01 Content Count: 412 Reputation: 266 Joined: 04/25/12 Last Seen: Monday at 01:30 PM Share Posted April 4, 2020 View File [Script Command] getdconst & setdconst 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; } Submitter Zell Submitted 04/03/2020 Category Source Modifications Video Content Author Zell 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.