cprop on cfg files

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 097.
Note: Core 097 is no longer officially supported.

Moderator: POL Developer

Post Reply
phao
Grandmaster Poster
Posts: 129
Joined: Fri Aug 31, 2007 2:25 pm
Location: Brazil

cprop on cfg files

Post by phao » Sun Oct 14, 2007 1:53 pm

how can I add a cproped array into an item, using cfg file?

item id
{
...
cprop name XXXXX
...
}

what do i have to 'put' instead of XXXXX ?
and for dictionaries ?

User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey » Sun Oct 14, 2007 5:29 pm

Actually I don't know if it's the official way or even a sensible way, but if I want to store an integer onto an itemdesc item I do this:
CProp skillreq i101
The cprop name of skillreq has an integer value of 101. The i means the value is integer.


But of course, you would only want to do this if this value is likely to change. For a constant, better to create a property in itemdesc:
skillreq 101
and then use some cfg file functions to read it.

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

Post by Yukiko » Mon Oct 15, 2007 5:54 pm

I took a moment to search through the items.txt file in \pol\data to see how the system represents arrays as CProps.

Here are a couple examples I found. Please remember that syntax is very important when manually placing arrays as CProps.

Example number 1:
CProp Children a3:i1816821i1816232i1816715
This is an array of of three (3) integers. Note the a3: indicating the size of the array and the corresponding three integers eache delimited (seperated) by an 'i'.

Example number 2:
CProp Junk a3:S6:ActiveS6:ActiveS6:Active
This is an array of three (3) strings. Note the a3: followed by the three strings defined by the 'S'. The number after each 'S' is the length of the string it is defining, ie. S6:Active - the word 'Active' is six characters long.

I hope this is helpful.

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

Post by CWO » Tue Oct 16, 2007 12:15 pm

Unless you absolutely HAVE to, don't put CProps in cfg files. If the prop will never change, its better to just make a custom entry in the cfg because CProps coming from cfgs take up substantially more memory because it adds that CProp to every item thats made as opposed to just keeping it once as a reference in that file.

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

Post by Yukiko » Tue Oct 16, 2007 5:50 pm

Very good point CWO.

When I have used them I try to have any scripts that used them remove them when they are no longer needed

Duttones
Apprentice Poster
Posts: 54
Joined: Tue Mar 27, 2012 8:56 pm

Re: cprop on cfg files

Post by Duttones » Wed Apr 04, 2012 1:50 pm

How do I create a dictionary with CPROP?

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

Re: cprop on cfg files

Post by Yukiko » Thu Apr 05, 2012 4:21 am

Here's an example of a Dictionary written out as a CProp:

Code: Select all

CProp	%Resistances% d5:S4:Coldr0S6:Energyr0S4:Firer0S8:Physicalr387S6:Poisonr0
The CProp name is %Resistances%
It's a dictionary with 5 entries - d5
The first entry is a string with a length of 4 bytes - S4
The string literal is 'Cold' with a real value of 0 - r0

The second entry follows immediately after as indicated by the S6 defining that string's length and so on until all 5 entries are defined.

I assume you were asking how to create a dictionary CProp manually. Naturally when you save a dictionary typed variable on an object using SetObjProperty the core handles all the formatting. As CWO noted above it is best whenever possible to avoid having CProps predefined in itemdesc.cfg files.

Duttones
Apprentice Poster
Posts: 54
Joined: Tue Mar 27, 2012 8:56 pm

Re: cprop on cfg files

Post by Duttones » Thu Apr 05, 2012 5:13 am

Thanks a lot!

Post Reply