Jump to content

Variable Subtracting?


Recommended Posts

While 1
$pop = 35000000
$pop2 = $pop - 1
_IENavigate($oIE, "http://www.roblox.com/User.aspx?id=" & $pop2)

This is my code, I have gotten the variable pop2 to subtract 1 from pop but I want it to keep subtracting. So the first time the code is looped it is 34444449 and then the next time the code is looped it is 34444448 and then 34444447 and so on. I'm new have have no clue what I'm doing.

Link to comment
Share on other sites

Hello and welcome to the forum. :)

You could easily put this into an endless loop.
To use the While 1 that you have in your script you will need to put a WEnd at the bottom(I guess you just didn't post your whole script, but had to tell you anyways).

$pop2 is another variable and counts only what you tell it to. Therefor it will take $pop(35000000) and substract 1.
The problem here is that it does nothing to $pop and this value will still be the same. So when $pop2 does it's thing again, it starts all over.
You could easily avoid this by doing the following:
 

$pop = 35000000
While 1
$pop = $pop - 1
_IENavigate($oIE, "http://www.roblox.com/User.aspx?id=" & $pop)

Hope this helps.

Akarillon

Edited by Akarillon

Challenge accepted!

Link to comment
Share on other sites

  • Developers
While 1
$pop = 35000000
$pop2 = $pop - 1
_IENavigate($oIE, "http://www.roblox.com/User.aspx?id=" & $pop2)

This is my code, I have gotten the variable pop2 to subtract 1 from pop but I want it to keep subtracting. So the first time the code is looped it is 34444449 and then the next time the code is looped it is 34444448 and then 34444447 and so on. I'm new have have no clue what I'm doing.

I hope this is not some sort of brute-force thing as we don't want to see those type of questions in our forums.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

XenonTech,

I'm having my bot go to each profile, copy the name to a text file and move on

And why are you doing this? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 6 years later...

#include <Array.au3>
#include <MsgBoxConstants.au3>

Local $mena[] = [4.51,1, 2.7, 2.37, 0.5, 0.5, 0.8, 0.2 ,1]
$hodnota = 4.1
$rozd = .3

local $bit[] = [0]
Local $zapis = ""
Global $riadky = 0
Global $poc = 0
Global $Bol = 0


For $i = 0 To UBound($mena)-1
_ArrayAdd($bit,0)
$poc += 1
Next

Dim $vypis[3][$poc]

$bit[$poc]=0

While $bit[$poc]<1
      For $i = 0 To $poc
         if $bit[$i]=0 Then
            $bit[$i]=1
            ExitLoop
         Else
            $bit[$i]=0
            if $bit[$i+1]=0 Then
               $bit[$i+1]=1
               ExitLoop
            EndIf
         EndIf
      Next

      Local $suma=0
      For $i = 0 To UBound($mena)-1
         if $bit[$i]=1 Then $suma += $mena[$i]
      Next
      If $rozd >= Abs( $suma - $hodnota ) Then
         $rozdiel = $suma - $hodnota
         Print()
         $Bol = 1
      EndIf
WEnd

_ArrayDisplay($vypis, "Vypis približných hodnôt od hodnoty " & $hodnota & " € s rozdielom < ako " & $rozd & " €",  Default, 65, Default)


Func Print()
   If $Bol = 1 Then ReDim $vypis[UBound($vypis) + 3][$poc]
   $pB = 0
   For $i = 0 To $poc-1
      $vypis[UBound($vypis)- 3][$i] = $bit[$i]
      If 1 = $bit[$i] Then
         $vypis[UBound($vypis)- 2][$i] = $mena[$i]
         $pB  +=1
      EndIf
   Next
      $vypis[UBound($vypis)- 1][0] = "Počet:"
      $vypis[UBound($vypis)- 1][1] = $pB
      $vypis[UBound($vypis)- 1][2] = "Suma:"
      $vypis[UBound($vypis)- 1][3] = $suma
      $vypis[UBound($vypis)- 1][4] = "Rozdiel:"
      $vypis[UBound($vypis)- 1][5] = $rozdiel
EndFunc


 

Link to comment
Share on other sites

  • Moderators

@Eone did you happen to notice this thread was over 6 years old?! Please don't resurrect old threads; after 6 years it is unlikely the OP is dying for an answer.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...