Bots and Forum Script: This way to the Future™!

Started by Legend, Jan 05, 2016, 05:07 AM

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

Legend

    WORK IN PROGRESS. YOU CAN GO TO YOUR PROFILE AND SET UP A BOT, BUT CURRENTLY I AM NOT APPROVING THEM. INFORM ME ABOUT ERRORS.



    Bots and Forum Script


    Sections




    Introduction-The Basics


    What are bots, you may ask.

    They're automated programs that act as personal assistants, capable of doing most everything members can do. They aren't here to replace intellectual conversations, just help out with the more trivial tasks. For example it's tedious to tally up open ended votes in a thread, yet a bot can do it without breaking sweat.

    Bots are made up of two essential components, the trigger and the brain. The trigger sets up the bot, while the brain decides what actions the bot performs. Triggers are broken down into 13 different types.

    No Trigger-The bot lacks a trigger, so it will never run on its own. Instead it needs to be called by another bot.

    Specific Time-The bot awakes within a minute the nearest desired time, and will reawake at the next desired time.

    Public Actions
    New Post-The bot is triggered when a new post is made in any topic you can see.
    Post Edit-The bot is triggered when a visible existing post is edited.
    New Wall Comment-The bot is triggered when a new wall comment is made on any wall you can see.
    Wall Comment Edit-The bot is triggered when a visible existing wall comment is edited.
    New Topic-The bot is triggered when a new topic is made in any board you can see.
    Topic Edit-The bot is triggered when a visible existing topic is edited.

    Personal Actions
    Receive PM-The bot is triggered when you receive a personal message.
    Post Liked-The bot is triggered when one of your posts is liked.
    Comment Liked-The bot is triggered when one of your wall comments is liked.
    Topic Liked-The bot is triggered when one of your topics is liked.
    Profile Liked-The bot is triggered when your profile is liked.
    Buddy Requested-The bot is triggered when someone else requests you as a buddy.
    Buddy Accepted-The bot is triggered when someone accepts your buddy request.
    Formal Moderation-The bot is triggered when you receive a formal moderation. (not set up)

    In addition, each trigger has its own set of unique parameters. These allow you to define which content is allowed through triggers, such as limiting the Wall Comment triggers to just your wall. The triggers also pass on relevant information to the brain, such as the ID of the edited message.


    The brain itself is fully open ended with literally infinite applications. It's written in Forum Script, a modified version of PHP tailor made for the VizionEck forum. Even though Forum Script is secure and does not have any security holes against the forum itself, it's still very dangerous to give members this much raw power. Thus all bots need admin approval before they will function.



    Setting Up Your First Bot


    To begin, open up your profile in a new tab. Then hover over 'Forum Profile', and go to the bottom of the list. 'Bot settings' handles universal bots I have setup for every user, while 'Your Bots' is what we want here. Simply click 'New Bot' in the bottom right corner.



    'Name' is whatever you want to call this bot, while 'Description' is its description. Both of these are mainly just for your self management, but the description will help me when approving the bot's brain.

    For this tutorial let's call it 'Profile Responder' and describe it 'Responds to comments on my wall.'



    The trigger is a simple drop down menu. Select  'New Wall Comment'. Then in the trigger parameters box we need to set it up to only trigger when the comment is on our wall. Type 'Profile=mine'.



    All that's left is the brain! What we're going to do is make the bot mention the poster by name, and then tell them to get of our lawn. With Forum Script, this is super easy.
    $message='Hey ' . $trigger['posterName'] . '

    Get off my lawn!';

    NewWallMessage(message=$message);

    Press save and you're good to go! If you've done everything correctly, I'll have it approved in a giphy.



    Forum Script For Beginners


    It's pretty easy to tell which parts did what in the example code.

    The '$' is used to define variables, just like in PHP. Variable names can contain any letter and number combination, just no spaces. '$my variable' is not allowed. Instead of spaces, you may use underscores or capitalize the next letter. Variables are case insensitive and underscore insensitive, so $myVariable is equal to $My_variAble. Just go with whatever you prefer.

    Variables can be numbers, bools, strings, or arrays. IE $bool=true; $number=7; $string='Hello World', $array=array( 'entry 1' => 7, 'entry 2' => 'green', false, 'entry 4' => array(), );

    These work exactly like PHP so if you're still confused, search up a PHP tutorial.

    The period between the 'Hey ' string and the trigger variable is used to stitch both together into a single string. It's the equivalent of + for text.

    $trigger is an array passed on from the trigger. In the case of the 'New Wall Comment' trigger, it includes profileID, posterID, posterName, message, messageID, and subject.

    NewWallMessage() is an internal Forum Script function. Just like variables, functions in Forum Script are case and underscore insensitive. Information can be passed into functions four different ways. The first is to assign the variable like in an array. '(message=$message, subject=$sub_variable)'

    The second way is standard PHP, by entering variables in order. '($message, $sub_variable)' It's generally not recommended.

    The third way is to use variables with identical names to the parameters. '(message, subject=$sub_variable)' works since 'message' and $message are identical. The variable is automatically assigned.

    The fourth and most risky way is to let Forum Script do it all for you. '($, subject=$sub_variable)' The $ will automatically assign $message, but it will also automatically assign all other variables matching parameters. In the case of the above example where we aren't posting multiple messages, ($) is a great time saver. Use (&$) if you want all magically attached variables to be unset after the function runs.


    Advanced Bot Triggers and Parameters



    Here is a list of all triggers and details on all potential parameters. I means input only, O means output only, IO means both.

    Specific Time (assumed military time on local timezone unless otherwise stated)
    • Year-number IO
    • Month-number or month name IO
    • Day-number of month or name of day IO
    • Hour-number IO
    • Minute-number IO
    • Date-Text date, IE 12/21 or December 21st or 10th of November 2016. Assumed to be month/date I
    • Time-Text time, IE 3:42 PM GMT I
    • Period-Text AM or PM IO
    • Timezone-Text IO
    • Week-Text, structure is which_week, day of week. IE first Tuesday or second to last Monday. Only sets the week, not the day I
    • DayName-Text O
    • MonthName-Text O


    New Post
    • Board-number or board name IO
    • Category-number or category name IO
    • Topic-number or 'mine' IO
    • MessageID-number IO
    • Poster-number or 'mine' IO
    • Subject-Text O
    • Message-Text O
    • PosterName-Text O


    Edit Post
    • Board-number or board name IO
    • Category-number or category name IO
    • Topic-number or 'mine' IO
    • MessageID-number IO
    • Poster-number or 'mine' IO
    • Subject-Text O
    • Message-Text O
    • PosterName-Text O


    New Comment

    • Profile-number or 'mine' IO
    • MessageID-number IO
    • Poster-number or 'mine' IO
    • Subject-Text O
    • Message-Text O
    • PosterName-Text O

    [/li][/list]

    Edit Comment
    • Profile-number or 'mine' IO
    • MessageID-number IO
    • Poster-number or 'mine' IO
    • Subject-Text O
    • Message-Text O
    • PosterName-Text O

    [/li][/list]

    New Topic
    • Board-number or board name IO
    • Category-number or category name IO
    • Topic-number or 'mine' IO
    • MessageID-number IO
    • Poster-number or 'mine' IO
    • Subject-Text O
    • Message-Text O
    • PosterName-Text O


    Edit Topic
    • Board-number or board name IO
    • Category-number or category name IO
    • Topic-number or 'mine' IO
    • MessageID-number IO
    • Poster-number or 'mine' IO
    • Subject-Text O
    • Message-Text O
    • PosterName-Text O


    New PM
    • Sender-number or 'mine' IO
    • Subject-Text O
    • Message-Text O
    • SenderName-Text O


    Post Like
    • Board-number or board name IO
    • Category-number or category name IO
    • Topic-number or 'mine' IO
    • MessageID-number IO
    • Liker-number IO
    • Subject-Text O
    • Message-Text O
    • PosterName-Text O


    Comment Like
    • Profile-number or 'mine' IO
    • MessageID-number IO
    • Liker-number IO
    • Subject-Text O
    • Message-Text O
    • LikerName-Text O


    Topic Like
    • Board-number or board name IO
    • Category-number or category name IO
    • Topic-number or 'mine' IO
    • MessageID-number IO
    • Liker-number IO
    • Subject-Text O
    • Message-Text O
    • LikerName-Text O


    Profile Like

    • Liker-number IO
    • LikerName-Text O


    Buddy Requested
    • Buddy-number IO
    • BuddyName-Text O


    Buddy Accepted
    • Buddy-number IO
    • BuddyName-Text O





    All Forum Script Functions



    Coming Soon!™

    Xbro

    Okay, requesting some stuff to do with money. Like depositing everything at the end of the day, or drawing some money out in advance mid-day, so I don't miss the steal moneys for that day.

    Also could we get a trigger for when our money amount changes more than $2?
    3 people like this

    Legend

    Okay, requesting some stuff to do with money. Like depositing everything at the end of the day, or drawing some money out in advance mid-day, so I don't miss the steal moneys for that day.

    Also could we get a trigger for when our money amount changes more than $2?
    Fish and some others and I have been wanting for a long time to turn the shop into a fully fledged RPG. Add a ton more items, add more ways to interact, add NPCs, etc.

    I think it's best for us to fully lay out our plans for that before integrating bots with the shop. As is bots would be way too overpowered, and decrease the shop's already low engagement.


    With that said, this new and improved bot system and forum script are very flexible. Adding a trigger takes only a few minutes. If other people agree with you that bots should be implemented now, I can have it up in a jiffy.

    Xbro

    I see...

    Well another good trigger is when an item goes up for sale.
    3 people like this

    Legend

    I see...

    Well another good trigger is when an item goes up for sale.
    I think I figured out a good way to handle it...

    Forum RPG here we come!

    Dr. Pezus

    Well, Zuckerberg is doing it so why not!

    kitler53

    if this site starts to feel like i'm having conversations with bots i will quit.  i formally state i think this is the worst idea ever.


    Featured Artist: Vanessa Hudgens

    Legend

    if this site starts to feel like i'm having conversations with bots i will quit.  i formally state i think this is the worst idea ever.
    Haha no, don't make the mistake of thinking these bots will be impersonating human conversation. All bot posts are tagged as such, and they should be rare to begin with.


    What they do is allow easy one off expansion of forum features. For example take this thread: The Youtube Gamer interestometer

    That's the type of thing bots are designed for.

    the-pi-guy

    Haha no, don't make the mistake of thinking these bots will be impersonating human conversation. All bot posts are tagged as such, and they should be rare to begin with.


    What they do is allow easy one off expansion of forum features. For example take this thread: The Youtube Gamer interestometer

    That's the type of thing bots are designed for.

    These numbers are way off.  Crazy that the FFVII video hit 13m, and U4 hit 6.4m, Horizon is at ~3.9m.

    Meanwhile from the Xbox conference, PVZ is way the highest with 5m, after Halo in 2nd, it drops down to less than 1m.  

    Legend

    These numbers are way off.  Crazy that the FFVII video hit 13m, and U4 hit 6.4m, Horizon is at ~3.9m.

    Meanwhile from the Xbox conference, PVZ is way the highest with 5m, after Halo in 2nd, it drops down to less than 1m.  
    Yeah last edit was in June.

    the-pi-guy

    Yeah last edit was in June.
    Yeah.  Think FFVII will be huge though.  

    the-pi-guy

    Is there some sort of advanced forum script tutorial?  

    Legend

    Is there some sort of advanced forum script tutorial?  
    I need to fix up the forumscript compiler. Got distracted with the RPG.

    the-pi-guy

    I need to fix up the forumscript compiler. Got distracted with the RPG.
    I understand.  
    I'm trying to work on my bot.  :D
    But I don't know what else it can do.  

    the-pi-guy

    Jan 09, 2016, 04:57 AM Last Edit: Jan 09, 2016, 05:03 AM by the-pi-guy
    I'd like to know what the commands for
    -editing a post
    -replacing text in a string, or give me a for loop and if and charAt statement. 

    Go Up