Custom Variable in runcode Command


#1

Is there a way to set a variable in a (runcode ) command? I am trying to set a variable in a (runcode ) custom command I am creating. The reason I am trying to set this variable is because I am also generating random information and I want to essentially $.say that same random information twice. I’ll place what I currently have below but I get a syntax error which I’m sure is related to the variable declaration. I’ve tested the double say with just static data and that works so it’s just this variable declaration part I cant get right

(runcode (
var usr = $.userPrefix(event.getSender(), true),
wpn = $.randElement($.arrayShuffle($.readFile(’./addons/weapons.txt’))),
mon = $.randElement($.arrayShuffle($.readFile(’./addons/monsters.txt’)));
$.say('Ey Sammy! ’ + usr + 'wants you to try hunting ’ + mon + ’ with ’ + wpn + ’ smile ‘);
$.say(’/w Hotsammysliz /me ’ + usr + wpn + mons))

Thanks!


#2

if i was you id do this with a custom script instead as its much easyer


#3

Is there any kind of guide or something that gives me phantombot specifics on how to do that? i.e file location, file/command formatting, etc. ?


#4

#5

Thanks for the info I was able to get it working perfectly with that information!

Here’s the code for any folks that may come across this post in the future

https://hastebin.com/raw/axumejazuz :slight_smile:


#6

Here is a few scripts i have helped out or created

https://community.phantombot.tv/tags/dakoda
and
https://community.phantombot.tv/tags/alixe