PDA

View Full Version : [VB6] NP on hand.. Nothing happens



Ashleys165
12-29-2011, 07:39 PM
Private Sub Command2_Click()

Strhtml = Neopets1.Wrapper1.GetWrapper("[Only registered and activated users can see links]")

Dim html As String

Hand.Caption = GetStringBetween(html, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>")

End Sub

Nothing happens, it goes through it, and my caption does not change!

Miguel
12-29-2011, 08:30 PM
Err...

First, Strhtml hasn't been initialized (from what I can see), so your wrapper is throwing what it gets right into the trash. We'll leave it for now, and initialize strhtml instead above it.



Private Sub Command2_Click()

Dim Strhtml As String
Strhtml = Neopets1.Wrapper1.GetWrapper("[Only registered and activated users can see links]")

Dim html As String

Hand.Caption = GetStringBetween(html, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>")

End Sub


Next, I'm not sure what wrapper you're using (it looks like gluraks), so I'm not sure why you are calling Neopets1.Wrapper1.GetWrapper (unless you're using some sort of specialized control). If it IS just a wrapper, just leave it at Wrapper1.GetWrapper() (or whatever you named it). Also, /index on Neopets gives a 404. You want index.phtml.



Private Sub Command2_Click()

Dim Strhtml As String
Strhtml = Wrapper1.GetWrapper("[Only registered and activated users can see links]")

Dim html As String

Hand.Caption = GetStringBetween(html, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>")

End Sub


Next, afterwards you are initializing html as a string. Nothing wrong there, except when you use your GSB, you're searching in html, but html has nothing in it! Lets just get rid of html, and switch the searched string to strhtml.



Private Sub Command2_Click()

Dim Strhtml As String
Strhtml = Wrapper1.GetWrapper("[Only registered and activated users can see links]")

Hand.Caption = GetStringBetween(Strhtml, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>")

End Sub


Now, this should work (provided that you have logged in first, this could also be an issue that you have not logged in!)

Soredavide
12-30-2011, 07:56 AM
I am sorry without actually seeing the rest of the code, you are assuming quite alot. Ashleys165 could have declared Strhtml As as a string in a global variable.

Neopets1.Wrapper1.GetWrapper would be used if you have multiple forms and the wrapper you are calling is on a different form (form name would be Neopets1).

Could you please post the project; the easist way to determine what is wrong, would be to see what the code is actually doing. From what I see in the code you have posted, the missing phtml that ./m mentioned is most likely the issue.

Josh
12-30-2011, 12:46 PM
I am sorry without actually seeing the rest of the code, you are assuming quite alot. Ashleys165 could have declared Strhtml As as a string in a global variable.

Neopets1.Wrapper1.GetWrapper would be used if you have multiple forms and the wrapper you are calling is on a different form (form name would be Neopets1).

Could you please post the project; the easist way to determine what is wrong, would be to see what the code is actually doing. From what I see in the code you have posted, the missing phtml that ./m mentioned is most likely the issue.

...All they are doing is checking the neopoints on hand. Posting the entire project isnt needed.

Even when missing the .phtml, it should still work. It still shows the nps on hand on that page. The problem was just that they checked the string html instead of strhtml.

Ashleys165
01-01-2012, 07:48 PM
^ I'm not so sure... I decided to add the code to my log in... and I had the same thing, my caption turned into NOTHING, absolutely nothing! Sooo, I have checked the code many times.... And found (whats the word?) nothing... sooo, I want it to be checked over by professionals...


Private Sub neo_Click()

Dim Strhtml As String

Strhtml = Wrapper1.GetWrapper("[Only registered and activated users can see links]")
Strhtml = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "destination=&username=" & User & "&password=" & pass, "[Only registered and activated users can see links]")

If InStr(1, Strhtml, "badpassword") Then
MsgBox "Bad Password Or Username, Try Again."
ElseIf InStr(1, Strhtml, "index") Then
MsgBox ("You succesfully logged in as " & User.Text & ". Have fun cheating!")


Strhtml = Wrapper1.GetWrapper("[Only registered and activated users can see links]")

NPOH.Caption = GetStringBetween(Strhtml, "NP: <a id='npanchor' href=""/objects.phtml?type=inventory"">", "</a>")

Else
MsgBox "You Might Be Frozen, Or There Is An Unknown Error!"
End If

End Sub

deadfolx
01-02-2012, 11:07 AM
far from a pro, but i dont think the strhtml between ur MsgBox and NPOH is really needed since u just added to ur login sub. u can just read whats already there, instead of getting again? maybe thats worth a shot?

also, set a breakpoint towards the bottom of the Sub, or step through, and see whats going on. See if u can view the strhtml string. Should give u better clues.

Miguel
01-02-2012, 12:51 PM
What deadfolx said. Try making a multiline textbox and before your GSB put your strhtml into it. Because now it seems to be more of a logic issue than anything

j03
01-02-2012, 02:12 PM
Always use msgbox's to debug. use them to see if you logged in (have a popup saying "hi" or something if you did) or even have it display the response (msgbox strHTML), so if it's not displaying the NP, then something is not right.

Ashleys165
01-02-2012, 02:39 PM
ElseIf InStr(1, Strhtml, "index") Then
MsgBox ("You succesfully logged in as " & User.Text & ". Have fun cheating!")

I have it here... And I am taking a brake from coding atm, but I will go back to it soon to figure out all this stuff.

j03
01-02-2012, 04:14 PM
ElseIf InStr(1, Strhtml, "index") Then
MsgBox ("You succesfully logged in as " & User.Text & ". Have fun cheating!")

I have it here... And I am taking a brake from coding atm, but I will go back to it soon to figure out all this stuff.

Well I hate to see anyone struggle with stuff like this when others find it quite simple. If you want some help with anything, PM me for my MSN or Skype.

Miguel
01-02-2012, 07:55 PM
I decided to run it myself, here's the response I was getting:




[Only registered and activated users can see links] 301 Moved Permanently
Date: Tue, 03 Jan 2012 00:53:17 GMT
Server: Apache/2.0.58 (Unix)
Location: [Only registered and activated users can see links]
Content-Length: 317
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="[Only registered and activated users can see links]">here</a>.</p>
<hr>
<address>Apache/2.0.58 (Unix) Server at neopets.com Port 80</address>
</body></html>


I thought Gluraks followed redirects :s Guess, not, you just need to add a www to this line:


Strhtml = Wrapper1.GetWrapper("[Only registered and activated users can see links]")

Sorry I didn't see it before :s

Ashleys165
01-02-2012, 09:22 PM
OMG!!! It works!!! I. Love. You. So. Much!

Xexist
01-18-2012, 07:34 PM
Man this makes me want to start coding again so much.

Maybe I will start playing tomorrow.

j03
01-18-2012, 07:52 PM
Haha do it up! We'd help you if you needed any, and it's actually fun to write your own bots that play the game for you.