 |
 |
 |
HV Script Thread, Discuss your creations. Includes guidelines and infos for script creation (2020-02-28 upd) |
|
Feb 3 2014, 06:20
|
Lement
Group: Members
Posts: 2,977
Joined: 28-February 12

|
@Ichy: I have not read Owyn's code but iirc it was adapted from Dan's code which cuts out a bit that isn't truly necessary in firefox due them being different browsers.
It not working in chrome is ...expected behavior.
@holy_demon: Not really all that surprised, since it loaded before page as loader in the page. Cool though.
@Owyn: 10b releases new patch. New patch has new js features or something. Code bugged to high heaven.
Also, wasn't your issue with chrome adblock?
This post has been edited by Lement: Feb 3 2014, 06:21
|
|
|
|
 |
|
Feb 3 2014, 06:42
|
Colman
Group: Gold Star Club
Posts: 7,333
Joined: 15-November 10

|
QUOTE(holy_demon @ Feb 2 2014, 09:44)  when I worked with AJAX, I have this idea of using ajax to send battle action, instead of simulating click. Basically what I have in mind is like this: - every 250ms, raise "action" flag - if mouse/keyboard event is fired, and "action" is true, send an AJAX to initiate an action, "action" flag becomes false. - every 1s, reload current page with the most recent AJAX response. Basically you just keep attacking without waiting for the server to response, therefore eliminating any ping disadvantage, and maintaining the 4 action/s The downside is that you might "beat the dead horse" at most 3 times before page reload and tells you that the target is already dead, and any sort of emergency situation will be known to you 3 turns later (IMG:[ invalid] style_emoticons/default/tongue.gif) Of course you can increase the 250ms interval to make it safer I did a small test and it pretty much works, I can do ~4 action/s with my shitty ping of 500ms Illegal? Too OP and shouldn't be made public? Legal? Too risky I think. I will just wait for official 4 actions/s patch.
|
|
|
|
 |
|
Feb 3 2014, 06:48
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(Colman @ Feb 3 2014, 15:42)  Too risky I think. I will just wait for official 4 actions/s patch.
Wait, so that future patch will let you play at 4 action/s regardless of ping? Or you still need Godly ping to get that fast? This post has been edited by holy_demon: Feb 3 2014, 06:48
|
|
|
|
 |
|
Feb 3 2014, 09:54
|
Usagi =
Group: Gold Star Club
Posts: 2,923
Joined: 29-October 13

|
QUOTE(holy_demon @ Feb 2 2014, 09:44)  when I worked with AJAX, I have this idea of using ajax to send battle action, instead of simulating click. Basically what I have in mind is like this: - every 250ms, raise "action" flag - if mouse/keyboard event is fired, and "action" is true, send an AJAX to initiate an action, "action" flag becomes false. - every 1s, reload current page with the most recent AJAX response. Basically you just keep attacking without waiting for the server to response, therefore eliminating any ping disadvantage, and maintaining the 4 action/s The downside is that you might "beat the dead horse" at most 3 times before page reload and tells you that the target is already dead, and any sort of emergency situation will be known to you 3 turns later (IMG:[ invalid] style_emoticons/default/tongue.gif) Of course you can increase the 250ms interval to make it safer I did a small test and it pretty much works, I can do ~4 action/s with my shitty ping of 500ms Illegal? Too OP and shouldn't be made public? Legal? Oh this would be great especially on lower difficulty, as for beating dead horses, you can rotate between 4 targets to avoid it. Can you link to some stuff about this?
|
|
|
|
 |
|
Feb 3 2014, 10:31
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(LOL50015 @ Feb 3 2014, 18:54)  Oh this would be great especially on lower difficulty, as for beating dead horses, you can rotate between 4 targets to avoid it.
Can you link to some stuff about this?
Well I just have to keep moving the mouse or faceroll the number key to prevent beating the deadhorse The functions I tested was this (I'm not putting in the interval and flag part because I'm still unclear about the legality of this) CODE function postAJAX(values) { var xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST", "http://hentaiverse.org/", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.responseType = "document"; xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState >= 2) { xmlhttp.abort(); } } xmlhttp.send(values); }
function postAttack(target) { postAJAX("battleaction=1&battle_targetmode=attack&battle_target=" + target + "&battle_subattack=0"); }
That's only normal attack. for magic and skill, I haven't properly implemented yet, but the gist of it should be like this CODE function postAttack(target, spellId) { postAJAX("battleaction=1&battle_targetmode=magic&battle_target=" + target + "&battle_subattack="+ spellId); }
you can get the spellId value from the spell's onmouseover attribute This post has been edited by holy_demon: Feb 3 2014, 10:32
|
|
|
|
 |
|
Feb 3 2014, 10:44
|
Razor320
Group: Members
Posts: 220
Joined: 17-October 13

|
holy_demon, that is from my script (inline difficulty changer, based on XMLHttpRequest), it is better to send all form elements, instead of specifying hardcoded string with parameters. CODE function misc_construct_request_line(mf){ var line = ""; for (var i = 0; i<mf.length; i++){ if (mf[i].type == "radio"){ if (mf[i].checked) line += ((line.length > 1) ? "&":"") + mf[i].name + "=" + encodeURIComponent(mf[i].value); } else { line += ((line.length > 1) ? "&":"") + mf[i].name + "=" + encodeURIComponent(mf[i].value); } } return line; }
Just pass form element to this function.
|
|
|
|
 |
|
Feb 3 2014, 14:53
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(Razor320 @ Feb 3 2014, 19:44)  holy_demon, that is from my script (inline difficulty changer, based on XMLHttpRequest), it is better to send all form elements, instead of specifying hardcoded string with parameters. CODE function misc_construct_request_line(mf){ var line = ""; for (var i = 0; i<mf.length; i++){ if (mf[i].type == "radio"){ if (mf[i].checked) line += ((line.length > 1) ? "&":"") + mf[i].name + "=" + encodeURIComponent(mf[i].value); } else { line += ((line.length > 1) ? "&":"") + mf[i].name + "=" + encodeURIComponent(mf[i].value); } } return line; }
Just pass form element to this function. Why don't you just use FormData? And parse the form element, instead of its children
|
|
|
|
 |
|
Feb 3 2014, 15:01
|
Razor320
Group: Members
Posts: 220
Joined: 17-October 13

|
I've tried. No luck, seems, that hv doesn't respect requests with multipart data. QUOTE ... And parse the form element, instead of its children I would appreciate, if you show me how. This post has been edited by Razor320: Feb 3 2014, 15:03
|
|
|
Feb 3 2014, 15:49
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(Razor320 @ Feb 4 2014, 00:01)  I've tried. No luck, seems, that hv doesn't respect requests with multipart data.
I would appreciate, if you show me how.
Yeah, just tried it, it doesn't work on HV. Anyway, I just discovered that Form element can be used as both numbered array and associative array. So, screw FormData :/ EDIT: just realise another issue, directly messing with the battleform element makes interacting with interaction on the actual page :/ This post has been edited by holy_demon: Feb 3 2014, 15:56
|
|
|
|
 |
|
Feb 3 2014, 16:06
|
Colman
Group: Gold Star Club
Posts: 7,333
Joined: 15-November 10

|
QUOTE(holy_demon @ Feb 3 2014, 12:48)  Wait, so that future patch will let you play at 4 action/s regardless of ping? Or you still need Godly ping to get that fast?
I think 10B is working on something like make HV only refresh part of page which can make the reload faster. Not sure can it make the action per load stacked yet.
|
|
|
|
 |
|
Feb 3 2014, 16:31
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(Colman @ Feb 4 2014, 01:06)  I think 10B is working on something like make HV only refresh part of page which can make the reload faster. Not sure can it make the action per load stacked yet.
Well, that means he is going to implement asynchronous request, ie. AJAX. And, unless he changes the logic of his back-end script, it'd pretty much accomplish the same thing I'm trying to do Can you link me to that post so I can clarify on it? This post has been edited by holy_demon: Feb 3 2014, 16:32
|
|
|
|
 |
|
Feb 3 2014, 16:55
|
Dan31
Group: Members
Posts: 4,399
Joined: 26-March 12

|
QUOTE(Colman @ Feb 3 2014, 15:06)  I think 10B is working on something like make HV only refresh part of page which can make the reload faster. Not sure can it make the action per load stacked yet.
Yeah, he said something about planning to use some Ajax for HV battles. Imagine: no reload necessary, and only what changed between two actions is transmitted to the player and updated by the interface. Since there is much less info transmitted, I bet Derpy will be taking a looooong vacation away from the HV servers when that happens (not that I see him often since the throttling). It's only just planned though. No tell about when that will happen. And it's not that easy to do in the first place.
|
|
|
|
 |
|
Feb 3 2014, 17:04
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(Dan31 @ Feb 4 2014, 01:55)  Yeah, he said something about planning to use some Ajax for HV battles. Imagine: no reload necessary, and only what changed between two actions is transmitted to the player and updated by the interface. Since there is much less info transmitted, I bet Derpy will be taking a looooong vacation away from the HV servers when that happens (not that I see him often since the throttling).
It's only just planned though. No tell about when that will happen. And it's not that easy to do in the first place.
So it's perfectly legal for me to implement AJAX userscript right? Gonna include it in next SpellSpam release (IMG:[ invalid] style_emoticons/default/tongue.gif) This post has been edited by holy_demon: Feb 3 2014, 17:06
|
|
|
|
 |
|
Feb 4 2014, 01:08
|
Dan31
Group: Members
Posts: 4,399
Joined: 26-March 12

|
QUOTE(holy_demon @ Feb 3 2014, 16:04)  So it's perfectly legal for me to implement AJAX userscript right? Gonna include it in next SpellSpam release (IMG:[ invalid] style_emoticons/default/tongue.gif) Uh, yeah, if you have the time. It won't change anything for the server if it's done with a userscript, but I guess it would be interesting to experiment with. Implement the AJAX part in a separate script, too. It will likely break about any other script running during battle, btw.
|
|
|
|
 |
|
Feb 4 2014, 02:47
|
Cats Lover
Group: Gold Star Club
Posts: 2,800
Joined: 18-April 13

|
QUOTE(holy_demon @ Feb 3 2014, 23:31)  Well, that means he is going to implement asynchronous request, ie. AJAX. And, unless he changes the logic of his back-end script, it'd pretty much accomplish the same thing I'm trying to do
Can you link me to that post so I can clarify on it?
Here: https://forums.e-hentai.org/index.php?s=&am...t&p=2891881QUOTE(Tenboro @ Nov 6 2013, 05:34)  QUOTE(hihohahi @ Nov 5 2013, 09:27)  The battle screen (while battling with monsters) has to reload every turn (constant blinking..), can using Ajax make that better? just reload the things that change, not the whole page.
It's forthcoming, when I have the time and inclination. Yes, when he has the time and inclination. (IMG:[ invalid] style_emoticons/default/rolleyes.gif)
|
|
|
|
 |
|
Feb 4 2014, 03:47
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(Dan31 @ Feb 4 2014, 10:08)  Uh, yeah, if you have the time. It won't change anything for the server if it's done with a userscript, but I guess it would be interesting to experiment with. Implement the AJAX part in a separate script, too.
It will likely break about any other script running during battle, btw.
AJAX is mostly client sided anyway, the server just needs to be able handle GET/POST request. Sure the server code could be optimized to handle ajax requests better (such as elimating "beating the horse" bug so turn won't be wasted, or providing a timestamp so the client doesn't have to keep track of responses). Anyway, that aside, if I implemented guards to prevent actions from being taken, such as not firing a 2nd request if my health is below a certain point, or monster health is too low (estimated to be dead from the 1st request), would it break any rule? QUOTE(Cats Lover @ Feb 4 2014, 11:47)  Hmm the request doesn't really say much about synchronicity. If Tenb enforce synchronous connection, then there will be very minimal speed-up :/ This post has been edited by holy_demon: Feb 4 2014, 03:54
|
|
|
|
 |
|
Feb 4 2014, 04:42
|
Cats Lover
Group: Gold Star Club
Posts: 2,800
Joined: 18-April 13

|
What I need is to send crystal packs easily. It's troublesome moogle 12 times for each 12 types. (IMG:[ invalid] style_emoticons/default/smile.gif) @holy_demon Is it possible to open 12 browser tabs for each mooglemail forms that specific recipient filled (user's choice by a form or whatever) and each type of crystals attached (the amount of crystals also selected by a form or whatever) with a script? The final sending must be done by user's click, not automated "action", so I hope the script does not viloate any rules. (IMG:[ invalid] style_emoticons/default/laugh.gif)
|
|
|
|
 |
|
Feb 4 2014, 12:48
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
QUOTE(Cats Lover @ Feb 4 2014, 13:42)  What I need is to send crystal packs easily. It's troublesome moogle 12 times for each 12 types. (IMG:[ invalid] style_emoticons/default/smile.gif) @holy_demon Is it possible to open 12 browser tabs for each mooglemail forms that specific recipient filled (user's choice by a form or whatever) and each type of crystals attached (the amount of crystals also selected by a form or whatever) with a script? The final sending must be done by user's click, not automated "action", so I hope the script does not viloate any rules. (IMG:[ invalid] style_emoticons/default/laugh.gif) It's not just possible, there's even many ways to do it, iframe, form.submit, ajax. I tried doing it with iframe, but it's really too much hassle. So I scrapped it and go with ajax now. It's part of my MoogleSpam project >.>
|
|
|
|
 |
|
Feb 4 2014, 22:19
|
holy_demon
Group: Gold Star Club
Posts: 5,417
Joined: 2-April 10

|
Who said that the server is throttled to 4action/s ? I just tested my script and accidentally did 50 actions in like 5s Bam instant death (IMG:[ invalid] style_emoticons/default/ohmy.gif) QUOTE 121 3 Regen restores 1165 points of health. 121 2 Your spike shield hits Takanashirikka for 24 points of cold damage. 121 1 Takanashirikka hits you for 417 crushing damage. 120 3 Takanashirikka gains the effect Freezing Limbs. 120 2 Your spike shield hits Takanashirikka for 31 points of cold damage. 120 1 Takanashirikka crits you for 539 crushing damage. 119 3 Regen restores 1165 points of health. 119 2 Your spike shield hits Takanashirikka for 102 points of cold damage. 119 1 Takanashirikka uses drak dark frame, and hits you for 1822 crushing damage 118 1 You evade the attack from Takanashirikka. 117 1 You evade the attack from Takanashirikka. 116 2 Your spike shield hits Takanashirikka for 5 points of cold damage. 116 1 You parry the attack from Takanashirikka. 115 3 Regen restores 567 points of health. 115 2 Your spike shield hits Takanashirikka for 32 points of cold damage. 115 1 Takanashirikka crits you for 567 crushing damage. 114 2 Your spike shield hits Takanashirikka for 5 points of cold damage. 114 1 You parry the attack from Takanashirikka. 113 3 Regen restores 472 points of health. 113 2 Your spike shield hits Takanashirikka for 27 points of cold damage. 113 1 Takanashirikka hits you for 472 crushing damage. 112 1 You evade the attack from Takanashirikka. 111 2 Your spike shield hits Takanashirikka for 5 points of cold damage. 111 1 Takanashirikka uses drak dark frame. You parry the attack. 110 3 Regen restores 505 points of health. 110 2 Your spike shield hits Takanashirikka for 29 points of cold damage. 110 1 Takanashirikka hits you for 505 crushing damage. 108 2 The effect Freezing Limbs on Takanashirikka has expired. 108 1 Takanashirikka uses drak frame dragon. You evade the attack. 107 3 Regen restores 856 points of health. 107 2 Your spike shield hits Takanashirikka for 25 points of cold damage. 107 1 Takanashirikka hits you for 435 crushing damage. 106 2 Your spike shield hits Takanashirikka for 24 points of cold damage. 106 1 Takanashirikka hits you for 421 crushing damage. 105 3 Regen restores 549 points of health. 105 2 Your spike shield hits Takanashirikka for 5 points of cold damage. 105 1 You parry the attack from Takanashirikka. 104 4 Regen restores 1165 points of health. 104 3 Takanashirikka gains the effect Freezing Limbs. 104 2 Your spike shield hits Takanashirikka for 96 points of cold damage. 104 1 Takanashirikka uses drak dark frame, and hits you for 1714 crushing damage 103 1 You evade the attack from Takanashirikka. 102 1 Regen restores 603 points of health. 101 3 Regen restores 1165 points of health. 101 2 Your spike shield hits Takanashirikka for 99 points of cold damage. 101 1 Takanashirikka uses drak dark frame, and hits you for 1768 crushing damage 100 2 Your spike shield hits Takanashirikka for 5 points of cold damage. 100 1 You parry the attack from Takanashirikka. 99 3 Regen restores 417 points of health. 99 2 Your spike shield hits Takanashirikka for 5 points of cold damage. 99 1 You parry the attack from Takanashirikka. 98 3 Takanashirikka gains the effect Freezing Limbs. 98 2 Your spike shield hits Takanashirikka for 24 points of cold damage. lol bug when attacking the 10th monster (IMG:[ invalid] style_emoticons/default/tongue.gif) This post has been edited by holy_demon: Feb 4 2014, 22:35
|
|
|
|
 |
|
Feb 4 2014, 23:35
|
Dan31
Group: Members
Posts: 4,399
Joined: 26-March 12

|
QUOTE(holy_demon @ Feb 4 2014, 21:19)  Who said that the server is throttled to 4action/s ? I just tested my script and accidentally did 50 actions in like 5s Bam instant death (IMG:[ invalid] style_emoticons/default/ohmy.gif) I read that as "instant ban" for some reason. (IMG:[ invalid] style_emoticons/default/tongue.gif) That's a surprising thing to hear, though. You should probably limit your script somehow. And PM Tenboro for do-and-not-do advice. This post has been edited by Dan31: Feb 4 2014, 23:41
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
|
 |
 |
 |
|