Greasy Fork is available in English.

Neverwinter gateway - Profession Automation

Automatically selects professions for empty slots

< 腳本Neverwinter gateway - Profession Automation的回應

提問/評論

§
發表於:2015-04-23
編輯:2015-04-23

HTML & CSS takeout

Hi out there,
Unfortunately I don't know JS very well - I know it well enough to find valid HTML&CSS code inside, that's all.
Before making the attempt to do some work I wanted to ask first:
Can we take the html and css code out of JS as much as possible? As far as I have seen, we have quite some code which generates the html and css code. Which is, unfortunately, not always valid, and it is quite messy.
I know it would mean a double work in some cases, but ppl like me would then also be able to contribute.
Or we can go the other way: I can give suggestions on HTML&CSS (code) and you can implement it into the script?

My issues so far:
1. The script takes way too much space on screens, very often I have to scale down to see everything.
2. The script is quite difficult to use on smaller touch devices (android).
3. You have lots of in-line style, which makes the application of custom CSS a horror (and almost impossible in most of the cases)
4. While scaled down, some of the buttons are "hard to hit" (because of the scaling I have to tik somewhere else then in the items)

My suggestions so far:
1. We would have to sort the settings somehow
2. Then I could create a html+css draft, which would work good on most devices.
3. We could even implement custom CSS features (including the gateway itself, and not only the bot).

My Idea would to create a bigger button to open a drop-out menu, with an options/button field:

First row:
1. Start/stop script {}
2. Reload script{Apply Options and Custom CSS}
3. Open/Close drop-out menu

Second row:
1. Script Options {
Pause Script,
Enable Debug,
Auto reload,
Attempt to login automatically
}

2. AD Consolidation {}

3. Vendor/Item Options {
Vendor xxxx,
Open Reward Chests
}

Third row:
1. Profession Options {
Purchase resources/Assets
}

2. Profession Settings {
DropDown instead of radio for toon choice,
Profession List
}

Fourth Row:
6. Script CSS {script design options. Like position, size, color}

7. Gateway CSS {Gateway design options}

A tap/click on each of the buttons would activate/deactivate the function or a small window with corresponding options. The window could then appear to the left or bottom of the drop-out menu.

It would look something like this (since I did not find a way to style the html code in here, all in a bad-manner ASCII):

Flattened:
#++++#
#+on+#
#+off+#
#++++#

Expanded:
#+++++++++++# #+++++++++++#
#+.......................+# #+strt+Rel + on +#
#+.......................+# #+stp+appl+ off +#
#+.......................+# #+++++++++++#
#+.......................+# #+scrp+AD+items+#
#+.......................+# #+opts+cons+Bag+#
#+ option panel +# #+++++++++++#
#+ if applicable +# #+Profess+Profess+#
#+.......................+# #+options+Setting+#
#+.......................+# #++++++++++++#
#+.......................+# #+Script +Gateway +#
#+.......................+# #+Design+Des. mod+#
#+++++++++++# #+++++++++++++#

By this way we would get rid of some unnecessary elements, and the settingsPanel would fit on most screens. The bigger button is very important on small devices, like mobiles. It is almost impossible there to hit the pause/option button. And if you manage it - you can't see all the options.
In case of a positive response, I could deliver first code by this weekend.
Best regards

Rotten_mind作者
§
發表於:2015-04-23
編輯:2015-04-23
Hi out there, Unfortunately I don't know JS very well - I know it well enough to find valid HTML&CSS code inside, that's all. By this way we would get rid of some unnecessary elements, and the settingsPanel would fit on most screens. The bigger button is very important on small devices, like mobiles. It is almost impossible there to hit the pause/option button. And if you manage it - you can't see all the options. In case of a positive response, I could deliver first code by this weekend. Best regards

...first, if you do something what make sense, why not add it in script?

I agree many things with you. Im not very familiar with JS/css/Java and most radical updates for script depends contributors.

There is multiple options what can be "hidden" and needs no Buttons,

  • refine AD (no need select this)
  • Autologin (this function has no effect)
  • Vendor rank1( who saves these?)
  • potions are currently usefull only for leveling, but maybe good to have select -buttons
  • Pause -button is needed only on main screen and can be bigger...
  • character names can be fetched with click, but edit screen is good to have because there is some "undefine" -errors(dont know how to get rid of it)

About AD consolidation, banker can be added automatic or use numbers, Im testing how bot runs in TAB's and there I want all automated, this get banker per account,

    // This just set Banker to character 1 if its not him all-ready, only for multiaccounts
    function get_banker(){
        var me = GM_getValue(acc_nro + "nw_charname0",0);
        var banker = GM_getValue("bankchar" + acc_nro,0);
        //console.log(me, banker);
        if (me !== banker) {
            GM_setValue('bankchar'+ acc_nro, me);
            unsafeWindow.location.href = current_Gateway;
            return;
        }
    }

...and at end, if you dont know .js well... it matters not because I have same problem.

Bot itself runs now pretty well and have few problems, if you can make menu better and clean up code, then we must see what what it do... and anyway Github has gadget version of this script so if we decide make it too simplified, then Git offers buttons.

Look this,

https://greasyfork.org/en/forum/discussion/3943/x

, its messy but runs 5 accounts per browser and I stripped most not needed menu items away, but functions are same, and even better.

Rotten_mind作者
§
發表於:2015-04-24

I see it now... I changed "Device" -mode and it is really bad for small device.(using 1920x1080 and you cant see how other devices fail)

I think you know best how to tamper .css and Im looking forward to see changes, just try keep it simple so it will be easier edit later... you never know -"who will maintain script next year" ...

§
發表於:2015-04-24

OK, I will review this code. And I'll try to work a little bit during this WE, so that we might have something to start with.

Rotten_mind作者
§
發表於:2015-04-24
OK, I will review this code. And I'll try to work a little bit during this WE, so that we might have something to start with.

Maybe you its good that you start your own "Private" fork (not public), so that way you can update and if you send link others can grab new stuff for preview... and update to this fork can be done easier.

... take your time, this project is for fun and learning, but code we made affects users computer so we must test them properly and THX for contribution at advance, Cheers!!!

Rotten_mind作者
§
發表於:2015-04-24

Look this, for small device "Log screen" can be better, need just look what to LOG.(just in case you like idea, ;) )

I think I use it on my own version... what is still really difficult to use, ;).

https://greasyfork.org/fr/scripts/1896-nwpb

<img

§
發表於:2015-04-24

I have not yet reviewed the code, but I finished the first preview of my html snippet.....

To preview - just rename from txt to html. I tried to leave the code simple.
All fields are active now. Later we would have to apply/change classes of the elements via Script. The script which should change the classes is not working (yet). And the styles between NGA_Active/NGA_Passive are not adopted. But these are minor issues. ()

Styling goes completely into CSS, no inline style at all.
Later it would allow us to create style options (very easy and fast). So that ppl could move the option button wherever they like. And change other properties of course.

The NGA_Board must be created for each of the options.
I think you can see how much HTML we are getting here.... so I tend to clear devision of style, script and html. Then we can inject all the code. And we can call the JS functions from the html code, like I tried with my changeState().

I have choosen the NGA_ as prefix for all IDs, and classes to avoid compatibility issues now and in future.

Rotten_mind作者
§
發表於:2015-04-25

That sounds great. I will add few things and update main script, if you started allready editing, I can merge your changes or you can grab latest version....

§
發表於:2015-04-25

For me it would be better if you merge my code into yours.
As I told already, my JS knowledge is not enough to do it.
Have you looked at the snipped I uploaded?

Rotten_mind作者
§
發表於:2015-04-25
For me it would be better if you merge my code into yours.
As I told already, my JS knowledge is not enough to do it.
Have you looked at the snipped I uploaded?

...I looked it, but how use it is different thing.

Whole .css block on current is just one big block off code what I try avoid.

...just try add it.

§
發表於:2015-04-25
編輯:2015-04-25

why avoid it? I would rather completely split the code in JS, CSS and html part. Partially it is already split.
So that if you need to change something in special part of the code, you don't have to search among all the code. This would mean double work for cases, where you add certain options in JS, then you would have to add them to HTML and probably style them in CSS part. But this additional work would be done fast.
Right now I am ripping out the JS necessity of my code at all, and finishing the first design. I'll need few hours. Then I will try to "add" it somehow. Probably I will need your help for it.

§
發表於:2015-04-25
編輯:2015-04-25

Can we take the html and css code out of JS as much as possible?

No, we cann't. Because this script is loaded after original gateway web page and insert own html/css to it.

§
發表於:2015-04-25

Can we take the html and css code out of JS as much as possible?
No, we cann't. Because this script is loaded after orginal gateway web page and insert own html/css to it.

How is this related to splitting the code in three different parts? Which has actually already happened partially? We have already an html injection function, and a CSS injection function!?!

To clear up the misunderstanding: I am not suggesting to create three different files! I suggest to have three different sections in one file, as it already is (actually there are more, because we also have the part with images). A section with functionality (JS), a section with style (CSS injected via JS) and a section with content (html, injected with JS).

I hope I could bring some clarification.

§
發表於:2015-04-25
編輯:2015-04-25

Is it not split already for the most part?
Except few inline styles that should really not be there, all the html built in one place.

I think you should check this:
https://github.com/Phr33d0m/NW-Profession-Bot/issues/40

Before going forward. And the git build in general, it's much messier but it uses jquery UI.
It's impractical to separate totally the JS and HTML as the JS builds some HTML structures,
yes, there are many things that can be done better but not total separation.

And about the icons, they probably should be replaced with jquery UI icons in worst case or if it is a problem with touch devices, a jquery UI button with an icon.

Rotten_mind作者
§
發表於:2015-04-25

Well, this script is originally made here, (userscript.org)

https://greasyfork.org/en/forum/discussion/3768/x

And if we continue talking "how things must be better" then I want this bot builded with GeckoFX or similar, but that will not happen because I cant do that....

So if there is improvement, code refactoring, code clean up, then make changes... and if I refuse update this script then just launch new fork for it, it is free to take and we are free develop it better like we do here.

Well, it looks that messy script got some clean up, yes? :)

§
發表於:2015-04-25
編輯:2015-04-25

true.... all true..... I am working.... sick right now, so can spend only few time for it.
I will try to finish the code as much as possible and explain everything there in comments.
Just one question: which script should I take to "upgrade"? I just need some, to know which items to include.
Right now I use for reference: https://greasyfork.org/en/forum/discussion/3943/x

And just one more questions, it would be nice to have a skype contact of some of you. I have lot's of questions......

Rotten_mind作者
§
發表於:2015-04-25

Well, that is my short lived dream to make TAB´s work, :(... they do work but each TAB needs own cookie so TAB's became individual, you need Multilogin, then you need TAB redirect to open multiple TAB´s... then it work but it will not serve users, because it is hard to handel.

Also some information should be written Local storage so it will not corrupt GM or maybe all info but user/pass should not be in GM.(UI is much harder than these)

Main page script is best use as reference, because it will be place where changes go.

...but script are mainly same.

I checked few other Fork -script as reference and saw that there is much to do, just need learn some skills...

§
發表於:2015-04-25

I suggest you try for yourself and decide,
It's either this one
(https://greasyfork.org/en/scripts/7061-neverwinter-gateway-professions-robot)
Or a different variation with the same origin:
https://github.com/Phr33d0m/NW-Profession-Bot

Rotten_mind作者
§
發表於:2015-04-26
...snip... ..snap...

Code refactoring or some improvements for script, Im interested if you can look how we can store Next Finishing job to GM and use it to launch that specific account later and how to switch accounts on same browser window.

Same code is usefull for Git -build too because it started after version 1.10.0, thx to MAC-NW.

https://greasyfork.org/en/forum/discussion/2544/x

§
發表於:2015-04-26

Step by step.... I am fighting right now with some kind of acceptable HTML code, which will fit the needs of the script users. Simultaneously testing my misbirths of style. And I am completely lost right now in the look up of JS code, which generates the HTML code now. So that I can somehow integrate it.
While I could deliver the very first snippet in few hours, I will need one or two weeks (around 30min/day) to deliver updated version if I work alone.
And actually I would really need help.

Rotten_mind作者
§
發表於:2015-04-26

About using same browser to look over multiple accounts...

Simple version is just add counter + logout and some safety checkers that logout happens.

Improved version...

  • current script log in account and check character task dates and know "who is next"

Now we just reuse functions and replace character to account... some rework must be done to avoid "infinite loops" (what I did multiple times when testing without plans).

But it looks much better than multiple TAB -runs!

§
發表於:2015-04-26

few questions so far, concerning the script:
1. I would like to implement a choice of professions for each slot, instead of a profession list and a number inside. Pros: you can exactly tell which slot should be used for what, and even leave certain slots free; 9 drop-down menus take far less space, then the current (growing?) list of professions.
Could someone adopt the script to work with that? Instead of the professions list?
2. We have a "save" button. But as far as I know, JS can react/change on interaction (the so called AJAX). We would need adaptation in this direction too.
3. The html code used is a little bit weird (probably because of the huge amount of authors), and sometimes not valid. I am preparing my code for easy script processing. I would need help in implementation, and clearance of old code.

For the one tab-multi acc running script - Rotten_mind, you got my idea! And actually the accounts form is the next one I will start to work on.

§
發表於:2015-04-26

Here is the first beta. Download, rename to .html and check it out.
The color design is ugly, but good enough to review it.
No JS code implementation so far. I am done for today.

Rotten_mind作者
§
發表於:2015-04-26
編輯:2015-04-26

Well, it is small and if like LXDE or other lightweight desktop, why not.

...get code and copy paste here , http://cssizer.com/ so you see it, hmmm.

Tested that "log in log out", just problem with log out what delays, so need find good way get out from account and then simple account loop works.

Script just count++ to GM and get next account number, log in do task count++ and log out, after count reach account count, set count 1 and continue... but it is not smooth operation because gateway wont disconnect you when you want.

發表回覆

登入以回復