Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts Goto page Previous  1, 2, 3  Next
Full Throttle Posted: Fri Sep 01, 2006 11:56 pm
TMC Mud List Rankings
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Apr 12, 2008 1:19 am   
 
Well, besides the fact that that sort of thing is extremely illegal, i find it highly unlikely that people wouldn't notice and stop using it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Sat Apr 12, 2008 8:20 pm   
 
hmm.
I suppose you're probably right.

Well, my version of scripts that use this approach actually have error detection and automatic correction of issues like failed connections, but here's some skeleton code for the idea:

Code:
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", ~"http~:~/~/www.topmudsites.com~/vote-WHATEVER?~", FALSE~:objHTTP.Send~: intX = INSTR~(objHTTP.ResponseText, ~"ssid1~"~) + 14~:intY = INSTRREV~(objHTTP.ResponseText, ~"mudid~"~) - 30~:intZ = intY - intX~:strHTML = mid~(objHTTP.ResponseText, intX, intZ~)~:Set objHTTP = Nothing} VBScript
#VARIABLE tms_vote_ssid1 %mss( strHTML)
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"POST~", ~"http~:~/~/www.topmudsites.com~/vote.php~", FALSE~:objHTTP.setRequestHeader ~"Content-type~", ~"application~/x-www-form-urlencoded~"~:dataToSend = ~"ssid1~=@tms_vote_ssid1~&mudid~=253206~&do~=in~"~:objHTTP.Send dataToSend~:Set objHTTP = Nothing} VBScript


You could also use a regex instead of that instr, instrrev, mid hoop-jumping that I took from somewhere else. But I figure that it works well enough so there's no point in changing it just because.

Now here's the catch. There's obviously no way of verifying that it actually works. So you could just be throwing your vote away by doing this. A much safer approach, though less silent, would be to launch the url and click the form button through DDE or COM.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sun Jan 04, 2009 9:16 pm   To bring this back up....
 
I know this is slightly off topic from what the original intent is, and is a question on Fiendish's deviation from the topic, but I'm hoping no one minds.

I've got a site that I wanted to do something like what Fiendish has to do this to.
I'll be honest, i have NO idea what this does at all with code wise, so i figured that I could just add the URL that i wanted and I have this:

Code:
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35&c=1~", FALSE~:objHTTP.Send~: intX = INSTR~(objHTTP.ResponseText, ~"imgsrc~"~) + 15~:intY = INSTRREV~(objHTTP.ResponseText, ~"submit~"~) - 16~:intZ = intY - intX~:strHTML = mid~(objHTTP.ResponseText, intX, intZ~)~:Set objHTTP = Nothing} VBScript
#VARIABLE tmc_vote_imgsrc %mss( strHTML)
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"POST~", ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35&c=1~", FALSE~:objHTTP.setRequestHeader ~"Content-type~", ~"application~/x-www-form-urlencoded~"~:dataToSend = ~"mode~=VOTE_CONF~&mud~=Aardwolf~&imgsrc~=@tmc_vote_imgsrc~"~:objHTTP.Send dataToSend~:Set objHTTP = Nothing} VBScript
#SHOW Thank you for voting for Aardwolf at The Mud Connector!


Now, the results of that gives 2 pop up error boxes that shows the http differently:
http://en.valael.org/game/inizia_crafting.asp?i=35=1 and http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35=1

so, the differences are in the &c part so, i comment it out: ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35~&c=1~"

And the NEW results are:
http://en.valael.org/game/inizia_crafting.asp?i=35c=1 and http://en.valael.org/game/inizia_crafting.asp?i=35c=1
both show the same results, but note that the c has an underline...

double ~: ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35~~&c=1~"
Gets me:
http://en.valael.org/game/inizia_crafting.asp?i=35~=1 and http://en.valael.org/game/inizia_crafting.asp?i=35~=1

I even tried putting the http in a variable and having the script use the variable, but that tossed me a whole NEW error...

So, is there a way to have this to work with the &?
right now I'm using a tick timer to send
#DDE Firefox WWW_OpenURL http://en.valael.org/game/inizia_crafting.asp?i=35~&c=1

But if I don't even need to have it open in a browser at all, it's much more preferred.
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Sun Jan 04, 2009 9:55 pm   
 
Let me explain to you what each thing does and then maybe you'll understand how to use it to do whatever it is that you want. What you're doing right there won't do anything useful, since you took code designed for an alias that votes at voting websites and just gave it a different url without changing the stuff that actually does the voting. It especially won't do anything if you don't have anything Aardwolf related on that valael website.

A colon is a line break in vbscript.

Set objHTTP = CREATEOBJECT ("MSXML2.ServerXMLHTTP") is VBScript code for create an HTTP communication object and assign it to the variable objHTTP for later reference.
objHTTP.Open opens the connection with the following parameters: "GET"/"POST" specifies that it is a form GET or POST query (look up the differences if you don't know them). The url is obviously the url you want to communicate with. And I forget what the FALSE is for. I'm sure you can look up the documentation for vbscript msxml2.serverxmlhttp to find out.

objHTTP.Send sets up the connection to the website and stores the response. The response is the HTML code for the website at the url given.

INSTR(objHTTP.ResponseText, "something") calls a vbscript function that searches for the text "something" in the stored HTML response from the web server and returns the location as an index into the string.
INSTRREV(...) does the same thing but starts at the end.

intX and intY store the start and stop locations of what I want to extract from the web page.
intZ stores the length of what I want to extract.

strHTML = mid(objHTTP.ResponseText,intX,intZ) says to extract the text starting at X and Z characters long and store it in the variable strHTML.
Set objHTTP = nothing just destroys the server connection object.

%mss( strHTML) then puts the vbscript variable strHTML into a zmud context so that you can store it in a zmud variable.

That's the simple part. The next part follows largely the same object creation format, except this time you need a POST object to send the data as an encoded url. The important bit in the second #MSS is the "dataToSend = ..." which is where you set up all the data you want to send to the server. That is, anything that comes after the ?
So you'd have dataToSend = ~"i~=35~&c~=1~" or something like that attached to a url of "http://en.valael.org/game/inizia_crafting.asp"

Now that I think about it. I'm sure you can combine both #MSS bits into one. It's probably not necessary to destroy objHTTP and then recreate it. But that's not important.

Anyway, the reason for doing all of this is that when voting on one of the voting websites, the first thing you do is go to a website that has a CLICK HERE TO VOTE FOR YOUR MUD, and that page has somewhere on it a unique identifier for the vote that you want to cast. After extracting that value (this is what the whole first #MSS does), you then have to submit it to another page to verify your vote cast (this is what the second one does).

If I knew what you were trying to do, I'd be able to offer more help.


Last edited by FiendishX on Sun Jan 04, 2009 10:54 pm; edited 1 time in total
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sun Jan 04, 2009 10:32 pm   
 
meh, I should have checked with the script you have on your site....it's not working for me either.

I tried it your way with putting the info after the ? into the dataToSend and got an error. decided to install your script and see if it worked and it didn't

Imported it like you have for your other scripts (Actions > Execute File) and i'm getting the same errors when I run it.



Basically, it's for a game. Every fixed # of seconds I want it to send http://en.valael.org/game/inizia_crafting.asp?i=35&c=1 and not open a browser or anything.

I'm currently using the tick timer because I don't want to have to be connected to a mud to do it and i'm every 520 seconds i'm sending: #3 {#DDE Firefox WWW_OpenURL http://en.valael.org/game/inizia_crafting.asp?i=35~&c=1} Sending it 3 times because there's a captcha and for some reason i can by pass it by sending it several times, usually the 3rd time gets it over ridden.
This works fine, but if I'm on another program, or another tab, it over rides and takes control and stuff, and I'd rather not be interrupted.

Just hoped that changing your script would be good enuf, but if it don't even work for me...dunno :(
It's nothing to do with voting, i just wanted to send a browserless site to activate.
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Sun Jan 04, 2009 10:42 pm   
 
Mud Connector always had a flaky web server. The script doesn't error out when I run it on my computer.

The following script works for me.

#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"POST~", ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp~", FALSE~:objHTTP.setRequestHeader ~"Content-type~", ~"application~/x-www-form-urlencoded~"~:dataToSend = ~"i~=35~&c~=1~"~:objHTTP.Send dataToSend~:Set objHTTP = Nothing} VBScript
#ECHO Valael Has Been Contacted



Whether or not it actually does something useful is not something that I can tell you.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sun Jan 04, 2009 11:11 pm   
 
ok, figured out why it wasn't running your script. Stupid antivirus was blocking it.
it don't block zmud from connecting to muds or from using the #DDe, BUT it prevents it from sending the info from your script. *mutter*

Ok, so your original script is running fine.
I'd already tried you're change and it didn't work. There's no effect in the game.

But looking at your original script further, looks like i'm supposed to be telling it to look for something, and use that, and all this other stuff, rather than just SEND a url without bothering with a browser.
OR maybe like your warning on your site said, "there's no way to know if it works or not" and I guess the answer is not :-)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Jan 04, 2009 11:50 pm   
 
FiendishX wrote:
That's the simple part. The next part follows largely the same object creation format, except this time you need a POST object to send the data as an encoded url. The important bit in the second #MSS is the "dataToSend = ..." which is where you set up all the data you want to send to the server. That is, anything that comes after the ?
So you'd have dataToSend = ~"i~=35~&c~=1~" or something like that attached to a url of "http://en.valael.org/game/inizia_crafting.asp"

I was under the impression that that sort of thing (inizia_crafting.asp?i=35&c=1) doesn't need POSTing, because it's just sent as part of the URL using GET instead, just like clicking a link as opposed to entering something on a form. So the POST information should be blank, because there's no form to submit, unlike the TMS voter, but that information needs adding to the end of the GET for the page in the first place.

I've only done a little bit of this stuff (using a http library for Lua), and only using GET and not POST, so I could be wrong, but that's the way I've done it so far. The basic idea was simply to use GET with the full URL, including the vars at the end, and then parse the resulting page for whatever you're looking for. No POSTing was needed. I guess my point is that you should be able to just GET your whole URL and it should work.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Jan 05, 2009 12:52 am   
 
Well, tried:
Code:
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35~&c=1~", FALSE~:objHTTP.Send~: intX = INSTR~(objHTTP.ResponseText, ~"imgsrc~"~) + 15~:intY = INSTRREV~(objHTTP.ResponseText, ~"submit~"~) - 16~:intZ = intY - intX~:strHTML = mid~(objHTTP.ResponseText, intX, intZ~)~:Set objHTTP = Nothing} VBScript

And it still don't work. There's no change to the game.
Of course, i WAS getting those errors, when i had the antivirus up still, that showed that the & wasn't getting parsed correctly.

BTW, i'm pretty sure I can get rid of a lot of the stuff that's in that code to make it smaller, but damned if i know what to remove safely :-)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Jan 05, 2009 1:06 am   
 
The & thing is probably related to another thread on here - can't work out how to stop zMUD seeing it as a special character. If you're not using it for anything, turn off the database char. I think you might escape it by putting two of them, I'm not sure.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Jan 05, 2009 1:42 am   
 
Like i'd said in a previous post:
Quote:
double ~: ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35~~&c=1~"
Gets me:
http://en.valael.org/game/inizia_crafting.asp?i=35~=1 and http://en.valael.org/game/inizia_crafting.asp?i=35~=1
Of course that was with the & being for the database

Turned off & as the database char and tried both:
http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35~&c=1
http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35&c=1
and unfortunately, nothing :(
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Mon Jan 05, 2009 4:41 pm   
 
He meant two ampersands &&.
_________________
Taz :)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Jan 05, 2009 9:48 pm   
 
oh...duh...will try as soon as i'm off work :-)
_________________
http://www.Aardwolf.com
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Jan 05, 2009 10:43 pm   
 
OK, so tried that. I now have:
Code:
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35&&c=1~", FALSE~:objHTTP.Send~: intX = INSTR~(objHTTP.ResponseText, ~"imgsrc~"~) + 15~:intY = INSTRREV~(objHTTP.ResponseText, ~"submit~"~) - 16~:intZ = intY - intX~:strHTML = mid~(objHTTP.ResponseText, intX, intZ~)~:Set objHTTP = Nothing} VBScript

And I'm getting an error:

So, i get rid of ~:strHTML = mid~(objHTTP.ResponseText, intX, intZ~) and now i have:
Code:
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35&&c=1~", FALSE~:objHTTP.Send~: intX = INSTR~(objHTTP.ResponseText, ~"imgsrc~"~) + 15~:intY = INSTRREV~(objHTTP.ResponseText, ~"submit~"~) - 16~:intZ = intY - intX~:Set objHTTP = Nothing} VBScript

I'm not showing an error box anymore, but it's still not doing anything to the game itself.
Don't know anymore :(

EDIT: Oh and since, as i mentioned, there is a captcha code that occasionally blocks the link, i'm basing my "it don't work" on sending the script 10 times, since i've yet to see the captcha block it more than 4 times. So 10 SHOULD be a safe # to test :-)


Last edited by Vitae on Mon Jan 05, 2009 11:12 pm; edited 1 time in total
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Jan 05, 2009 11:01 pm   
 
Ok, so i've been TRYING to get a grasp of all this XML stuff....ummm..and i've come to the conclusion that I have to ask a possibly stupid question....other than the zmud code am I supposed to have something ELSE special?....
like running my own server? installed ASP...or whatever?...
_________________
http://www.Aardwolf.com
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Jan 06, 2009 2:33 pm   
 
I take it that http://en.valael.org/game/inizia_crafting.asp?i=35&c=1 submitted in a web browser 4 or more times achieves what you want it to? If that is the case then you need no more than you have above in fact you can get rid of the intX, intY and intZ lines. As to why it isn't working via script the only thing I can suggest is that it is down to timing so put some delays between each try.
_________________
Taz :)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Jan 06, 2009 5:36 pm   
 
Correct. that url is what i want. Only reason to submit it more than once is to get around the captcha. It can work perfectly fine the 1st time for 20 times, but then the captcha comes up and it needs to be sent again, until i get around it. like i said, could be up to 3 to 4 times that i send it before i get around it.

So, pretty much this should work on it's own
Quote:
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", ~"http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35&&c=1~", FALSE~:objHTTP.Send~:Set objHTTP = Nothing} VBScript


I sent it 20 times, with an interval of about 2 to 3 seconds each. nothing :(
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Tue Jan 06, 2009 5:40 pm   
 
Try the character code for the ampersand? I know space is %20, I don't remember what the ampersand is.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Jan 06, 2009 6:26 pm   
 
if space is %20 then it looks like & is 26
So i tried this:
http~:~/~/en.valael.org~/game~/inizia_crafting.asp?i=35%26c=1 (even tried ~%26 just in case)
and nothing :(

Also, looks like & on zmud is 38, so tried that as well, and nothing...

BTW, tried http://en.valael.org/game/inizia_crafting.asp?i=35%26c=1 directly in the browser and that didn't even work....
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Jan 06, 2009 7:24 pm   
 
Time to do a search and see if that FALSE is throwing it.
_________________
Taz :)
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Jan 06, 2009 11:00 pm   
 
changed FALSE to TRUE.
Removed TRUE
Nothing

tried the TRUE and nothing with &, &&, ~&, ~&&, %26

Nothing else that I can think of to test it...
_________________
http://www.Aardwolf.com
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Wed Jan 07, 2009 9:59 am   
 
Maybe expanding a variable that contains the link will help your other problem. Good luck, looks cool.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Wed Jan 07, 2009 2:30 pm   
 
as in:

#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", @valael, FALSE~:objHTTP.Send~:Set objHTTP = Nothing} VBScript

tried it before in one of the other amazing fails :)
Didn't try it with another of the current fails, might try...and might fail :-)
_________________
http://www.Aardwolf.com
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Thu Jan 08, 2009 1:56 am   
 
For some reason it works in the hyperlink trigger when it used to have all the character problems your script is having.

Oh. Can you do:

Code:
#MSS {Set objHTTP = CREATEOBJECT~(~"MSXML2.ServerXMLHTTP~"~)~:objHTTP.Open ~"GET~", %expand(@valael,1), FALSE~:objHTTP.Send~:Set objHTTP = Nothing} VBScript


?
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Thu Jan 08, 2009 7:09 pm   
 
What if you use msgbox to show what was received? Does it contain the same HTML as when submitted in a browser?

After objHTTP.Send~: you need to put msgbox objHTTP.ResponseText~:

EDIT: I just tested it. It gets nothing at all. Replace your server with www.google.com and notice the difference.
_________________
Taz :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net