3
on *:text:@btag*:#: {
  if ( ## isin $2 ] {
    Set %Tag. [ $+ [ $nick ] ] $2 {
      Describe # $nick Has saved their Battletag
    }
    else {
       Describe # $nick $+ , Please enter your real Btag
     }
   }

This is the code I have.

What I require is for the Code to Look at the text and only save it as a variable if it contains the symbol (#) hash tag.

I am finding this hard to code as the Hashtag (#) is part of the Coding language...

Lmk what you guys can do for me

2 Answers2

1

'#' char in mIRC remote code is evaluate as the channel the event fired from.

When you want to express explicitly the Hash tag character you should use $chr(35), 35 is the hashtag ascii number.

The code below will check:
If in any channel a user wrote @btag some-text-contains-#-char and if so, it will save inside the tag-user variable the word that contained #hash tag. Then will send him has saved...
Else will send him Nick, Please enter..

Code

on *:text:@btag*:#: {
  if ($chr(35) isin $2) {
    set %Tag. [ $+ [ $nick ] ] $2
    Describe # $nick Has saved their Battletag
  }
  else {
    Describe # $nick $+ , Please enter your real Btag
  }
}

The code isn't perfect and will work also, when a user will write the following lines:
@btagBLA some-text-contains-#-char
@btagSOMETEXT some-text-contains-#-char
And so on.. To solve it, you should change event definition to

on *:text:@btag *:#: {
Orel Eraki
  • 11,940
  • 3
  • 28
  • 36
0

The $chr() function is what you need. It accepts the ASCII value of a character and generates the character in question. So, for example, /echo -a $chr(35) would echo a pound sign (i.e. a hash tag).

You may also want to look at $asc() which will give you the ASCII code of the character you type. Or you could search online for "ASCII table".

Both functions should be adequately explained in the mIRC help file - or at least they were when I last used it.

Nik Bougalis
  • 10,495
  • 1
  • 21
  • 37
  • Would you be able to help out by putting in an example in the code i put.... And Mirc is the easiest way to write currency bots – user2403978 May 21 '13 at 07:48