addamroy
-
Content Count
386 -
Joined
-
Last visited
-
Days Won
5
Posts posted by addamroy
-
-
The code is just OK (http://screencast.com/t/XGWjyFGuhp), so no need to change it before you test it....actually I would give you an advice...save the code while it's working, so you can fall back when it stops....
However, use the exact code that I've used, but before starting it make sure that JavaScript or JQuery is loaded in browser...so just navigate to Google for example before you do that.
Ahhh. That worked, I ran all that code in a 'new browser window' and it freakin worked! Thanks man!
I'm thinkin I may not even need to navigate anywhere because javascript is always enabled in the uihtml panel, probably just not enabled until you compile the bot (I as testing the node in ubot, which is probably why I had to navigate to make the functions work)
Thanks again I appreciate the help.
Adam.
-
I also tried adding that Javascript within the HEAD tags of the UIHTML panel, rather than in a run javascript function, then put the set commands in a define command. I ran the define command and according to the debugger it still didn't want to set the R G and B values.
This is the javascript as it's entered in the HEAD tags; (I have to add javascript to the UIHTML via pre-set variables because the {} symbols break any variables used in the UI HTML panel.)
set(#HexToRGBJavascript, "<script>
function hexToR(h) \{return parseInt((cutHex(h)).substring(0,2),16)\}
function hexToG(h) \{return parseInt((cutHex(h)).substring(2,4),16)\}
function hexToB(h) \{return parseInt((cutHex(h)).substring(4,6),16)\}
function cutHex(h) \{return (h.charAt(0)==\"#\") ? h.substring(1,7):h\}
</script>", "Global")
My test define is as follows:
define Hex to RGB {
set(#COLOR Hex, "ff8800", "Global")
set(#COLOR R, $eval("hexToR(\"{#COLOR Hex}\");"), "Global")
set(#COLOR G, $eval("hexToG(\"{#COLOR Hex}\");"), "Global")
set(#COLOR B, $eval("hexToB(\"{#COLOR Hex}\");"), "Global")
}
What am I doing wrong?
-
If you would at least try to do what I have told you, I'm sure you would already have a solution. There is actually no javascript knowledge needed to implement this (since you only need to copy the script from one of those pages and you only need to know that a (JavaScript) function returns a value, which is true for all of the programming languages btw), so it's mostly UBot knowledge that's left.
It looks like you don't have any desire to learn this, so I'll just post an example for you (although I think it would be better if you would get to these results on your own, since that way you would learn something and remember that for always):
run javascript("function hexToR(h) \{return parseInt((cutHex(h)).substring(0,2),16)\} function hexToG(h) \{return parseInt((cutHex(h)).substring(2,4),16)\} function hexToB(h) \{return parseInt((cutHex(h)).substring(4,6),16)\} function cutHex(h) \{return (h.charAt(0)==\"#\") ? h.substring(1,7):h\}") ui text box("COLOER Hex:", #COLOER Hex) set(#COLOR R, $eval("hexToR(\"{#COLOER Hex}\");"), "Global") set(#COLOR G, $eval("hexToG(\"{#COLOER Hex}\");"), "Global") set(#COLOR B, $eval("hexToB(\"{#COLOER Hex}\");"), "Global")
The JavaScript snippet used above can be found here: http://www.javascripter.net/faq/hextorgb.htm
It's not at all that i don't want to learn, I've been trying to pick apart codes for almost 7 days now, to no avail. And have been using Ubot since it's inception, and can do some failry advanced. It is not my effort, it is my lack of knowledge of javascript. And I hadn't noticed that you had already posted that code.
I copied and pasted your code as so.
ui text box("COLOER Hex:", #COLOER Hex)
define hex to rgb {
run javascript("function hexToR(h) \{return parseInt((cutHex(h)).substring(0,2),16)\}
function hexToG(h) \{return parseInt((cutHex(h)).substring(2,4),16)\}
function hexToB(h) \{return parseInt((cutHex(h)).substring(4,6),16)\}
function cutHex(h) \{return (h.charAt(0)==\"#\") ? h.substring(1,7):h\}")
set(#COLOR R, $eval("hexToR(\"{#COLOER Hex}\");"), "Global")
set(#COLOR G, $eval("hexToG(\"{#COLOER Hex}\");"), "Global")
set(#COLOR B, $eval("hexToB(\"{#COLOER Hex}\");"), "Global")
}
It doesn't set any of the RGB values for some reason when I run the define.
-
I have found the botters on this forum are usually very helpful.
I suggest that you post more technical details about the issues you are grappling with and see what happens.
Most of the time when I see people here not making progress here it is when they don't post enough details.
Give specific questions and get specific answers.
Do you have a JavaScript you would like to convert into UBOT?
Yea, I'm not the best explainer of my issues lol.
My specific question is: How to convert a variable whose value is a hex code, to the RGB form of that samehex value.
Example, if #colorA has a value of #ff8800, the script would change that value would become 255,136,0. Now #colorA would have a value of 255,136,0 instead of #ff8800
-
I've been trying for like a week lol.
I went through all the Google searches, but being someone who is not knowledgable in Javascript enough to pick apart the scripts and put them back together puts me at a blank.
I mean none of those scripts set ubot variables, which would be the most important aspect and unfortunately I don't know how to get those javascript snippets to set Ubot variables (or retrieve the existing variables that need to be converted), especially since I have many separate input fields that need to be converted.
-
It 'tis an impossible task it seems
-
I'm looking for a hopefully simple way to convert a variable's value from a HEX value, to it's RGB equivalent.
IE if user inputs #ff8800 in the input field, let's say #colorA. I want to automatically convert that to it's RGB value. In this case, #colorA would automatically become 255,136,0 which is the RGB value for the above Hex.
I know there are various equations out there but I haven't the slightest clue how to get them into uBot and make them work for this.
-
I AM SUCH AN IDIOT!
This whole time I've been testing this 'getfiles' command... I've been expecting it to read files from the application folder where all the images are for the compiled bot.... My UBOT project file is NOT in the same folder as the COMPILED bot lmaooooooo.
-
I'm using ubot 4 right now
I have no idea why it would work for you and not for me.
-
If you want it to show up in UI HTML than you'll have to use JavaScript+HTML (as mentioned above for example). I think the plugin only provides a popup.
That's how I'm doing it. I have onclick javascript executing the define functions which run the color picker.
-
set(#testgetfiles, $get files("{$special folder("Application")}\\images", "No"), "Global")
Paste that into a bot.
Put an 'images' folder inside your application folder. Put some files in this folder. Just to test.
Then run this node. Tell me if it gives you an error.
-
Thanks man I appreciate the help! My problem though (as I just posted in the other thread, lol) is that I wanted to specifically attach the color picker dialogue to text input fields in the ui html panel.
-
use set command with the same variable name as each input field
That's what I did. It's a workaround for now.
I wanted to avoid creating a define command for each field. (I have to use defines, because I am NOT using a ui button to display the picker) I was hoping to just attach the color picker dialogue to the TEXT INPUT fields themselves. So instead, I have a 'select color' text link under each input field, which prompts the color picker dialogue, then sets the variable for the input field, which then populates the input field with the hex code for that color.
However now that I discovered this bug that doesn't let you close or cancel the color picker dialogue without it setting the value to #000000 I have another headache obstacle to work around.
-
Bug in the color picker dialogue.
When you click 'cancel', or click the 'x' button to close the window, the color value sets to black #000000
It should not return any value if the cancel or x button is used. Makes it very easy for users to unknowingly lose their selections/settings.
Please fix
-
Well I suppose I'm just going to create a define command for each individual input field and populate them each with a button somewhere. Good enough to keep moving forward, I'll figure a more efficient way later down the road.
-
the color picker is a pop up...no need for input field
I have input fields where you can enter color values, I need the color picker to POPULATE them with the hex values.
The color picker should set some kind of value for the field you want to use it on.
-
How do I get the file management color picker dialogue into UIHTML buttons, rather than the standard UI buttons?
@Traffikcop, yes I tried that, but I have many input fields that need a color choice, so using defines and set commands for each individual field I have is just not efficient at all.
-
set(#testgetfiles, $get files("{$special folder("Application")}\\images", "No"), "Global")
I said before you need to change that NO to a YES!! http://www.ubotstudio.com/forum/index.php?/topic/16789-why-do-i-get-an-error-with-get-files/&do=findComment&comment=100666
set(#testgetfiles, $get files("{$special folder("Application")}\\images", "Yes"), "Global")
in the get files node there is a drop down
under the file path...the second input field
include path Yes/No
that means to include the file path special folder("Application")}\\images
TC
PS
make sure you have some files in there too
Setting that to "YES" does not include the extra file path, it includes the full file-path of the files in the folder.
IE full path YES displays getfiles results as, C:\\path\to\files\image.jpg
full path NO displays getfiles results as, image.jpg
So again, that does not work. And regardless, if I have it set to YES or NO, it does not work.
Did you try that code yourself or just put it into Ubot and assumed that it works?
-
I have like 20 text input fields that need to have this dialogue attached to them.
How do I include the color picker dialogue on UIHTML panel text input fields?
-
It doesn't work. This should work.
Test it in yours, if it works for you I'm going to be upset lol... I restarted everything.
set(#testgetfiles, $get files("{$special folder("Application")}\\images", "No"), "Global")
- 1
-
If you try to get to any folders within the 'specialfolder' with a get files command it doesssss nottttt workkkk.
Your code above was pulling some really strange results..
-
That doesn't work. I thought it did because I didn't get the error.
Those trailing slashes, I don't believe should be outside the $get files command. And when you put them inside, it doesn't work.
-
lol, I swear I tried that like 10 times. 11th time worked ???
-
set(#testgetfiles, $get files("{$special folder("Application")}\\folder", "No"), "Global")
does not work, whyy
Compiled Bot Installer - Chime In With Your Best Setup And Usage
in General Discussion
Posted
How does the built-in installer work? I noticed nobody has shared any solid feedback on that yet.