Get a sneak peek at whats next for Permanent Hazards on our April 7th Office Hours!
Post by crazycaveman
brandonrossl wrote:Is there a level-3-friendly version of the auto-lock? I can't seem to get it to work and it may be due to the fact that I'm only a level 3.

Thanks!
Just make sure everything is 2 or lower and it should work for you. Just so you know, the version on the wiki is different from the one posted here and should work with any setup; the one posted here will work if you have toolbox installed (I'll update it in a bit)
crazycaveman
US Waze Champs
US Waze Champs
Posts: 856
Has thanked: 226 times
Been thanked: 441 times
Send a message

Post by crazycaveman
I have made a modified version of the min lock bookmarklet to set the locks to the lower of the user's rank or the set lock level for each segment.

Code: Select all

javascript:(function() {

  /* value used is -1 from rank visible in WME */
  /* fwy_lvl = 3 would appear locked at 4 in WME */
  /* can set locks to be null, which will use the auto-lock */
  var fwy_lvl = 3;
  var rmp_lvl = 3;
  var maj_lvl = 2;
  var min_lvl = 1;
  var pri_lvl = 1;
  var absolute = false;
  var count = 0;
  var thisUser = Waze.loginManager.user;
  if (thisUser === null) return;
  var usrRank = thisUser.normalizedLevel;
  var UpdateObject;
  
  if (typeof(require) !== "undefined") {
      UpdateObject = require("Waze/Action/UpdateObject");
  } else {
      UpdateObject = Waze.Action.UpdateObject;
  }
  
  if (fwy_lvl > (usrRank - 1)) fwy_lvl = usrRank - 1;
  if (rmp_lvl > (usrRank - 1)) rmp_lvl = usrRank - 1;
  if (maj_lvl > (usrRank - 1)) maj_lvl = usrRank - 1;
  if (min_lvl > (usrRank - 1)) min_lvl = usrRank - 1;
  if (pri_lvl > (usrRank - 1)) pri_lvl = usrRank - 1;
  
  function onScreen(obj) {
    if (obj.geometry) {
      return(W.map.getExtent().intersectsBounds(obj.geometry.getBounds()));
    }
    return(false);
  }
  
  Object.forEach(W.model.segments.objects, function(k, v) {
	if (count < 150 && onScreen(v) && v.isGeometryEditable()) {
	  /* fwy */
      if (v.attributes.roadType == 3 && (v.attributes.lockRank < fwy_lvl || (absolute && v.attributes.lockRank != fwy_lvl))) {
   count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: fwy_lvl}));
      }
      /* ramp */
      if (v.attributes.roadType == 4 && (v.attributes.lockRank < rmp_lvl || (absolute && v.attributes.lockRank != rmp_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: rmp_lvl}));
      }
      /* MH */
      if (v.attributes.roadType == 6 && (v.attributes.lockRank < maj_lvl || (absolute && v.attributes.lockRank != maj_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: maj_lvl}));
      }
      /* mH */
      if (v.attributes.roadType == 7 && (v.attributes.lockRank < min_lvl || (absolute && v.attributes.lockRank != min_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: min_lvl}));
      }
      /* primary */
      if (v.attributes.roadType == 2 && (v.attributes.lockRank < pri_lvl || (absolute && v.attributes.lockRank != pri_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: pri_lvl}));
      }
    }
  });
})();
crazycaveman
US Waze Champs
US Waze Champs
Posts: 856
Has thanked: 226 times
Been thanked: 441 times
Send a message

Post by crazycaveman
Before, the lock script would simply fail to apply any lock to the roads that were set above the user's rank, but should still have worked at or below their rank.
voludu2 wrote:The remove all extraneous nodes bookmarklet is dangerous right now because of the ABBA reversing bug in WME. -- it is difficult to spot the reversed segments, even for higher-level editors.

And for lower-level editors editing in areas where major routes are unlocked -- this can really mess up waze navigation.
Yes, this is a major bug and should probably be noted on the page, at the very least, so users are aware of the issue. Maybe the toolbox devs would be willing to share their version, which fixes the issue?
crazycaveman
US Waze Champs
US Waze Champs
Posts: 856
Has thanked: 226 times
Been thanked: 441 times
Send a message

Post by crazycaveman
I've updated the segments lock script to lock railroads at 2 and ferries at 5, based on the standard locking template that seems to be gaining momentum.
crazycaveman
US Waze Champs
US Waze Champs
Posts: 856
Has thanked: 226 times
Been thanked: 441 times
Send a message

Post by Fredo-p
tonestertm wrote:I made the text changes, (verify?) but if you were suggesting that adding the other bookmarklet was agreeable, that looks like it's beyond my beginning Wikiskills, with the whole Talk page bit. Maybe I'm just intimidated because I'm still finding my feet in the Wiki, and it's nowhere near as complicated as I'm thinking it is....
Have no fear.....Super Wiki-Man IS HERE!!!!!!!
super wiki man.jpg
(10.47 KiB) Downloaded 997 times
Fredo-p
Posts: 2008
Has thanked: 240 times
Been thanked: 522 times
Send a message

Arizona Wiki | @Waze_Arizona Twitter
Verizon Samsung Galaxy S8+

Post by Fredo-p
Already added the image of the Chrome menu icon. Working on adding some more text to the Chrome instructions. I've been installing non-play store supported scripts into Chrome for some time when playing web browser based games.

There are two different ways to access the Bookmarks Manager. I'll add them both.
Fredo-p
Posts: 2008
Has thanked: 240 times
Been thanked: 522 times
Send a message

Arizona Wiki | @Waze_Arizona Twitter
Verizon Samsung Galaxy S8+

Post by Fredo-p
Done. Check it out and let me know. There is another way of adding bookmarlets, but I have to test it to see.

https://wiki.waze.com/wiki/Bookmarklets#Chrome
Fredo-p
Posts: 2008
Has thanked: 240 times
Been thanked: 522 times
Send a message

Arizona Wiki | @Waze_Arizona Twitter
Verizon Samsung Galaxy S8+

Post by Fredo-p
Never mind. I thought you would be able to highlight the javescript and then drag that entire selection to the toolbar, but it didn't work. Well, that just means Chrome's section is done.
Fredo-p
Posts: 2008
Has thanked: 240 times
Been thanked: 522 times
Send a message

Arizona Wiki | @Waze_Arizona Twitter
Verizon Samsung Galaxy S8+

Post by Fredo-p
Don't know what the hell is going on, but installing these and having them work is hit or miss. I'm having more luck with the drag-n-drop links from Alan vs the scripts on the wiki page. :evil:
Fredo-p
Posts: 2008
Has thanked: 240 times
Been thanked: 522 times
Send a message

Arizona Wiki | @Waze_Arizona Twitter
Verizon Samsung Galaxy S8+

Post by karlcr9911
Hey Crazycaveman - great script! Why the change from PS locking to a 2 to an Auto Lock now? Auto Lock isn't active in the US yet, is it?
karlcr9911
Global Champ Mentor
Global Champ Mentor
Posts: 2587
Answers: 3
Has thanked: 286 times
Been thanked: 1011 times
Send a message