Jump to content
UBot Underground

How To Pass A Text Parameters To Html Panel?


Recommended Posts

How to pass a text parameter to HTML panel?

 

example:

ui html panel("<button onclick=\"ubot.runScript(\'SetStatus()\')\">GOOD</button>
<button onclick=\"ubot.runScript(\'SetStatus()\')\">BAD</button>
",100)
define SetStatus(#Status) {
    alert(#Status)
}

On click GOOD should alert "Good"

 

I've tried:

ubot.runScript(\'SetStatus(Good)\')
ubot.runScript(\'SetStatus('Good')\')
ubot.runScript(\'SetStatus(\"Good\")\')

Any idea how to do that?

 

 

I want to use only 1 define

ubot.runScript(\'SetStatus(#different var for each button)\')
Link to post
Share on other sites

To output a status to HTML:

<span variable="#status" fillwith="innerhtml"></span>

To use button for action on a define i.e click_me() :

<input type="button" title="Button" value="Click Me" onclick="ubot.runScript('click_me()')">

To better play with HTML i would recommend you looke a Darryl's GUI Hero or at LazyBotter's SSUB

  • Like 1
Link to post
Share on other sites

If I'm right about what you are trying to do the code below should do it.

 

Where you have ubot.runScript(\'SetStatus(Good)\') you need to replace Good with a numerical value.

ui html panel("<button onclick=\"ubot.runScript(\'SetStatus(0)\')\">GOOD</button>
<button onclick=\"ubot.runScript(\'SetStatus(1)\')\">BAD</button>
",100)
define SetStatus(#Status) {
    if($comparison(#Status,"= Equals",0)) {
        then {
            set(#Status2,"Good","Global")
        }
        else {
            set(#Status2,"Bad","Global")
        }
    }
    alert(#Status2)
}
Link to post
Share on other sites
  • 2 weeks later...

 

You can pass a string by encoding the quotes:

ui html panel("<input type=\"button\" value=\"Alert Button\" onclick=\"ubot.runScript(\'AlertMe("my string")\')\">",100)
define AlertMe(#string) {
    alert(#string)
}

 

 

Why do they bother making features, if their not going to document it, thanks for posting this

Link to post
Share on other sites

just on this to pass ubot commands arguments from ubot.runScript on Javascript, just use the blackslash before quotations, thanks HInsomnia for this, never thought ubot could pass arguments from Javascript, really handy

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...