mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2016
Posts: 15
D
Dan Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Nov 2016
Posts: 15
Hi ,

I need a solution to my bot script I have just written and hit a roadblock with . At the beginning of the script an on text event determines if the user is desktop or mobile and then splits the traffic and different responses accordingly. But I then need to split it again with another on text event trigger for the country of the user. This is stumping me because if I just have the one on text event for "uk" trigger for example , then at the moment the user gets the same responses regardless of whether they are desktop or mobile. If there was a way to automatically determine if the user is desktop or mobile then that would solve it, if mirc code exists for that?

Perhaps I am not thinking it out clearly, if someone can help that would be great. I know I could ask both questions at the very beginning and that would simplify it, but for various reasons I want to try to avoid that if I can......

Last edited by Dan; 01/08/17 02:43 PM.
Joined: Jul 2006
Posts: 4,150
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
You're very unclear but that's probably because you are confused.
On text triggers when users speak, you can't determines if the user is desktop or mobile from that (it's not going to be indicated in their text message if they are, that is). If you can determines this from on text, then you can from others events and you should probably not do it inside the on text event.

By split it looks like you mean different paths, which is just simple if statement.

Basically in pseudo code:
Code:
on text # {
  if ($desktop($nick)) {
    if ($country($nick) == uk) {
      do something for desktop and uk
    }
    elseif ($country($nick) == fr) {
      do something for desktop and fr
    }
  }
  else {
    ;if no desktop, we assume mobile
    if ($country($nick) == uk) {
      do something for mobile and uk
    }
    elseif ($country($nick) == fr) {
      do something for mobile and fr
    }
  }
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I assume you're talking about whether the person running the bot script is mobile or not. You could probably tell if someone is mobile by the dimensions of their screen.

//echo -a $window(-1).w $window(-1).h

Whether or not someone is mobile, I assume the real reason you're checking is that mobile has smaller screen, so checking for this would identify mobiles with small screens, but probably not identify those with large enough dimensions that they don't need to have alternative content spoonfed to them. It is possible but not likely that someone will be running mirc on a desktop with dimensions reduced enough to fool this into thinking it's mobile.


Link Copied to Clipboard