Game interface improvements / GreaseMonkey

Feedback, questions and general discussion regarding Nile Online
ArmEagle
Posts: 327
Joined: Sun Nov 30, 2008 8:34 am
Contact:

Game interface improvements / GreaseMonkey

Postby ArmEagle » Mon Dec 29, 2008 11:09 pm

Change of command:
I (ArmEagle) have gone Immortal (as third) on Theoris, after I was done on Sabah a while ago. I leave the GreaseMonkey script in the hands of Pegasus, who has been a great help in the past.
You can keep using this thread as before though.

Download The Grease Monkey script here (updated to directly link to Pegasus' website).



Information
I have been reading the forums a bit though and read about some suggestions some players had and I also had some things I thought could be done better. I had been using Firefox' extension GreaseMonkey before with some other sides for only small adjustments. So I started tinkering around with this game too. And after some time I had quite a bit of features that I started sharing with my friends. Now I've come so far that it would be a shame not to let other players use it too.

Below you'll see a complete list of features. But let me just clarify that all this script does is altering the interface. In some cases it does some calculations based on information retrieved from different sections of the page. But nowhere it automates or communicates with the game server. Just to be sure I asked Reed for his permission and just a bit ago he said this script would be ok.

Yes, features are just a little bit further down. But first an introduction to GreaseMonkey. This Firefox extension lets you write code in JavaScript that alters a page 'after' it has loaded. Some other browsers (like Opera, the only one I also test the script with) support 'Userscripts' directly (has to be downloaded and put in the right directory manually - I thought Opera detected it automatically, but it doesn't.).

You can add DOM elements and even add JavaScript to the webpage to be executed used after certain actions. And the latter is what most of my script does. The largest part of the script is simply scanning the page every few seconds to see whether anything has changed (I have to do this since I can't hook into the actual update JavaScript from the game itself. So you'll see a short 'flicker' whenever a part of the page updates, since in a second my scripts alter the default look again).


So far for all the technicalities, here is the list of features:
  • Labels for all plots showing the plot name, level and (max) workers.
    (Had to change z-index ordering of several elements to make these labels
    always show on top. Because of that groups of citizens, etc, could show
    above buildings where they should not. This is fixed for the 4th group,
    but I never leveled a city past 9, so I can't tell past that.)
    This can be disabled in the Options panel in the top left.
  • Clicking on all resources now opens the first plot making that item.
  • Similarly added buttons (to the left of the cities bar) to direct link
    to the Warehouse and Exchange. (Long nome+city names would wrap, now
    limiting the width and preventing wrapping.)
  • At each resource a 'timer' is added.
    -- When this resource is (said to be) used more than produced this will show
    the time till you run out of the item.
    -- When the net production is positive this will show the time until the
    warehouse will be full (or 'infinity' if this is greater than 500 days)
    -- This will not show when the warehouse is being upgraded because then it is
    too difficult to retrieve the warehouse level.
  • Similarly the upgrade and found city windows will show you how long till each
    resource is completed for you to upgrade.
  • With v0.40 the found city window had this market overview added. But the data
    wasn't styled for easy reading. This is now re-parsed into a list ordered by
    the 'relatively' cheapest resource.
    -- Also added a button (next to Market/Exchange) to show the found city screen
    for your current city.
    *** NOTE *** I did NOT test what happens when you try to found a city ***
    *** 'over' your current city. Do NOT try to! ***
  • The 'new scroll' animated icon isn't very clear. When a new scroll is
    received the background of the city window will light up. And optionally
    an alert will popup (blinking the browser when inactive - default: off).
  • Changed the server clock (upper right corner) to use a more accurate way
    of keeping the server time (by default this has a skew).
  • In the nome view window you can enter nome coordinates instead of only
    nome names now.
  • If 'Barracks' isn't at the start of the title, remove it (shows just
    'Archers/Charioteers/Spearmen (x/y)').
  • Made small-caps for Scribe Wall optional since the game changed it to normal
    with v0.47 (last part of the CSS code near the end), as suggested by shasamrat.
    This is optional and you have to set WALL_SMALL_CAPS to true, just below here.
    -- Added a config option to keep the Small Caps if wanted.
  • By default Scribe Wall text is bold again now. Change with WALL_BOLD.
  • Like with Warehouse limits, same for Exchange (Ships) and Palace (Laborers) to
    reach the limits.
  • Added time left display of minutes.
    -- Coloring time left red when <1h and orange when <48h.
  • Can set the market 10% bread tax in the Found City Market Overview by setting
    MARKET_OVERVIEW_TAX to 1.1. By default it is 1; basic resource cost.
  • Also added a tooltip to the ordered listings explaining what each part means.
  • Showing the basic production bonus next to the [!].
  • The script should now be working with Monument sites.
  • The transports overview now lists the totals of incoming goods (and added to city stock in parenthesis).
  • Changed my 'Exchange' icon to a new one in a city. One half opens the Exchange normally. The bottom part opens the Exchange and then switches to the 'To Monument' view.
  • In the Exchange and Trade forms you can now click on a resource icon. That will toggle that resource's background color. This can be used to set per city what resources you should not trade away. (Sometimes I or friends would send out gold in a gold:emeralds trade where they were supposed to send out the emeralds and get the gold)
  • Thanks to Pegasus added the option to toggle between time left or limit of resources.
  • Added the option to ask for confirmation on trades with other people
  • In this update I added the start of something completely NEW!: Store Trades
    - In the trade windows with other people a new button is added 'Store Trade'. This gathers all data from the form and stores it (in a cookie - thus amount of stored trades is somewhat limited, but you'll be warned).
    - I added a new button which opens a new window that lists all your stored trades per city.
    - - You can deleted them with the [x] on the right.
    - - Or open the stored trade in a trade window with the icon on the left.
    *** You don't have to be your the trade's 'source' city, the trade will automatically take place from the right city (see the amount of ships) when you submit. But after that the game will switch to that city.
    - - I do plan to add some more features, like setting a note, a 'timer' and make this work for your inter-city trades.
  • Added an overview window (access trough the new Horus' Eye button). This shows an overview of resource production, laborers and plot levels
  • Added access keys to the tabs of Scribe Wall, Game Log and my Overview window. The access keys are 1-3.
    Based on your browser and settings they require a different mod-key (ctrl/&alt/&shift) to be held down while being pressed. I don't think 1-3 will cause any issues with default browser behavior. But you can easily disable it in the options window.
    Thanks go to Kosminhotep for suggesting this.
  • In a Bandits Outpost window you can set that outpost, which allows the use of the new button on the resources 'Units' list header. Then clicking that will open said bandits outpost directly. This allows for easy contribution of troops from any city or monument, without having to go trough all the nomes.
  • In a Bandits Outpost window each player's contributions are calculated to show the rewards in luxury goods and bread they'll receive. It also shows the percentage of the current total 'donation' for each contributor (counting charioteers double). And it shows the percentage of completion of each type of troop.
  • Added a toggle 'Include Transports'. If enabled this will include incoming resources for the upgrade UI and Overview with the stored amounts (if you've viewed the Transports window of course). For the upgradeUI this does not take transport times into account for the time estimates. The toggle does not auto-update the view.
  • When trading on the Scribe Wall, you have to click the player name to get their list of cities to send your ships. This moved you away from the Scribe Wall. I now scan the Scribe Wall chat and replace the link that opens the player profile and show the important (trade) details in a small popup now. For easy use it closes on any link click.
  • You can now set words that will highlight a row in Scribe Wall (click 'Wall Highlights' in the options box to configure). The background of the row will be colored red and the amount of 'hits' is shown in the top right. You can use this to hilight for your own name, friends, or specific goods. (See these comments in the code for more configuration options)
  • On the market showing the relative price of goods to their production cost, like in the city founding screen.
  • Using the same configuration option as for the plot labels, the nome view show labels for cities and monuments now too.
  • When enabled ('Movable UI' in the options), you can drag around the Scrolls Box, Allies Manager, Papyrus Scroll and (other) Trade Window (after ctrl-clicking to toggle dragging). The positions are stored between sessions. Some of these windows are re-styled to make them take less space. Shift-click the elements to toggle their size.
  • Added a filter option to the Game Logs. No fancy search options/combos, but you can search for both text in the log entries, as well as the transported resources.
  • You can directly open the Transports window of a city or monument by shift-clicking it's icon. That will also change the bottom UI. This way you can quickly get the script to scan all production and incoming goods. This is handy for getting all resource data for the Overview window, saving half the clicks and even more time.
  • As has been suggested some time ago, I added a button to the Labor Tool. This will show and set the amount of laborers needed to (at least) break-even production of the resource, for all resources but Limestone. For Bread, Bricks, Baskets and Pottery this tries to set the used resource to BEP instead.
  • Changed all repeating scans into hooked functions (hooked into the game's functions).
  • The Immortality cost is parsed for completion (time) now too. But only when you view it in a level 22 palace.
  • Coloring required warehouse level green or red based on whether you meet the requirement (when the warehouse level is known, else it stays unchanged).
  • Showing total bread value (and amount of orders) in your sell orders list (in parenthesis in the header).
  • Added a toggle that lets you show the resource production in a day instead of just one hour.
  • When you have the (compose) mail form open (to the trade contact) while storing a trade, the Stored Trade entry will now have a mail icon. Next time you send such a Stored Trade, a pre-filled mail will show up after the trade window closed. You only have to submit the mail yourself then.
  • The Labortool form was a weak slave, submitting to nothing from the textfield. Now it acts like the "Apply" link. Now you can adjust the number in the textfield and press Enter to apply.

(Screenshots by Aloarath and me)
You do not have the required permissions to view the files attached to this post.
Last edited by ArmEagle on Fri Jun 19, 2009 12:01 am, edited 65 times in total.
Reason: change of command

ArmEagle
Posts: 327
Joined: Sun Nov 30, 2008 8:34 am
Contact:

GreaseMonkey / script installation help

Postby ArmEagle » Mon Dec 29, 2008 11:21 pm

So, there are bound to be some people that don't know how to use this script.

  • First, if you use Firefox, get GreaseMonkey from here ("Add to Firefox"). Opera supports userscripts by itself. I haven't tried other browsers.
  • Then browse to http://armeagle.nl/pno-GMscript.user.js and let the popup install the script.
  • From then on you should be able to update the script by just going to that URL and install again. Though some people have reported duplicate installs after updating. Then just RMB-click the monkey icon, and remove the oldest one (or just both and reinstall).

Feel free to post here for any questions!
Last edited by ArmEagle on Tue Feb 10, 2009 2:42 am, edited 1 time in total.

homegrown
Posts: 232
Joined: Fri May 14, 2004 10:21 pm
Location: Houston TX

Postby homegrown » Tue Dec 30, 2008 1:42 am

I use this and recommend it wholeheartedly.

Alaorath
Posts: 157
Joined: Mon Nov 03, 2008 7:04 pm
Location: Alexandria, Ratjaw (-46)

Postby Alaorath » Tue Dec 30, 2008 1:50 am

Really great job. I like the time estimates on resource use.

I updated the arrays for the warehouse (up to level 15):

Code: Select all

   // warehouse limits for resource groups up to level 15
    var warehouseLimits = new Array(
                                    new Array('Clay Wheat Reeds', new Array(1250, 2500, 4000, 7000, 10000, 15000, 20000, 26000, 34000, 50000, 60000, 70000, 85000, 100000, 120000, 150000)),
                                    new Array('Bricks Baskets Pottery', new Array(300, 500, 800, 1400, 2000, 3000, 4000, 5200, 6800, 10000, 12000, 14000, 17000, 20000, 24000, 30000)),
                                    new Array('Bronze Cedar Limestone Kohl Henna Leather Oil Emeralds Gold', new Array(300, 500, 800, 1400, 2000, 3000, 4000, 5200, 6800, 10000, 12000, 14000, 17000, 20000, 24000, 30000)),
                                    new Array('Sandals Sculpture Cosmetics Perfume Jewelry', new Array(125, 250, 400, 700, 1000, 1500, 2000, 2600, 3400, 5000, 6000, 7000, 8500, 10000, 12000, 15000))
                                    );

BLU3Y3Z
Posts: 346
Joined: Wed Nov 19, 2008 9:31 pm

Postby BLU3Y3Z » Tue Dec 30, 2008 2:24 am

Wait am confused this wont mess up our citys right

shasamrat
Posts: 549
Joined: Sat Nov 22, 2008 3:48 am
Location: chandi and srina of Osirisant (116S), dibru of Bastreffer (115S), koopa of Bastkhai (106S)

Postby shasamrat » Tue Dec 30, 2008 2:45 am

I've never monkeyed with GreaseMonkey. Can you show us some screenshots so I know whether it's something I want to try? Also, can these be separated into several different processes and run simultaneously so if people like some features, but not all, they can apply just their favorites (if it's possible)?

I think that it's just awesome that someone is developing these features. The plot labels, particularly, sound quite useful. And when I can wrap my head around it, I think I'd love to try it out. Congrats!

Yama
Posts: 2
Joined: Mon Dec 01, 2008 7:19 am

Postby Yama » Tue Dec 30, 2008 3:50 am

I'd say get off the fence and give it a try.

It has worked well for me - I think its great!

Alaorath
Posts: 157
Joined: Mon Nov 03, 2008 7:04 pm
Location: Alexandria, Ratjaw (-46)

Postby Alaorath » Tue Dec 30, 2008 5:17 am

"shasamrat" wrote:I've never monkeyed with GreaseMonkey. Can you show us some screenshots so I know whether it's something I want to try? Also, can these be separated into several different processes and run simultaneously so if people like some features, but not all, they can apply just their favorites (if it's possible)?

I think that it's just awesome that someone is developing these features. The plot labels, particularly, sound quite useful. And when I can wrap my head around it, I think I'd love to try it out. Congrats!

Think of it as an overlay, it modified the look and feel.

As for customizing modules, the code is in the original post, it is well commented and fairly easy to figure out.

Here's a couple screen captures:
You do not have the required permissions to view the files attached to this post.

shasamrat
Posts: 549
Joined: Sat Nov 22, 2008 3:48 am
Location: chandi and srina of Osirisant (116S), dibru of Bastreffer (115S), koopa of Bastkhai (106S)

Postby shasamrat » Tue Dec 30, 2008 5:50 am

Thank you, Alaorath! A little busy, but turnoffable, so I'm getting off that fence. ;) Thanks, ArmEagle!

Salaman
Posts: 15
Joined: Mon Aug 16, 2004 11:37 am

Postby Salaman » Tue Dec 30, 2008 12:03 pm

Brilliant!
I sent over 25 ships full of goodies to express my thanks.

ArmEagle
Posts: 327
Joined: Sun Nov 30, 2008 8:34 am
Contact:

Postby ArmEagle » Tue Dec 30, 2008 12:34 pm

"Salaman" wrote:Brilliant!
I sent over 25 ships full of goodies to express my thanks.


Thank you very much! :)

Now to address some other worries:

The script does add an options box to the top left of the page. That toggles the two most interfering things:
- Plot labels (requires a manual refresh of the city)
- New scroll alert

I did separate several other parts in the code, and somewhere near the top of the script you could disable other parts if you'd really want to. Though it might have some unforeseen consequences.


Thanks for posting those screenshots Aloarath. I guess I should have done that myself. I'll put them in my first post if you don't mind.

Script Update
  • Dec 30: Updated warehouse limits up to level 15 as given by Aloarath
  • Oops, small mistake in the CSS part, fixed.
Last edited by ArmEagle on Tue Dec 30, 2008 7:28 pm, edited 5 times in total.
Reason: small fix to script

Salaman
Posts: 15
Joined: Mon Aug 16, 2004 11:37 am

Postby Salaman » Tue Dec 30, 2008 11:23 pm

I assume one has to come ack here and download the latest version to stay up to date?

Zuberi
Posts: 82
Joined: Tue Dec 09, 2008 2:18 pm

Postby Zuberi » Tue Dec 30, 2008 11:48 pm

If you click on the version number in the Options box, you can check to see if you have the latest version. If not, you copy and paste the text into greasemonkey, hit refresh, and you're good to go.

ArmEagle
Posts: 327
Joined: Sun Nov 30, 2008 8:34 am
Contact:

Postby ArmEagle » Tue Dec 30, 2008 11:50 pm

"Zuberi" wrote:If you click on the version number in the Options box, you can check to see if you have the latest version. If not, you copy and paste the text into greasemonkey, hit refresh, and you're good to go.


Yes, I forgot to mention that. And I kinda forgot all about that link even. I'll just replace the attachment with the link.

Anodyne
Posts: 11
Joined: Wed Nov 12, 2008 8:45 pm
Location: Raoltz 63N / Setshabew 66N

Postby Anodyne » Wed Dec 31, 2008 3:37 am

Interesting, nice work.

I made a simple little Greasemonkey script to remove the all-caps styling from the chat window. I find it more readable. If anyone wants it, you can grab it from here.
Last edited by Anodyne on Sat Jan 03, 2009 4:39 am, edited 1 time in total.
Reason: Fixed Link

Blood Wolf
Posts: 1
Joined: Wed Dec 31, 2008 4:10 am

Postby Blood Wolf » Wed Dec 31, 2008 4:15 am

very nice job, u definitely put some effort into it. when i am able, i will donate to ur cause.

ArmEagle
Posts: 327
Joined: Sun Nov 30, 2008 8:34 am
Contact:

Postby ArmEagle » Wed Dec 31, 2008 6:04 am

"Anodyne" wrote:Interesting, nice work.

I made a simple little Greasemonkey script to remove the all-caps styling from the chat window. I find it more readable. If anyone wants it, you can grab it from here.


Hmm, that seems to 404, though the error is a bit weird. But I think I got the idea; simply setting font-variant to normal for .logentry. So I just decided to add that to my script too. The small-caps didn't really bother myself. But I did hear some friends about it. So:

Script Update
  • Dec 31: Removed small-caps for Scribe Wall chat (last part of the CSS code near the end), as suggested by Anodyne. Feel free to remove it if not wanted.

shasamrat
Posts: 549
Joined: Sat Nov 22, 2008 3:48 am
Location: chandi and srina of Osirisant (116S), dibru of Bastreffer (115S), koopa of Bastkhai (106S)

Postby shasamrat » Wed Dec 31, 2008 7:59 am

Thanks! I've gone and installed it and am LOVING it so far. Except, I do like the small caps. I see the part of the code, but I'm not sure how much of it controls that function. Is it all of this? Or can someone just quote me the section of it to remove?
/* Disable small-caps for Scribe Wall chat */
.logentry {
font-variant: normal !important;
}
]]></r>;
document.getElementsByTagName('head')[0].appendChild(newstyle);
}

Is it true I can temporarily disable the function, but leave the script in there if I want it later by putting slashes in front of it, also?
Last edited by shasamrat on Wed Dec 31, 2008 8:24 am, edited 1 time in total.

ArmEagle
Posts: 327
Joined: Sun Nov 30, 2008 8:34 am
Contact:

Postby ArmEagle » Wed Dec 31, 2008 12:27 pm

"shasamrat" wrote:Thanks! I've gone and installed it and am LOVING it so far. Except, I do like the small caps. I see the part of the code, but I'm not sure how much of it controls that function. Is it all of this? Or can someone just quote me the section of it to remove?

Is it true I can temporarily disable the function, but leave the script in there if I want it later by putting slashes in front of it, also?

EDIT

Script Update
  • Dec 31: Made the non-small caps configurable. Look for NO_SMALL_CAPS near the top of the script.
Last edited by ArmEagle on Wed Dec 31, 2008 2:06 pm, edited 2 times in total.

Sema
Posts: 43
Joined: Fri Nov 28, 2008 9:47 pm

Postby Sema » Wed Dec 31, 2008 1:25 pm

Very, very, very cool! I love it, thanks a lot!
I especially love the removal of the small caps font. No squinting anymore to read a player's name properly!
Highly recommended!

Gruß,
Sema


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest