|
||
|
|
#1 (permalink) |
|
Forum Expert
|
making a setting file for any SET of scripts, is quite easy. It has been used on some scripts, such as dupres tokens. I used it in my race system, token system, and a few other things i scripted. Yes, it might be a tad sloppy, and a little un-needed, but also, when you use a setttings script, you can change many factors, for many many many scripts, by changing one line.
How to do it: First off, we will say, this script defines hue. Now, for the public class, generally you should have this match or be the subject of the setting file, so you dont get confused. Now. the way this works, is Very basic. The public class: The public class Csetting defines Which file csetting is, so that Chue=2971 may be located later on. How you can call upon the custom hue in other files : Hue = Csetting.Chue; This settings system, may be usefull to larger scripts, or systems, that have alot of different items. I like to use the "hue" feature, shown in this script, to keep orginization, so when players see that hue, they know it is something to do, with the overall system. using System; using Server; using Server.Network; using Server.Items; <--- Hue for items will be used using Server.Mobiles; <--- Hue for Mobiles will be used namespace Server.Misc { public class Csetting { public static int Chue=2971; //////2971 indicates hue } } I am getting back into c# again, do not flame, as i will ignore your post and let you think you are tough.
__________________
Northern Born, Livin in the ghetto Last edited by nomad707; 01-03-2006 at 06:29 AM. |
|
|
|
|
|
#2 (permalink) |
|
Forum Expert
Join Date: Sep 2002
Location: Houston, Texas
Age: 22
Posts: 3,933
|
Unless you'd be loading settings from a file, its better to use public const int for these types of variables. Whenever the script is compiled and integer is read as being constant, the compiler will make sure that in other parts of the code no attempt is made to alter its value.
|
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Sep 2002
Age: 23
Posts: 1,472
|
Just so you know, most of your "using" statements are not necessary. You would need to put:
using Server.Misc; ... on any script that you wanted to use your CSetting class with, like below: Code:
namespace Server.Misc
{
public class CSetting
{
public const int BODBlack = 0x497; // which may or may not be the correct hue, its been a while...
}
}
Code:
using Server.Misc; ... this.Hue = CSetting.BODBlack; Or: Code:
this.Hue = Server.Misc.CSetting.BODBlack; |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|