Jump to content



Photo

[Tut]-"define"- The How To Use Them And Why You Should Always Use Them!

methods defines how to use defines functions commands custom commands custom functions

  • Please log in to reply
21 replies to this topic

Poll: [Tut]-"define"- The How To Use Them And Why You Should Always Use Them! (8 member(s) have cast votes)

Do you like the Dark look?

  1. Yes (5 votes [62.50%])

    Percentage of vote: 62.50%

  2. No (3 votes [37.50%])

    Percentage of vote: 37.50%

Vote Guests cannot vote

#1 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 12 March 2016 - 10:38 PM

Hi!

 

In this tutorial I will attempt to show you how to use a "define" command/function, I call them "methods". A method can be a group of nodes or just one node that accomplishes a specific task. Much like if you have separate tabs to do different things in your program. Tabs are containers, defines are custom containers that can contain groups of other commands and functions even your custom commands/functions.

 

Why do I need to do all this extra work man?

  • Saves memory - Local variables and list are not saved to memory when used inside defines. :)
  • Reusable code - You can reuse these methods again and again in your program.
  • Readability - You can name your methods to be more descriptive and not waist time thinking about it for a few minutes. You know what it is at a glance.
  • Errors - When you throw an error you will see exactly which define it came from by its name.
  • Developing - When the scope is Local it does not show in the debugger. This means less memory to refresh and fewer restarts of the studio.
  • Accessibility - You can find your code much easier.
  • Your own libraries - Soon you will have a library to use over and over, it just gets easier as you go. You can share these with others in the bot bank or in your private bot bank. From the bank you can just drag them on over with out the actual define and it will compile just dandy.
  • Leaner & Meaner programs are better! UBot is 32bit and it only gets 3-4 GB of Ram per process so, we need to trim the fat.

Custom Commands

Much like the commands given to you in UBot, a group of them may be called a "sub routine", those nodes can be put in a diefine. You can put a set of commands/nodes into the define container and run those synchronously to get the desired resuklt and use it more than once throughout your code.

Ubot Forum Login("", "")
define Ubot Forum Login(#USER NAME, #PASSWORD) {
    clear cookies
    navigate("http://network.ubotstudio.com/forum/","Wait")
    wait for element(<password field>,15,"Appear")
    comment("sign in")
    click(<login link>,"Left Click","No")
    wait for element($element offset(<username field>,0),10,"Appear")
    type text($element offset(<username field>,0),#USER NAME,"Standard")
    type text($element offset(<password field>,0),#PASSWORD,"Standard")
    click($element offset(<login button>,0),"Left Click","No")
    wait for element(<login link>,15,"Appear")
}

Just supply some parameters, a user name and a password. You can see that it has a dynamic nature where those two field always change.

 

 

Custom Functions - are a little more snazzy and very helpful. The purpose of a function is to return something. Anything under "Parameters" the tool box are functions. Thin about what they do, like $next list item, this returns/gives you the next list item. It auto increments the list position and keeps track of where it is for you.
The function $list from file, it reads in all the lines of a file and the parameter is a file path.

Or $scrape page, it return to you the text of a page with in the parameters given. The $document text function is a good one, it "returns" whatever is in the UBot browser window so you may manipulate or do as you wish with it.

alert($file name("C:\\somedirectory\\filename.csv"))
define $file name(#PATH) {
    return($replace regular expression(#PATH,".*?\\\\|\\..*",$nothing))
}

Someone gave you some regex to get the filename .*?\\|\..*

Do you want to remember that regex?

Do you want to remember how to use it?

Of course not, just make the function and save it somewhere for future use. Also, you can reuse that function for another filename somewhere else in your code.

 

 

Typically, I put Custom Commands and Custom Functions in their own tabs and when I compile, I hide them so users don't see them. In larger programs. These tabs can get very big and I split them off to reduce the render times of each tab.

Attached File  tabs-funcs-commands.PNG   188.21KB   10 downloads

 

Another cool thing about these Methods are you can pass variables and functions via parameters. Parameters are bits of data you may need to share between defines or from other places, like from files or lists etc.

Attached File  Parameters.PNG   7.98KB   6 downloads

s

In addition there is this notion called a "Scope". You may have noticed inside lists and sets there is a drop down to set the "Scope" to the default "Global" or "Local". Local means the data contained in a variable or list is localized to the define that "list" or "set" node it resides in. It also means it wont be seen in the debugger. So when it works that is the time to change necessary nodes to "Local". This is a must do while multi - threading.

Attached File  scope.PNG   6.15KB   6 downloads

 

When you create your own methods they will show up in the search box or in the toolbox either under Commands>>Custom Commands or Parameters>>Custom Functions like so.

Attached File  cust-commands.PNG   11.5KB   7 downloads

 

For some more info on defines you can see the wiki custom commands post here
 

In the attached .ubot file are some examples and a basic search bot,they are fully commented.

 

The First Tab - "UBot Forum Search"

Attached File  Tab-1-ubot-forum-search.PNG   61.99KB   8 downloads

 

This is a simple bot to demo all the methods together.

 

In the next tab "Examples" are the how to do's.

 

The Function tab contains the respective functions and same with  the "Commands" tab.

 

Building Functions and Commands

 

When I build a command I do so in the tab I am making it for initially. Then I go to code view (ctrl + i), cut it and paste into commands tab where I need it to go. Then I switch back to node view (ctrl+i) and save with (alt + f + s). This saves from all that tab switching. i also will build them right in the commands tab. Like a login sequence.

 

In order to run a define you must drag your command into the node view box from the toolbox or search box. Then I right click and run. If it is the only command then you can press the F5 key.


Testing and Building Functions

 

I usually test a function in an "Alert" command and build it in the "Functions" tab. Then place my functions where needed.

 

When should I make a Method?

If you are copying and pasting a node or group of nodes more than once it is time to make that baby/those babies into a method.

Sometimes you just have to use a variable and others they should be a made into a function. Setting variables chops away at precious memory.

 

 

Methods have many hidden secrets that you can only find with practice.

Feel free to ask questions if anything is unclear, after all I made this for you to learn.

 

 

Download this from the UBot Store

 

 

The UBot tutorial for this store item is here.

 

Enjoy,

CD(Nick)

 

P.S.

 

For those interested in my Dark IDE look..

press the windows key and + key to activate the windows magnifier

win key plus + zooms in

win key plus - zooms out

ctrl + alt + i    inverts the colors

 

and if you like the darkness then +1
The feature requests is in the tracker.

 

http://tracker.ubots...=✓&q=dark theme

 

Take the poll too. Keep in mind you don't have control over the colors when inverting.
So, obviously we would like to change those to suit our needs. :)


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#2 davidford76

davidford76

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 149 posts
  • LocationDayton Ohio
  • OS:Windows 10
  • Total Memory:2Gb
  • Framework:v3.5
  • License:Professional Edition

Posted 12 March 2016 - 10:54 PM

Thanks for putting this tutorial out. I will be trying to learn define commands. I know it can be a huge benefit to learn.


Ask me how to get my full version of Backpage Poster Program for FREE!! If your in need of traffic software I have several for sale!

 

Easy way to sell your bots post your bots for sale by ==>Clicking Here<==

 

 


#3 giganut

giganut

    softwareautomation.org

  • Fellow UBotter
  • PipPipPip
  • 535 posts
  • LocationLost In Space!
  • OS:Windows 10
  • Total Memory:4Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 12 March 2016 - 11:01 PM

Killin it man!  :)  this is a great tut, much appreciation and respect for tasking the time to share that with us.


softwareautomation-banner.png


#4 jeepinjeff

jeepinjeff

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 30 posts
  • OS:Windows 8
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 12 March 2016 - 11:08 PM

Saaaweeeeeet!

 

Kudos, brother!



#5 CanadaJones

CanadaJones

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 44 posts
  • Location127.0.0.1
  • OS:Windows Server 2008
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 13 March 2016 - 07:01 AM

Nick,

Thank you VERY MUCH for sharing this with us! I have 2 questions if you wouldnt mind me asking.

 

1. You said: 

 

"Typically, I put commands and functions in their own tabs and when I compile I hide them so users don't see them."

 

Is hiding the tabs in compile a basic feature to compile (I havent compiled my first bot yet), or is there some secret sauce to this as well?

 

2. You said:

 

"When I build a command I do so in the tab I am making it for initially. Then I go to code view (ctrl + i) cut it and paste into commands tab where I need it to go."

 

Do you leave the command in the tab that you were making it for initially after you've copied and pasted what was in code view into the commands tab, or do you remove it?



#6 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 13 March 2016 - 07:31 PM

Thanks guys!!! Glad you think this is cool.

 

For those interested in my Dark IDE look..

press the windows key and + key to activate the windows magnifier

win key plus + zooms in

win key plus - zooms out

ctrl + alt + i    inverts the colors

 

and if you like the darkness then +1
these feature requests in the tracker

 

http://tracker.ubots...=✓&q=dark theme

 

take the poll as well


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#7 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 14 March 2016 - 02:52 AM

Just want you to know this is also a supplement to this thread too

http://network.ubots...ed/#entry119591


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#8 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 14 March 2016 - 03:04 AM

Nick,

Thank you VERY MUCH for sharing this with us! I have 2 questions if you wouldnt mind me asking.

 

1. You said: 

 

"Typically, I put commands and functions in their own tabs and when I compile I hide them so users don't see them."

 

Is hiding the tabs in compile a basic feature to compile (I havent compiled my first bot yet), or is there some secret sauce to this as well?

 

2. You said:

 

"When I build a command I do so in the tab I am making it for initially. Then I go to code view (ctrl + i) cut it and paste into commands tab where I need it to go."

 

Do you leave the command in the tab that you were making it for initially after you've copied and pasted what was in code view into the commands tab, or do you remove it?

1. When you compile a bot you have more options like in the image I provided. Try to compile the bot provided, don't be suurred.

 

ctrl + shift + c then you will see many options you can cancel at anytime.

 

 

2. When you CUT it is removed from the tab it was created in and them paste it into "Commands" tab,

I did not say copy.

 

You definitely DO NOT want more than one define for the same command or function.

 

Make sense?


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#9 Sebastian Rooks

Sebastian Rooks

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts
  • OS:Windows 10
  • Total Memory:4Gb
  • Framework:v4.5+, unsure
  • License:Professional Edition

Posted 14 March 2016 - 08:47 PM

I'm on a define kick myself. Or rather they're kicking my.....

I've got a bot using twenty something includes. I thought I was going to be streamlined and efficient, but I don't think I've made any honest forward progress in the last 12 straight hours of effort.

 

A lot of my defines have other defines included with them. I've been crashing all day, and I think I'm almost to the bottom of it?

 

Can you not use a define to call another define? That seems to be what's doing me in right now. Emphasis on "seems" because I usually end up being wrong.

 

Anyway, thanks for the tutorial



#10 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 15 March 2016 - 03:27 AM

Hey S.B!

Ya, you can all day long. Your problem may be that you need to pass variables between them thru parameters.

 

Especially if they are scoped as "Local" and not "Global".

It should be pretty clear in the OP and in the bot provided.

 

"In addition there is this notion called a "Scope". You may have noticed inside list and set's there is a drop down to set the Scope to the default "Global" or "Local". Local means the data contained in a variable or list is localized to the define that "list" or "set" node it resides in. It also means it wont be seen in the debugger. So when it works that is the time to necessary nodes to "Local"."
 

and

 

"Another cool thing about these Methods are you can pass variables and functions via parameters. Parameters are bits of data you may need to share between defines or from other places like from files or lists etc."

 

 

If not lemme know and I will see if I can make it clearer. It is really hard to be a noob when you are not.

 

So, I want everyone to understand especially new folks.

Look in the bot as well as it is demonstrated in it.

Hope this helps,
CD

 


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#11 CanadaJones

CanadaJones

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 44 posts
  • Location127.0.0.1
  • OS:Windows Server 2008
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 16 March 2016 - 06:32 PM

@Nick,

 

2 questions:

 

1. Could you elaborate a bit on both the purpose of functions, and commands, as well as how they're different? After closely examining the example robot provided to us in this thread, I noticed that there is a functions tab, and a commands tab, and each tab has a "Define My Function" and "Define My Command", and im very hazy as to what each is supposed to do.

 

2. I noticed in your Defines you have Parameters, and Returns.  This is something that I havent seen alot of in my limited experience of Ubot, and I think learning it in the beginning would help us all out on getting off to a great start.

 

Thanks as usual bro!



#12 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 16 March 2016 - 08:11 PM

Everything under "Commands" in the toolbox are examples of a command. When you make your own custom command you can make it so what you want to do and name it what you want.

 

Everything under "Parameters" which should be called "Functions" are examples of a function. Except you might pass it parameters that the function can operate on then give you (return) the desired result.

 

They both run a sequence of commands and functions to do something which is desired by you.

 

The more you make the more creative you will become with them.

 

Try starting with a login procedure. Then use that custom command to login and post a blog. Make another to login and update plugins,
You will see you can use the login custom command for both procedures.

 

I assure you they will become addicting.

 

Hope that helps,

CD
 


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#13 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 16 March 2016 - 08:23 PM

A Command is a statement. A custom command(define) can hold many statements (commands/custom commands).

 

A Function is  a question. This is why it returns an answer. These can only be used in a command/custom command.

 

Parameters

 

passing parameters are like passing or handing off a football

except we can pass a variable, function, list or tables and such

 

like so

 

param exmple("I passed a parameter thru a command")
define param exmple(#something to pass) {
    alert(#something to pass)
}

 

same concept with a function

 

in the examples tab of the attached bot you can see another example


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#14 LordPorker

LordPorker

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 121 posts
  • LocationUK
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5
  • License:Developer Edition

Posted 24 April 2016 - 02:37 PM

Ye said:

 

In addition there is this notion called a "Scope". You may have noticed inside list and set's there is a drop down to set the Scope to the default "Global" or "Local". Local means the data contained in a variable or list is localized to the define that "list" or "set" node it resides in. It also means it wont be seen in the debugger. So when it works that is the time to change necessary nodes to "Local". This is a must do while multi - threading.

 

 

So re the debugger; during testing you set either list or set as Global in order to view the results? Then, once it's all ready, you change it to Local?

 

If so, are there any other UB commands that need the same treatment?

 

Great tut btw! Kudos for helping us out.



#15 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 24 April 2016 - 08:55 PM

Your welcome guys,

 

As far as I know LP.

 

 

Glad I can help!


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#16 ILoveUBot

ILoveUBot

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 95 posts
  • LocationScotland
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 06 May 2016 - 04:52 AM

This is a really useful tutorial Code Docta. I've been using define commands for a long time, but I've never created define functions. 
 
Here is an example of when I use defines and then a lot of set commands within a define. Is there a way to turn these set commands into functions that would be cleaner and more efficient? I'm struggling to get my head round it. 
 
 
setup()
personOne()

divider

define personOne {
    set(#row,0,"Global")
    credentials()
}
define personTwo {
    set(#row,1,"Global")
    credentials()
}
define personThree {
    set(#row,2,"Global")
    credentials()
}

divider

define setup {
    clear table(&pinAccs)
    create table from file("{$special folder("Application")}\\pinterestAccs.csv",&pinAccs)
}
define credentials {
    clear cookies
    set(#firstName,$table cell(&pinAccs,#row,0),"Global")
    set(#lastName,$table cell(&pinAccs,#row,1),"Global")
    set(#email,$table cell(&pinAccs,#row,2),"Global")
    set(#day,$table cell(&pinAccs,#row,3),"Global")
    set(#month,$table cell(&pinAccs,#row,4),"Global")
    set(#year,$table cell(&pinAccs,#row,5),"Global")
    set(#gender,$table cell(&pinAccs,#row,6),"Global")
    set(#country,$table cell(&pinAccs,#row,7),"Global")
    set(#county,$table cell(&pinAccs,#row,8),"Global")
    set(#address line1,$table cell(&pinAccs,#row,9),"Global")
    set(#address line2,$table cell(&pinAccs,#row,10),"Global")
    set(#city,$table cell(&pinAccs,#row,11),"Global")
    set(#postcode,$table cell(&pinAccs,#row,12),"Global")
    set(#title,$table cell(&pinAccs,#row,13),"Global")
    set(#phonenumber,$table cell(&pinAccs,#row,14),"Global")
    set(#countryUK,$table cell(&pinAccs,#row,15),"Global")
    set(#age,$table cell(&pinAccs,#row,16),"Global")
    set(#houseNumber,$table cell(&pinAccs,#row,17),"Global")
    set(#password,$table cell(&pinAccs,#row,18),"Global")
    set(#username,$table cell(&pinAccs,#row,19),"Global")
    set(#pin_UN,$table cell(&pinAccs,#row,20),"Global")
    set(#pin_Pass,$table cell(&pinAccs,#row,21),"Global")
}


i

#17 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 08 July 2016 - 11:33 AM

Sorry Iloveubot!

just saw this, lemme throw it in the ide and take a lookisy!


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#18 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 08 July 2016 - 12:42 PM

ok, took a look.

Do you run the users separately?

Do you need to see these credentials in a UI?

Do you need the credentials in more than one place? like a UI and saving to a log file or if a certain condition exist

In any case,

this is what I came up with so far

 

comment("false is Local to not see in debugger and waist studio
memory and used for threading
true is Global to see in debugger

I often use a UI check box for this. 
It is easier to switch")
set(#debug_scope,"true","Global")
setup()
set(#row index,0,"Global")
comment("can do table total rows")
loop(3) {
    credentials(#row index)
    comment("can throw a pause in here")
}
divider
comment("I would change define name to 
Load Accounts Table")
define setup {
    clear table(&pinAccs)
    create table from file("{$special folder("Application")}\\pinterestAccs.csv",&pinAccs)
}
comment("I would change these to local
you can make a debug function to make it easy
to change all to local and back to global")
comment("it is just a convention of mine to capitalize 
define parameters")
define credentials(#ROW) {
    clear cookies
    set(#firstName,$table cell(&pinAccs,#ROW,0),$debug SCOPE(#debug_scope))
    set(#lastName,$table cell(&pinAccs,#ROW,1),$debug SCOPE(#debug_scope))
    set(#email,$table cell(&pinAccs,#ROW,2),$debug SCOPE(#debug_scope))
    set(#day,$table cell(&pinAccs,#ROW,3),$debug SCOPE(#debug_scope))
    set(#month,$table cell(&pinAccs,#ROW,4),$debug SCOPE(#debug_scope))
    set(#year,$table cell(&pinAccs,#ROW,5),$debug SCOPE(#debug_scope))
    set(#gender,$table cell(&pinAccs,#ROW,6),$debug SCOPE(#debug_scope))
    set(#country,$table cell(&pinAccs,#ROW,7),$debug SCOPE(#debug_scope))
    set(#county,$table cell(&pinAccs,#ROW,8),$debug SCOPE(#debug_scope))
    set(#address line1,$table cell(&pinAccs,#ROW,9),$debug SCOPE(#debug_scope))
    set(#address line2,$table cell(&pinAccs,#ROW,10),$debug SCOPE(#debug_scope))
    set(#city,$table cell(&pinAccs,#ROW,11),$debug SCOPE(#debug_scope))
    set(#postcode,$table cell(&pinAccs,#ROW,12),$debug SCOPE(#debug_scope))
    set(#title,$table cell(&pinAccs,#ROW,13),$debug SCOPE(#debug_scope))
    set(#phonenumber,$table cell(&pinAccs,#ROW,14),$debug SCOPE(#debug_scope))
    set(#countryUK,$table cell(&pinAccs,#ROW,15),$debug SCOPE(#debug_scope))
    set(#age,$table cell(&pinAccs,#ROW,16),$debug SCOPE(#debug_scope))
    set(#houseNumber,$table cell(&pinAccs,#ROW,17),$debug SCOPE(#debug_scope))
    set(#password,$table cell(&pinAccs,#ROW,18),$debug SCOPE(#debug_scope))
    set(#username,$table cell(&pinAccs,#row,19),$debug SCOPE(#debug_scope))
    set(#pin_UN,$table cell(&pinAccs,#ROW,20),$debug SCOPE(#debug_scope))
    set(#pin_Pass,$table cell(&pinAccs,#ROW,21),$debug SCOPE(#debug_scope))
}
define $debug SCOPE(#SCOPE) {
    comment("in most cases you don't need to pass a variable
but
it can be useful for setting different scopes in other
sections of code")
    if(#SCOPE) {
        then {
            return("Global")
        }
        else {
            return("Local")
        }
    }
}

With more info I can help a lil more but I hope this give a better idea to you.

Hope that helps,
CD


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#19 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1488 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 08 July 2016 - 12:57 PM

Also,

You may need to put the custom function I made on top of the custom commands.
This is another reason I put them in other tabs so no need to think about which comes first.

It does matter if they're in the same tab.


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#20 deliter

deliter

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 613 posts
  • OS:Windows 8
  • Total Memory:More Than 9Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 08 July 2016 - 03:24 PM

nice thread

 

just to elaborate on this particulary what ILoveUbot was asking about custom commands and functions

 

A custom command just like the ubot commands,the blue coloured nodes, do not return a result,so they carry out an action

 

Functions,the green nodes in Ubot,pretty much all of them return a result,data input-data output,so functions are made when you want to input something and have data returned in some form

 

define $addNumbers(#first, #second) {
    return($add(#first,#second))
}
set(#addMe,$addNumbers(1, 2),"Global")







Also tagged with one or more of these keywords: methods, defines, how to use defines, functions, commands, custom commands, custom functions

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users