|
|
|
HV Script Thread, Discuss your creations. Includes guidelines and infos for script creation (2020-02-28 upd) |
|
Jan 26 2014, 18:29
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10
|
QUOTE(Ichy @ Jan 27 2014, 01:33) On topic: would it be possible to add a hotkey for skill chaining in mouse melee? Hitting hotkey will launch skill 1, 2 3 on chosen target once.
That's semi-automation. >.>
|
|
|
Jan 26 2014, 18:49
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
QUOTE(Kagoromo @ Jan 26 2014, 15:41) Can MouseMelee be modified to add the following function?
Use the skill Defend if the mouse cursor touch the right edge of screen/browser. Whether or not the script continue to use the skill despite still having Defend's buff is adjustable.
Yes. ...Unfortunately, I don't really have the time. Maybe copy the code for stance onto defend? @Ichy: Hm. Rapid-fire of skills no matter what would definitely be no-no. 'Readying' the highest skill when holding down a certain hotkey or hovering over certain part of monster would be okay, though.
|
|
|
|
|
|
Jan 26 2014, 19:12
|
Amaduyu Mitsumi
Group: Gold Star Club
Posts: 1,609
Joined: 2-October 11
|
The button is kinda too far and too small for such a regularly used skill though. Deep inside of Hellfest, I may use Defend up to 3 - 4 times every round; I also use Defend at the first turn of every new round. It's become somewhat reflexive for me, so being able to use it through the gesture I described would be very convenient. It can't be helped if you are busy though. (IMG:[ invalid] style_emoticons/default/happy.gif) This post has been edited by Kagoromo: Jan 26 2014, 19:13
|
|
|
|
|
|
Jan 26 2014, 20:08
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
Quickbar hovering is kind of useless if you don't use any CSS to restyle the page, but I assume everyone uses some anyway due gems and stuff.
Most of the time for this sort of stuff goes on testing and figuring out things, really - probable best way to solve your request would be to make an invisible element that floats to the right and add a mousemove on that, but that is not perfect either.
In general of those skills, I used to use focus as a mage deep inside normalfest, alongside with stun/sleep. Reaching close to 1900 was nice, but it wasn't worth the time taken compared to just using, say, stance. Perhaps consider quitting hellfest where you have to constantly defend so you can get more rewards?
This post has been edited by Lement: Jan 26 2014, 20:12
|
|
|
|
|
|
Jan 26 2014, 20:11
|
Ichy
Group: Catgirl Camarilla
Posts: 13,061
Joined: 19-February 09
|
you can always hotkey your mouse buttons.
I did it for everything I need so I only need the left hand for Riddlemaster.
|
|
|
Jan 26 2014, 20:18
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10
|
QUOTE(Lement @ Jan 27 2014, 05:08) Most of the time for this sort of stuff goes on testing and figuring out things, really - probable best way to solve your request would be to make an invisible element that floats to the right and add a mousemove on that, but that is not perfect either.
Or you can just use [ developer.mozilla.org] MouseEvent.clientX/clientY to check for relative coordinations to, say, <body>, This post has been edited by holy_demon: Jan 26 2014, 20:19
|
|
|
Jan 27 2014, 01:36
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
Still has to find a) the edge of the window and b) 1.30+ actually used saving the mouse position, until the latest version which removed it to avoid code injection/additional delay from the listener.
|
|
|
|
|
|
Jan 27 2014, 04:00
|
Amaduyu Mitsumi
Group: Gold Star Club
Posts: 1,609
Joined: 2-October 11
|
Development hell? (IMG:[ invalid] style_emoticons/default/faint.gif) QUOTE(Ichy @ Jan 27 2014, 01:11) you can always hotkey your mouse buttons.
I did it for everything I need so I only need the left hand for Riddlemaster.
Ichy's suggestion will do I think. Though it seems that HV Keybinds doesn't support mapping to mouse buttons, and SpellSpam can't spam Defend.Wait, SpellSpam can spam Defend. I assigned Defend as the right click action, and it only works correctly if I right click inside the battle message box. Right clicking outside of that box brings up the browser's context menu. Is that intended? This post has been edited by Kagoromo: Jan 27 2014, 04:06
|
|
|
|
|
|
Jan 27 2014, 07:53
|
ceawhadsf
Newcomer
Group: Members
Posts: 59
Joined: 28-March 13
|
@Lement With the mouse melee I can't seem to make it not attack regardless of what I set the HP MP SP values to. Also i assume that the decimal values are percentage of total health. With the compiler thingy I set the HP MP SP values to .99 Also if i change "!Notalright" to false it quits running otherwise nothing i change will make it stop. Don't know if that helps
This post has been edited by ceawhadsf: Jan 27 2014, 08:34
|
|
|
|
|
|
Jan 27 2014, 11:22
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10
|
QUOTE(Kagoromo @ Jan 27 2014, 13:00) Development hell? (IMG:[ invalid] style_emoticons/default/faint.gif) Ichy's suggestion will do I think. Though it seems that HV Keybinds doesn't support mapping to mouse buttons, and SpellSpam can't spam Defend.Wait, SpellSpam can spam Defend. I assigned Defend as the right click action, and it only works correctly if I right click inside the battle message box. Right clicking outside of that box brings up the browser's context menu. Is that intended? Yep it's intended, and I did document it in my release feature. Since you can assign skill/spell to even left click, I need to restrict the area it will work, or else it would be more annoying than convenient. Alternatively, with that set-up, you can right click on monster to use Defend @Lement: I have a question about addEventListener. Which one would be more optimal in HV? Adding multiple event Listener to multiple elements, or just one eventListener to document.body and use event.target? [ stackoverflow.com] Stackoverflow has the answer and it says it's a trade-off between compile-time and run-time. In HV's context, what do we prefer? This post has been edited by holy_demon: Jan 27 2014, 11:31
|
|
|
|
|
|
Jan 27 2014, 14:02
|
Owyn
Group: Members
Posts: 692
Joined: 12-May 10
|
>faster setup time I suppose because after each click or monster hit or anything .html page of battle is reloaded again, - so all scripts would run again and need to do event bindings again, and after it's done those could only be fired once (then page would reload again)
|
|
|
Jan 27 2014, 14:08
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
@ceawhadsf: Huh. That's a serious bug. Mind telling the browser/OS you're using and posting the compiled code/compilation options?
NotAlright is essentially a compilation of the HP/MP/SP readers.
This post has been edited by Lement: Jan 27 2014, 14:09
|
|
|
|
|
|
Jan 27 2014, 21:48
|
animeai
Group: Members
Posts: 620
Joined: 18-November 09
|
I'm no good with javascript - let's get that straight XD I know very little about it (and would be a lot more at home in php lol) but apparently with jquery you can simulate keypress events. I'm looking to get something that will let me add buttons to use scrolls, infusions etc. Since i use mousemelee being able to do everything with just one click of the mouse (instead of going to items, then clicking the right scroll) would be ideal. Ultimately I'm thinking about having a right click menu but that's a long way off XD. For now I'm just looking to add a single button for the scroll in s1 (keypress shift-f1) once I get that working it's simple to add the rest of the buttons. CODE // ==UserScript== // @namespace hentaiverse.org // @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js // // @grant unsafeWindow // // ==/UserScript==
$(".f1").click(function() { var e = jQuery.Event("keydown"); e.which = 112; // # F1 code value e.shiftKey = true; // Shift key pressed $("input").trigger(e); });
The question is, how do I turn this function into a clickable button? How would I insert it into this code (and would this code work!)? CODE var drawscrollone = function() { var div_scrollone = document.createElement("div"); div_scrollone.id = "s1"; div_scrollone.style.cssText = "display: block; position: absolute; top: 4px; left: 900px; border: 1px solid rgb(97, 88, 248)"; div_scan.classList.add("ui-state-default", "ui-corner-all"); var iconscrollone = div_scrollone.appendChild(document.createElement("div")); iconscrollone.style.cssText = "height: 22px; cursor: pointer; background-color: rgb(238, 50, 59); color: white; font-weight: bolder; font-size: 15px;"; iconscrollone.textContent = "A"; document.querySelector(".stuffbox.csp").appendChild(div_scan); iconscrollone.onclick="[jquery keypress function]"; }; drawscrollone();
|
|
|
|
|
|
Jan 28 2014, 00:34
|
ceawhadsf
Newcomer
Group: Members
Posts: 59
Joined: 28-March 13
|
Build identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 (from about: page) It is firefox 27 portable test. GreaseMonkey ver 1.14 and windows 7 64. i'm going to go through and update the plugins try different browser / version. But my guess is the script isn't reading the HPMPSP values but i am not smart enough to figure out how to check for that. CODE var HPMPSP = document.getElementsByClassName('cwbt1'); var HP = HPMPSP[0].children[0].children[0].innerHTML.split('/');HP = parseFloat(HP[0])/parseFloat(HP[1]); var MP = HPMPSP[1+(HPMPSP.length>3? 1: 0)].children[0].children[0].innerHTML.split('/');MP = parseFloat(MP[0])/parseFloat(MP[1]); var SP = HPMPSP[2+(HPMPSP.length>3? 1: 0)].children[0].children[0].innerHTML.split('/');SP = parseFloat(SP[0])/parseFloat(SP[1]);
function gid(x){ return document.getElementById(x); } var Notalright = HP<0.99||MP<0.99||SP<0.99; if(Notalright){ gid('monsterpane').setAttribute('style', 'border:2px solid #'+(111111 +8800*(SP<0.99 ? 1 : 0)+88*(MP<0.99 ? 1 : 0)+ 880000*(HP<0.99 ? 1 : 0))+ ';'); }
function CurrentMon(){ var returnvalue = Math.round(1+(parseInt(document.defaultView.getComputedStyle(gid('ta_monster_1'), null)['top'])-29)/58-0.2); if(returnvalue<1){ if(!(sessionStorage.CurrentMon)){ return 'HOVERFIRST'; } else return sessionStorage.CurrentMon; } sessionStorage.CurrentMon = 'mkey_'+(returnvalue % 10); return 'mkey_'+(returnvalue % 10); } function AmOverMonster() { return document.defaultView.getComputedStyle(gid('ta_monster_1'), null)['visibility'] == 'visible'; } function YEAH(HoverTurn) { if(document.querySelector('*:hover')==null||HoverTurn){ if(HoverTurn&&(document.querySelector('div.btm1:hover')==null)){ sessionStorage.lastActAttack=0; } } else if(!HoverTurn){ var switchedMon=document.querySelector('div.btm1:hover'); if(switchedMon==null){ sessionStorage.lastActAttack=0; } else { sessionStorage.CurrentMon = switchedMon.getAttribute('id'); sessionStorage.lastActAttack = 1; } } var u = setTimeout(function(){YEAH(HoverTurn)},100); } function HoverAttack(){ var HoverAttacked = false; var HoveredControl = AmOverMonster(); if(!Notalright)if(HoveredControl||(sessionStorage.lastActAttack==1)){ var iXie = CurrentMon(); if(iXie!='HOVERFIRST'){ if(gid(iXie)){ if(gid(iXie).hasAttribute('onclick')){ sessionStorage.lastActAttack = 1; YEAH(HoveredControl); gid(iXie).click(); HoverAttacked=true; } } } } if(!HoverAttacked){setTimeout(function(){HoverAttack()}, 100);} }
function HB(HoverWhat){ if(gid(HoverWhat))gid(HoverWhat).setAttribute('onmousemove','sessionStorage.lastActAttack=0;'+gid(HoverWhat).getAttribute('onclick')); } HB('ikey_p');
HoverAttack();
|
|
|
|
|
|
Jan 28 2014, 01:14
|
animeai
Group: Members
Posts: 620
Joined: 18-November 09
|
XD Your link doesn't work - you must have a different number of posts per page or something. Found it with this though https://forums.e-hentai.org/index.php?s=&am...t&p=3018231Looks like you're re-using the actual HV built in javascript - I did try that but must have typoed something >_> time for another try!
|
|
|
Jan 28 2014, 02:02
|
Felipons
Newcomer
Group: Members
Posts: 40
Joined: 19-October 09
|
Update for my script of my resize window script Last VersionNew: Now its working on Chrome When you resize the window it automatically resizes dont need to do a postback Correction of some bugs... OLD 1.0.0 :
ChangePageStyle.User.zip ( 1.3k )
Number of downloads: 81
OLD 1.0.5 :
Change_Page_Style_1.0.5.User.zip ( 1.73k )
Number of downloads: 80
This post has been edited by Felipons: Dec 7 2021, 21:42
|
|
|
|
|
|
Jan 28 2014, 02:38
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
@ceawhadsf: The same code you gave works fine in Firefox 25/Lubuntu 13, I immediatelly get a border upon casting HS. Quick search shows that Firefox 27(for devs) has some notable javascript reworking. As for checking what it is parsing reading the HP value from, try writing,say, CODE alert("This is the HP element in HV: " + document.getElementsByClassName('cwbt1').children[0].children[0].innerHTML); on 5th line. I assume mousemelee doesn't break down completely, which would be case if it didn't understand the code. @animeai: What you're thinking of is better done by CSS - see the link "Pots" in my signature for an example. There are also native HV hotkeys for pots, infusions and scrolls in case you didn't know -F1-12 for pots, iirc +Shift for Scrolls and +Ctrl for Infusions(not that anybody uses infusions in battle). Right-click for a menu is pretty rad idea though. Too bad I would never use it, though - way too slow. This post has been edited by Lement: Jan 28 2014, 02:42
|
|
|
|
|
|
Jan 29 2014, 14:28
|
Razor320
Group: Members
Posts: 220
Joined: 17-October 13
|
CODE var HPMPSP = document.getElementsByClassName('cwbt1'); var HP = HPMPSP[0].children[0].children[0].innerHTML.split('/');HP = parseFloat(HP[0])/parseFloat(HP[1]); var MP = HPMPSP[1+(HPMPSP.length>3? 1: 0)].children[0].children[0].innerHTML.split('/');MP = parseFloat(MP[0])/parseFloat(MP[1]); var SP = HPMPSP[2+(HPMPSP.length>3? 1: 0)].children[0].children[0].innerHTML.split('/');SP = parseFloat(SP[0])/parseFloat(SP[1]); This should be correct. Tested on Firefox. CODE var fields = document.getElementsByClassName("cwbt"); var stats = []; for (var i = 0; i<3; i++){ stats[i] = fields[i].textContent.split("/"); stats[i] = parseInt(stats[i][0])/parseInt(stats[i][1]); } var HP = stats[0], MP = stats[1], SP = stats[2]; ( Notice, that JavaScript doesn't have an integer variable type. For any number double precision float is used.) CODE var HoverAttacked = false; ... if(!HoverAttacked){setTimeout(function(){HoverAttack()}, 100);} 'HoverAttacked' is unnecessary - setTimeout executes only once. CODE gid('monsterpane').setAttribute('style', 'border:2px solid #'+(111111 +8800*(SP<0.99 ? 1 : 0)+88*(MP<0.99 ? 1 : 0)+ 880000*(HP<0.99 ? 1 : 0))+ ';'); It is not necessary to use 'setAttribute' for standard attributes, like 'style' or 'className'. Any integer can be transformed to string with 'toString()' or 'toString(radix)' methods. For example: CODE var b = 100; var h = b.toString(16); //h now contains "64" This post has been edited by Razor320: Jan 29 2014, 14:38
|
|
|
|
|
|
Jan 29 2014, 15:23
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12
|
QUOTE(holy_demon @ Jan 27 2014, 11:22) @Lement: I have a question about addEventListener. Which one would be more optimal in HV? Adding multiple event Listener to multiple elements, or just one eventListener to document.body and use event.target? [ stackoverflow.com] Stackoverflow has the answer and it says it's a trade-off between compile-time and run-time. In HV's context, what do we prefer? As a rule, compile time is better than run-time for HV, because we want our scripts to load fast enough to be able to smoothly override HV hotkeys, especially with things like addEventListener, and also because we don't stay very long on any single page as opposed to most javascript more complex javascript usages you might encounter. But for you, in this case specifically? Run tests. Browsers can vary a lot. Razor320: There are not always only 3 cwbt elements - if you're on low health, the flashing of it is done by layering another HP with different color on top of it and changing the opacity. Also, setTimeout executes multiple times, not once, because it is inside HoverAttack(), thus executing itself - 10 times a second, in fact. HoverAttacked is to stop that once you attack so you don't have two loops executing at the same time 10 times per second. This sort of delay can be somewhat resource-intensive on slower computers or older browsers. As for setAttribute, feel free to use plain .style when it works. I mostly did too, until I ran into some weird bug on working on this code, so I changed all to setAttribute. As for the toString thing, you're missing that if you add together "111111", "8800" and "880000", you get "111111880088000" instead of 999911 if you used just numbers. This post has been edited by Lement: Jan 29 2014, 15:23
|
|
|
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
|
|
|
|
|