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: 1960
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

The enum command.

Post by Yukiko » Thu Mar 23, 2017 8:56 pm

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?
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

User avatar
CWO
POL Expert
Posts: 1118
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Re: The enum command.

Post by CWO » Fri Mar 24, 2017 2:22 am

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: 1960
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko » Fri Mar 24, 2017 8:00 pm

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.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

User avatar
CWO
POL Expert
Posts: 1118
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Re: The enum command.

Post by CWO » 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

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
Grandmaster Poster
Posts: 295
Joined: Fri Feb 20, 2009 8:30 pm

Re: The enum command.

Post by RusseL » Fri Mar 31, 2017 9:37 am

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: 1960
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko » Fri Mar 31, 2017 9:01 pm

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. :)
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

User avatar
CWO
POL Expert
Posts: 1118
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Re: The enum command.

Post by CWO » Mon Apr 03, 2017 2:02 am

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: 1960
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko » Fri Apr 07, 2017 8:14 pm

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. :)
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

User avatar
CWO
POL Expert
Posts: 1118
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Re: The enum command.

Post by CWO » Sat Apr 08, 2017 1:31 am

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: 1960
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: The enum command.

Post by Yukiko » Sun Apr 09, 2017 7:27 pm

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 :)
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests