Jump to content

Help! My elite script doesn't work! =(


Recommended Posts

Okay guys here's my chunk of code

$count = 0
$variable = "$sample" 
$sample = 1


While $count > 209; Do
    $sample = $variable + $count
    If $sample = 46346345
        Send("Wizzeh")
        $count = 700
    EndIf
    $sample = $variable - $count
    $count = $count + 1
WEnd

What I am trying to do is append the variable $count to the end of $variable to make a new variable called $sample. I am then comparing the variable $sample to a number. If the number is correct, I am making $count high enough to kick the loop and get out of the while. I am writing it in such a way (nested like this) so that I can have like 15 lines of code instead of writing 208 seperate if statements. Anyone have any ideas? Please let me know as this is kinda important to me ;0

Thank you all!

Link to comment
Share on other sites

Okay guys here's my chunk of code

$count = 0
$variable = "$sample" 
$sample = 1
While $count > 209; Do
    $sample = $variable + $count
    If $sample = 46346345
        Send("Wizzeh")
        $count = 700
    EndIf
    $sample = $variable - $count
    $count = $count + 1
WEnd

What I am trying to do is append the variable $count to the end of $variable to make a new variable called $sample. I am then comparing the variable $sample to a number. If the number is correct, I am making $count high enough to kick the loop and get out of the while. I am writing it in such a way (nested like this) so that I can have like 15 lines of code instead of writing 208 seperate if statements. Anyone have any ideas? Please let me know as this is kinda important to me ;0

Thank you all!

let's start with count is set to 0

then the loop only works if count is greater than 209

Wondering why it doesn't work..... :)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

If your variable is string and the count is a number, now you can append it to the string and other things.

use the & sign to append it.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

If your variable is string and the count is a number, now you can append it to the string and other things.

use the & sign to append it.

Thank you!!

I now need to figure out how to do that, and i was just sitting here thinking i really should have 1 array instead of 208 variables. I am so smart... is there a slap head smiley face on this forum? LOL

Link to comment
Share on other sites

Thank you!!

I now need to figure out how to do that, and i was just sitting here thinking i really should have 1 array instead of 208 variables. I am so smart... is there a slap head smiley face on this forum? LOL

The problem I can see with your code is that, as written and assuming there's no code missing, variable $sample is never going to pass your "If" test. Combining $variable with $count, whether cast as a string or a number, is never going to equal 46346345.

Perhaps you can help us understand a little more about what the final script is supposed to do, and then in return we can more efficiently help you get it there.

Yes, I'm a big fan of the split infinitive.

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

The problem I can see with your code is that, as written and assuming there's no code missing, variable $sample is never going to pass your "If" test. Combining $variable with $count, whether cast as a string or a number, is never going to equal 46346345.

Perhaps you can help us understand a little more about what the final script is supposed to do, and then in return we can more efficiently help you get it there.

Yes, I'm a big fan of the split infinitive.

-S

Well, what I am trying to accomplish is be able to have a loop that generates variables. I actually am using an array of strings now. So what I am trying to do is have a loop that generates the text "$sample[1]" then next itteration of the loop makes "$sample[2]". So what it is doing is generating a variable name. I hope that when the loop outputs the variable, it will be an array address that is checked. The reason it is doing this, is because I am taking 208 pixel samples and I am going to need to compare all of them to a single number. Since they are all being compared to the same thing, I was hoping to use a loop instead of a whole bunch of seperate if statements. I hope thats specific enough, let me know if thats not good enough.

(I love how active this forum is by the way, you guys rock.)

Edited by East Coast Cracka
Link to comment
Share on other sites

Well, what I am trying to accomplish is be able to have a loop that generates variables. I actually am using an array of strings now. So what I am trying to do is have a loop that generates the text "$sample[1]" then next itteration of the loop makes "$sample[2]". So what it is doing is generating a variable name. I hope that when the loop outputs the variable, it will be an array address that is checked. The reason it is doing this, is because I am taking 208 pixel samples and I am going to need to compare all of them to a single number. Since they are all being compared to the same thing, I was hoping to use a loop instead of a whole bunch of seperate if statements. I hope thats specific enough, let me know if thats not good enough.

(I love how active this forum is by the way, you guys rock.)

;Loop

For loop_counter = 0 to 207 ;Remember that arrays start from zero

  $Sample[loop_counter] = pixel_sample_value ;You can make this a function call to get the pixel sample value

Next

Is this the sort of thing you are trying to do?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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