 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
| Author |
Message |
Marilla
Joined: 02 Feb 2006 Posts: 329
|
Posted: Tue Jun 13, 2006 2:00 am Post subject: |
|
|
It wouldn't be difficult to write a quick program to scan all .src and .inc files in a directory, and look for the existence of the functions defined in each module.
It'd just have to have arrays of the function names. As it scans the lines, it should check if any of the functions from any of the modules exists. If so, it marks a bool variable for that module, and stops checking for that particular one.
At the end of the file, it would consider each of the use statements it needs, and see if they exist already in the file. If not, it would add them.
If they decide to go this route, which I support, I'll write up a quick C program to do this, and post the source and Windows binaries. It'll just be 'drop it in and run it', and viola'; all done.
For the record, changing from := to = would be even easier, though I'm not sure if they intend to do that part. (I like the idea myself, as it seems more consistent with other languages.) |
|
 |
|
|
 |
 |
| Author |
Message |
Yukiko
Joined: 02 Feb 2006 Posts: 1094 Location: Southern Central USA
|
Posted: Tue Jun 13, 2006 3:08 am Post subject: |
|
|
I agree that it would be easier to convert from ':=' to '=' but my point really was that there are so many changes that take place with new versions that it is overwhelming.
From POL 92 to 94:
local and global declarations were deprecated to var but the compiler still handled them with a warning..
GetSkill() was removed entirely. Skill refs were changed from numbers to text based attributes. This in and of itself required major script revisions.
Those are what I remember but there were more.
Now from 94 to 95 from the upgrade notes file:
| Quote: |
Deprecated constructs will give compile warnings. Your script will still compile with them, but will not in POL096.
"local", "global", and "dim" are deprecated in favor of "var"
"begin" and "end" are deprecated, meaning the "do-while" loops are deprecated. Use "repeat-until" with reversed logic.
"=" should now be "=="
"account.SetAcctName()" should now be "account.SetName(name)"
"obj . ("member_name")" has been removed. use obj.get_member("member_name") and obj.set_member("member_name")
Script Data Structures
---
Structs:
You cannot access structs with array notation, i.e. struct_var[2]. You may have scripts that access members in this way. You must change it to access the members by name, i.e. struct_var.Member_Name or struct_var["Member_Name"]. Member names are case-insensative.
Dictionaries:
Checking if a key exists: if ( dict[key] == error ) now becomes: if ( dict.exists(key) )
Arrays:
In array declarations, it is illegal to have a trailing ",". For example: var b := array{1, 2, 3, }; will not compile.
Containers
---
Insert/Remove Scripts:
Change the parameter lists for all your CanInsert and OnInsert scripts:
where the 'program' directives used to look like this:
program CanInsert( mob, container, adding_item )
program OnInsert( mob, container, adding_item )
they now look like this:
program CanInsert( mob, container, movetype, inserttype, adding_item, existing_stack, amt_to_add );
program OnInsert( mob, container, movetype, inserttype, added_item, existing_stack, amt_to_add );
if you want a really easy conversion from POL092-style Can/OnInsert scripts, change the program directive and add
this at the beginning of your 'program' section:
if (inserttype != INSERT_ADD_ITEM)
return 1;
endif
Change the parameter lists of CanRemove and OnRemove to:
program can_remove(mob, container, item, movetype)
program on_remove(mob, container, item, movetype)
Script functions that add/move/delete items to/from containers will call that container's canInsert, onInsert, canRemove, and onRemove scripts (where appropriate, i.e. if MoveItemToContainer first moves an item out of the original container, caRemove and onRemove will be called). As always, if canInsert or canRemove returns 0, the function WILL FAIL to move/add/delete. ALWAYS check the return value of an core function for an error!
Note 'mob' may be uninitialized in these scripts if a core function performed the item move and the container was not owned by any mobile.
Constants for movetype and inserttype can be found in UO.EM.
Note that OnInsert and OnRemove scripts are now run-to-completion (they used to be scheduled with other scripts).
In particular, this means they can no longer sleep.
The container limit defaults have been changed: Containers will default to limits as specified in servspecopt.cfg (if not defined, defaults: 150 items, 250 weight). MaxItems and MaxWeight properties in the container's itemdesc.cfg entry will override these defaults.
Config Files
---
You must add this to itemdesc.cfg:
Container 0xFF02
{
Name WornItemsContainer
graphic 0x1E5E
Gump 0x003C
MinX 0
MaxX 66
MinY 0
MaxY 33
Weight 0
MaxItems 65535
Maxweight 65535
}
Set Weapon 0xF020 to SaveOnExit 0.
xlate.cfg is no longer used, so any item "aliases" you may have (for example "gc" for "garlic") will no longer be converted to an objtype. In these cases, you must add an itemdesc.cfg entry for them.
The default last Skill ID is 49, and you must provide a skills.cfg entry for each skill ID. You can change the max skill id in uoclient.cfg, i.e. "MaxSkillID 48"
NPC Ai Scripts
---
There is no longer a default range for EnableEvents. To make your NPCs respond to Speech events, add an appropriate range parameter to the EnableEvents calls for SYSEVENT_SPEECH.
.props text command
---
.props is no longer an internal text command.
|
Now that is just from one version to another. Understand I am not saying that some changes are not good but everytime you add one more THING to the changes necessary to be compatible with a new version you make more work for the scripters. My point is if it ain't broke, don't fix it. We are all used to the ':=' for assignment statements. If it works leave it alone. |
|
 |
|
|
|