Cyrensy
October 23, 2020, 8:41pm
#1
So i’m trying to make a command for each height you get a response

Height chart:

5’0-5’3= “message”
5’4-5’7= “message”
5’8-6’0= “message”
6’1+ = “message”

This is what i have now thanks to @Emily

!addcom !height -cd=5 $(eval a=Math.floor(Math.random()*4+4);if(a==7){b=0;}else{if(a==4){x=2;y=10;}else{x=12;y=0;}b=Math.floor(Math.random()*x+y);}`$(user) is ${a}\'${b}.`

)

Try this:

```
!addcom !height -cd=5 $(eval a=Math.floor(Math.random()*4+4);if(a==7){b=0;}else{if(a==4){x=2;y=10;}else{x=12;y=0;}b=Math.floor(Math.random()*x+y);};a==4?`Message1`:a==5&&b<=3?`Message2`:a==5&&b<=4&&b>=7?`Message3`:a==5&&b>=8?`Message4`:`Message5`)
```

The messages go from shortest to tallest I included a first message for 4’10-4’11

1 Like

Cyrensy
October 23, 2020, 9:09pm
#3
Thank You potato for the quick response is it possible to show the height as well

For example $(user) is 5’4 , message it just show the message

I notice that i keep getting “message 5” over and over then it will change to a different Response after 4 trys

That’s because the range of heights is 4’10-7’0 and nearly half of all the repossess fall in to the 6’0+ section (13 out of 26) I could tweak the numbers if you want it changed.
And to add the height in copy and paste what I have written below anywhere into the message

```
${a}\'${b}
```

1 Like

Cyrensy
October 23, 2020, 10:25pm
#5
Please if You can tweak the numbers also if i wanted to put the $(user) inside the message it will be like this

$(user) is ${a}’${b}.)

Yes, here’s the updated command:

```
!addcom !height -cd=5 $(eval a=Math.floor(Math.random()*4+4);if(a==7){b=0;}else{if(a==4){x=2;y=10;}else{x=12;y=0;}b=Math.floor(Math.random()*x+y);};if((a==4)||(a==5&&b<3)){M=`Message1`}else if(a==5&&b>2&&b<8){M=`Message2`}else if((a==5&&b>7)||(a==6&&b==0)){M=`Message3`}else if(a==6&&b>0&&b<6){M=`Message4`}else{M=`Message5`};M)
```

I will note you may need to put this all into a pastebin just because of the 500 chapter limit of nightbot commands. But let me know if you have any issues.
Also just from looking at the code there is a 25% chance of getting 7’0 and a 25% chance of getting 4’10-4’11 meaning 50% of the numbers are major outliers.

1 Like

Cyrensy
October 24, 2020, 6:05pm
#7
Thank You potato, So i made a test pastebin how will i do this? I think it’s urlfetch json

Take out the “$(eval” at the begging and the “)” at the end of the pastebin.
Your command will look like this:

```
$(eval $(urlfetch json https://pastebin.com/raw/HVeNSyaV))
```

1 Like

Cyrensy
October 24, 2020, 8:36pm
#9
THANK YOU POTATO!

Also i’m having trouble with this short code it keeps saying unexpected identifier

“:randomPercent+”, $(touser) in the words of Albert Einstein “Imagination is more important then knowledge” ")

If i take away the both > “” it works but i want it to work with the both >""

Try this:

```
`${randomPercent}, $(touser) in the words of Albert Einstein \“Imagination is more important then knowledge\”`
```

Cyrensy
October 24, 2020, 10:31pm
#11
I still keep getting the same message unexpected identifier

I edited the code above you shouldn’t need the back slash though. If that doesn’t work there’s probably an issue somewhere else in the code.

1 Like

Cyrensy
October 24, 2020, 11:14pm
#13
I’m using the same code you gave me only problem i have is the both “”

$(eval random=Math.floor((Math.random()*100)+1); var randomPercent=random+"% ";random>=65?randomPercent+“Message1”:randomPercent+“Message2”)

system
closed
November 7, 2020, 11:14pm
#14
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.