Jump to content
UBot Underground

Recommended Posts

Hey guys & gals!!

 

Started using Ubot again since, well, let's say I can dedicate a good amount of time with it.  Found an insane idea for a stupid simple bot that is in demand and there isn't any of its kind, as far as I know, so here's the deal.  Right now, I'm trying to have the user select their city and when they do, something will happen.  I got the "what will happen" part but I don't get the setting it up originally.

 

Here's the deal, I'd prefer not to share my work right now so I'll explain the situation as best as I can.

 

1- Joe starts the bot up, once logged into a website, he can select his city and when he does, a few things will happen depending on the options offered in the chosen city.  Right now I'm trying to set up an IF statement in regards to the input.  Let's assume he picked London from the list of cities.  This has values of let's say, London, Berlin, Paris, Moscow, New York, etc...  This drop down, I gave the variable of selectedCity.

 

When I go to use an IF statement, I don't know if I can add a literal input as the result.  This is what I got thus so far...

 

if selectedCity = "London"

Then (performs a few clicks in specific spots) - (which I assume is easily done)

Else - if select city = New York

Else - Any (nothing changes)- continue

 

I placed the box for the variable selectedCity and beside it, typed in = "London" (As a literal input) because ultimately, that's what I want since there will be many combinations of options that will result.  Right now, I just want to know how I can get this started and if what I'm doing is correct or if someone cal help me figure it out?  When I talk about a drop down I mean a UI dropdown, not a dropdown inside a web page.

 

I did some Python and some Ruby coding in the past but still rather new to uBot

 

Thank you!

 

Gigas

Link to post
Share on other sites

Place the cities into a list, then refer to the $list item and construct your dropdown or whatever.

 

You need to have the data into lists/tables/variables in order to be able to manipulate programatically (use the contained value into an IF, LOOP, etc...)

 

For instance, if your variable containing the city name "London" was called #cityName, you would compare within the IF command by including the content of the variable ('literally' as you mentioned) by enclosing the variable name with curly quotes, like this: "{#cityName}some text here" in Code View that would output the complete text: "Londonsometexthere"

 

On the other hand, simply calling the variable directly, w/o any curly quotes, would be replaced at runtime with its contained value ("London" in this example) but you would use the variable name instead, in the IF command, of course...

 

In Node View you just simply go to the variables (or type the var name, preceded by the variable denominator # in the search box) and drag'n'drop inside the node you need (IF in your case)

 

Hope this helps...

Link to post
Share on other sites

Thank Vault!

 

I'm not sure your idea would work since each of those city does something different to the back end, like turning switches on an off.  So, when someone selects on London, then the variable selectedCity must be associated with that option and the selectedCity variable only has so many options so doing it the long way is fine by me.  The system needs to click something different for each constant to make the website react differently and since it has to be done at each login, keeping anything in memory wouldn't work since there is a panoplea of combinations and I'll be using many drop downs and setting options for the user.

 

Basically, I need selectedCity as a variable and each city as their constant, where one of the constants is chosen from the UI dropdown  because, when it's chosen, it affects the whole program.  I don't know how to do that in uBot and well, every programmer has their own way of programming so playing around with off-ware lists ain't really something that I want to deal with... 

 

Please advise :)

 

Thanks again!

Link to post
Share on other sites

It's hard to help you when there are so few details given, but since you say the dropdown is in UI and not the website, you still need to fill that dropdown from a list, better than manually... at least that is how *I* would do it, but hey... feel free to do as you see fit, of course.

 

In regards to what to do when the user chooses a certain item from the dropdown, you could simply write a DEFINE (kinda like subroutine or function in other programming languages) that would be called for each selection separately.

So you would have a DEFINE called say... London  ..   another one called Paris, etc... and you can code each of them to do whatever you please (different from one another)

 

Cheers!

Link to post
Share on other sites

UPDATE: I did what I thought would work and it did!  I didn't think you could mix typed in text with commands in the programming interface!  Sweet, so for those who might need this later, here's what I did.

 

1- List of Cities remained the same, in a string of values, IE: London, New York, Berlin, Toronto, etc...

 

2- Used if/else statements IE:

if [selectedCity] = "London"

then click a, b, c

else

if [selectedCity] = "Berlin"

then click, c, b

else ( et cetera)

 

[square Brackets is the variable]

 

Yeah it's the long way of doing it but thank Jesus, it works and I understnad it!! :D

Link to post
Share on other sites

It's hard to help you when there are so few details given, but since you say the dropdown is in UI and not the website, you still need to fill that dropdown from a list, better than manually... at least that is how *I* would do it, but hey... feel free to do as you see fit, of course.

 

In regards to what to do when the user chooses a certain item from the dropdown, you could simply write a DEFINE (kinda like subroutine or function in other programming languages) that would be called for each selection separately.

So you would have a DEFINE called say... London  ..   another one called Paris, etc... and you can code each of them to do whatever you please (different from one another)

 

Cheers!

Yeah, there's usually more than one way to fix a problem, I think we're both right in our own rights ;)

 

I know many coders won't like the way I do it and I know there's easier ways to do it but...  I have to deal with brain damage, so whatever works I'll take it.

 

"What happens when I do this" type programming lol

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...