The enum command.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

The enum command.

Post by Yukiko »

I was asked by someone what the enum command does. So I pointed him to Racalac's eScript guide to which he replied that he couldn't find reference to it in the guide. I looked and I didn't see it either. So I explained what it does. Should it be included in the guide and if so can someone add it?

My explanation was that it is used to enumerate a long list of constants without needing the declaration CONST preceding each constant. Is that correct?
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: The enum command.

Post by CWO »

Yes that's exactly what it's for. You can also have a name for the group of constants without needing a comment for better readability.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko »

Thanks CWO.

It's good to know I got something right. ;)

I still think it should be documented somewhere in Racalac's guide under Variable Declaration and Assignment; Arithmetic.
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: The enum command.

Post by CWO »

But see, knowing stuff that's not in guides or in the documentation is what makes us "experts" at POL :D

another thing that should be in the guide is the ability to use constants as options. Something I've used quite a bit in some of my scripts...

Code: Select all

use uo;
use os;

const DEBUG := 0;

program GetSerialNumber(who)
     SendSysMessage(who, "Get serial number for who?");
     var other := Target(who);
     if (DEBUG)
     // The compiler will omit the entire existence of this IF statement so POL doesn't have to evaluate it
          SendSysMessage(who, "Debug Message");
     endif
     SendSysMessage(who, CStr(other.serial));
endprogram 
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: The enum command.

Post by RusseL »

CWO wrote: Fri Mar 31, 2017 4:16 am But see, knowing stuff that's not in guides or in the documentation is what makes us "experts" at POL :D
You can't have it all in the docs... these are just a highlevel developers tricks ... :D
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko »

CWO I never thought of doing that. It's reminiscent of a compiler directive but at the programming level. It also saves on time deleting all those lines of debug messages. ;)

Right Russel. :)
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: The enum command.

Post by CWO »

Some of mine were even worse than just DEBUG though... I wrote an entire AI system in an include which contained many optional things like better pathfinding, pathfinding through teleporters, melee/spellcaster/ranged, heal other NPCs, etc, and all of my AI scripts were just const declarations turning these options on or off.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko »

You are making me envious CWO. I'm curious, and I know it's off-topic, but did you base your shard on a particular script set, ie. WoD, POL Distro etc. or did you create it from scratch as they say? And if you ever want to release it to the community I'm sure we would all appreciate it. :)
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: The enum command.

Post by CWO »

I'm not sure what my original shard was actually based on. Probably a mix of many different scripts since my shard went through a whole mess of developers over the years before I took over. I was writing a new server from scratch since my vision of a a UO shard was well beyond what our scriptbase would handle (so many times I would add something good but it would expose tons of problems elsewhere). I had about 60% or so complete but with work and other commitments along with my shard's population dying out, I eventually stopped developing it.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko »

I understand. I've not had many players lately plus a strange bug has popped up that I can't fix. I've had my server online even though there's been virtually, if not actually, no players. That and this damned bug have me close to just pulling the plug. The problem is I love programming in eScript :)
Post Reply