I have a cat named Mittens. Now that you are bonded with it please login or register so that I dont have to eat him for dinner.

Current time: 07-29-2010, 10:42 PM Hello There, Guest! (LoginRegister)

This ad will disappear when you log in.


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to code random values In Expression
Author Message
JulioGarcia Offline
FAEG

Posts: 431
Joined: May 2009
Post: #1
Aperture How to code random values In Expression
To start off Name the expression.

@name Random Values And Chatbot test

We need to define output(s) for it also
But for these, we don't have to.

@outputs A

We shouldn't need to have inputs for this type of expression
The Code

First off,
We Need to write the random line.

A=round(random(1,10))

Now, That would make A Be a random value between 1 and 10 every 0.1 seconds.

This is good for random responses in chat bots,

B=round(random(1,5))
if(B==1) {C="This Is a random Text String!"}
if(B==2) {C="LoL TeXt HaX"}
if(B==3) {C="Text Random Strig :O!"}
if(B==4) {C="Bleep Blop Bloop"}
if(B==5) {C="This Text Is Random :D!"}


And Now, For Implementing it into a bot



if(Command:find("test") & !MeSaid) {concmd("Say Chatbot: "+C+")}

That line would make it say What ever C Is equal to, As we set it to a random string

In Order to make the chatbot work, we need some special strings

MeSaid = Command:find("chatbot:")

Command = lastSaid():lower()


Basicly, MeSaid Is to make it not loop,

Without it,

It would say


Chatbot: This is random text!
Chatbot: LoL TeXt HaX!
Chatbot: Text random of!
Chatbot: This is random text!
Chatbot: This is random text!
Chatbot: This is random text!
Chatbot: This is random text!

Until someone else said something, ceasing the function

Or we might be able to do the same without this.

Using the else{command/value change}

But i don't Know how to do it that way.

Mush simpler with !mesaid
Other Commands

There are many other things you can do also,

For example

Owner=owner():name()


if(Command:find("owner") & !MeSaid) {concmd("Say Chatbot: My Spawnee is "+Owner+".")}

For Example
It would say


Chatbot: My Spawnee is JulioGee.

These are the ones I Use In My Chat Bots

Owner=owner():name()
Map=map()
Servername=hostname()
Playernum=numPlayers()
Maxplayernum=maxPlayers()
Gamemode=gamemode()


Code Examples are...

if(Command:find("chatbot") & Command:find("map") & !MeSaid){concmd("say chatbot: The map Were on is "+Map+".bsp")}

Chatbot: The map Were on is gm_flatgrass.bsp


if(Command:find("chatbot") & Command:find("server") & !MeSaid){concmd("say chatbot: The server your on is "+Servername+".")}

Chatbot: The server your on is UFA Public Build- [PHX-WireExtras-XtraTools-AWESOME!]

if(Command:find("chatbot") & Command:find("gamemode") & !MeSaid){concmd("say chatbot: Your playing "+Gamemode+".")}

Chatbot: Your playing Sandbox.

if(Command:find("chatbot") & Command:find("how") & Command:find("players") & !MeSaid){concmd("say chatbot: There are "+Playernum+" players.")}

Chatbot: There are 5 players.

if(Command:find("chatbot") & Command:find("max") & Command:find("players") & !MeSaid){concmd("say chatbot: There can be "+Maxplayernum+" Players on at a time")}

Chatbot: There can be 10 Players on at a time.

Thanks For Reading My Basic Chat bot And Values Tutorial

A witty saying proves nothing.


[Image: pedobear432313.gif]

Check out my forum!
Click here you silly!
BITCH! DO IT ^
(This post was last modified: 10-12-2009 06:56 PM by JulioGarcia.)
10-02-2009 07:00 PM
Visit this user's websiteFind all posts by this user Quote this message in a reply
KittenSlayer Offline
titls are stupit
*

Posts: 49
Joined: May 2009
Post: #2
RE: How to code random values In Expression
no on uses expresion 2 anymor dude just use thrusters and whels
10-09-2009 12:25 PM
Visit this user's websiteFind all posts by this user Quote this message in a reply
JulioGarcia Offline
FAEG

Posts: 431
Joined: May 2009
Post: #3
RE: How to code random values In Expression
And how do you expect to make a chatbot with trusters and whels?

A witty saying proves nothing.


[Image: pedobear432313.gif]

Check out my forum!
Click here you silly!
BITCH! DO IT ^
10-10-2009 08:51 PM
Visit this user's websiteFind all posts by this user Quote this message in a reply
XxsiezexX Offline
Member
*

Posts: 166
Joined: Jun 2009
Post: #4
RE: How to code random values In Expression
(10-10-2009 08:51 PM)JulioGarcia Wrote:  And how do you expect to make a chatbot with trusters and whels?

very very carefuly involves warping the time and spavce continuem

[Image: 2061myu.jpg]
United as one divided by zero
thinking in Binary
speaking in ip
04-11-2010 11:18 PM
Find all posts by this user Quote this message in a reply
Post Reply