Jump to content
UBot Underground

Recommended Posts

Can anyone tell me what the proper syntax would be to pass a text variable as a parameter to a command from the "load html" window... Here's what I've done...

 

This does not work at all.. like you didn't even click the button...

<button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething(\"{#param}\")\')\">DO SOMETHING</button>

This seems to work just fine IF the #param is a numeric value

<button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething({#param})\')\">DO SOMETHING</button>

I also tried the first one with single ' around the {#param} and it did the same as a single quote...

 

SOLVED:  As I typed out the above it gave me one last idea to try, I eliminated the {} around the #param (which was put there by the node view) and it worked!  It does not show up in nodeview as a highlighted variable but it works now anyway...

Link to post
Share on other sites
  • 3 weeks later...
<button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething(123)\')\">DO SOMETHING</button>

this works, but this not:

<button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething(TEST)\')\">DO SOMETHING</button>

Solution?

Link to post
Share on other sites

Yes, sorry, I do have a solution... here is some example code... I'm only using the on load to set the #param variable to something to demonstrate passing it. I purposfully used a different variable name #test in the define to make it easier to understand and see that its working. so... the variable #param is passed from the button into the dosomething command and read into a new variable called #test. You cannot (for some reason) pass plain text in the parameter, at least not like this, and it has to start off as a variable.

on load("Bot Loaded") {
    set(#param, "Testing", "Global")
}
ui html panel("<button onclick=\"ubot.runScript(\'dosomething(#param)\')\">DO SOMETHING</button>", 100)
define dosomething(#test) {
    alert(#test)
}

Hope that helps... now... if I could just figure out how to pass multiple parameters like this I'd be even more happy!

  • Like 1
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...