Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu May 08, 2008 10:32 am   

Priorities bug?
 
Can someone explain the priorities to me? When I reimport via XML my priorities are all whacked. If I do reset priorities it starts from a random place from 10 to whatever number. My prompt trigger is always 1 but it ends up being like 4000 something after I reset priorities and a random variable with a name starting with C became 10.


Last edited by oldguy2 on Thu May 08, 2008 5:35 pm; edited 1 time in total
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu May 08, 2008 10:57 am   
 
You'll want to check the XML and make sure that a priority value is given. If one's not, or if it's set to create a new setting (I believe either the priority or id is -1 for that) you'll end up with different priority numbers for them when you re-import.

From your post in the other thread, it sounds like some of your priorities are ending up as 0, which is obviously a bug, and for that we'll really need a proper procedure to get it to fail. It's important to do this because "Export Selection" is different to the plain "Export" option, which is different to copying and pasting. So we need to know exactly what you did.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu May 08, 2008 5:14 pm   
 
Fine.

1. Open untitled session.
2. Create a module and name it TestModule.
3. Create an alias in the module and name it test with a value of:

Code:
#loop 10 {#var test%i true}


4. Go to view and sort by priority and look at the priority numbers.
5 Now click and drag all those new variables to the module and watch as the priority of every single one becomes 0.


1. Open untitled session.
2. Create a module and name it TestModule.
3. Create an alias in the module and name it test with a value of:

Code:
#loop 10 {#newvar test%i true}


4. Click on the module and export selection.
5. Close Cmud and repopen it, then import the module into an untitled session.
6. Go to view and sort by priority and none of the priorities show up.
7. Create some other setting and you will see a priority by it.
8. Go to edit and reset priorities and you will see all new priority numbers.

If you look at the XML of TestModule, the id numbers number 1 through 12.

1. Create a Test package and import the TestModule via XML. The priorities don't show when you view priorities. 2. Drag all the settings out of the TestModule to the Test package and all the priorities become 0. View the XML of Test package and the id numbers are fine.
3. Go to edit and reset priorities and you will see new priority numbers.


I'm not sure how to recreate what happens in my package unless you created a huge test module or something.

I'm not sure if they even matter. The only place priorities are mentioned in manual is the following.

Priority
This is the order in which triggers are executed. The smaller priority numbers are executed first. CMUD automatically adds space between priority numbers to make adding new triggers more efficient. So you shouldn't normally care about the exact priority numeric value. It's usually easier to drag/drop triggers in the main settings tree view to change priorities relative to other triggers.

1. Create a Class folder and name it whatever.
2. Create a test trigger outside of the class and look at it's priority.
3. Drag it to the new class and it shows a priority of 0.
4. Now create another new trigger inside the class and it has priority 150.

I created 3 other test triggers in the class and dragged them outside the class and they all became priority 10...


http://img.photobucket.com/albums/v455/amphibian/Piorities.png
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu May 08, 2008 5:39 pm   
 
Bump. Come on programmers can't you just look at this and tell me what is wrong? I'm not a programmer. Razz
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Thu May 08, 2008 5:47 pm   
 
If i select multiple items at once with Shift + click and move them to the module together, priorities are numbered according to the group size (0-(x-1)).
_________________
Discord: Shalimarwildcat
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu May 08, 2008 5:52 pm   
 
Priorities really shouldn't matter unless it is a trigger, or a button.

For triggers if you want to force one trigger to fire before another then set its priority to be lower, or set the one you want to fire next to a higher priority.
For buttons you can set the order that the buttons are displayed via the priorities.

For everything else the priority number is pretty useless.

Triggers that have the same priority number get executed in a random order. Well, not EXACTLY random, undefined would be a better term.
That being the case I suppose that buttons may display in a random order if they have the same priority number. I've never tried this though.

As to WHY this is happening only Zugg might know. But it should NOT be happening so as Fang said it is likely a bug.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu May 08, 2008 5:58 pm   
 
Variables and Aliases (and some other settings) do not have Priority values because they are not needed. Only items that need a certain order use the priority field, such as triggers, buttons, and menu items.

When CMUD creates a new setting, it needs to ensure that it has a higher priority value than anything else. So CMUD keeps track of the total number of settings in your database and sets the priority of a new setting to this number times ten. So yes, if you have 13 variables and then create a new trigger, the trigger will have a priority of 140 (because it's the 14th setting added to the file).

Reset Priorities just loops through all settings and sets their priority ten greater than the previous setting. The Reset Priorities command doesn't know whether a setting needs a priority value or not. So variables end up with priority values that they don't need.

I'll take a closer look at your procedure when I get back next week to see if it's causing any real problems, but I think you are worrying about this too much. It doesn't matter what the absolute priority value of a trigger is, as long as the relative order of the triggers is correct. Just sort the settings editor by priority and drag/drop triggers into the order that you want. Ignore the fact that the priority values are displayed and can be edited...you shouldn't need to worry about the exact values. CMUD never guarantees that it will keep the exact priority values the same, only that it will keep the order the same.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net