mIRC Home    About    Download    Register    News    Help

Print Thread
#262173 08/01/18 12:37 AM
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I can't get $caller to return "identifier":

1)
Code:
//alias tc noop $!tc1 | alias tc1 echo -a $!caller | tc | alias tc | alias tc1

Ok so:
2)
Code:
//alias tc noop $!tc1 | alias tc1 echo -a $!caller | noop $tc | alias tc | alias tc1
does report identifier correctly.
However:
2bis)
Code:
//alias tc tc1 $(|) noop $!tc1 | alias tc1 echo -a $!caller | noop $tc | alias tc | alias tc1
reports identifier twice which is incorrect since the first call to the tc alias is a command
3)
Code:
alias testc0 noop $testc
alias testc echo -s $caller
+ $testc0 in editbox + tab to evaluate it, which reports "other".
while
4)
Code:
//alias tc noop $!tc1 | alias tc1 echo -a $!caller | noop $tc | alias tc | alias tc1
reports editbox

This is tricky, I would expect to be able to at least get the information that my alias was called as identifier in 3 & 4.
In 3) i evaluated from the editbox but then testc is called as an identifier, yet I get "other" possibly that's a bug.



Last edited by Wims; 08/01/18 05:33 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
This identifier reports the type of the caller, not the call method. So when you call it from the editbox, it reports the caller as the editbox. When it is called via a DLL, it reports a DLL. If it is called from a command, it reports a command. And so on.

Code:
tc {
  echo caller: $caller
  tc1
  noop $tc1
}
tc1 {
  echo caller: $caller
  echo isid: $isid
}

Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Oh hum, yeah, got that mixed up, thanks for the clarification.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
I made the same mistake when testing it initially as well :-) Is this identifier useful in any way? Does it have a practical use?

Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I made a feature suggestion about it.
I don't believe it's going to be used by a lot of scripter and of the few who would use it, I don't think they are going to use it a lot.

That does not make it useless, but I don't think it has a lot of practical use given the addition of $fromeditbox (as said in that thread, often people want to know if their alias is called from the editbox, nothing more).
I never heard anyone needing to know if the caller is a DLL/DDE/play command/dragndrop/sendmessage(), but I do believe checking if the caller is a menu/timer/event/editbox/funckey/command/ident will be the ones used the most.
I'd like to know in which context is it going to report "activex", "mouse" and "other" (although for "other" I found one case by evaluating the editbox's content with tab)
Again, see my suggestion, I think what would be awesome to most would be to get informations about the caller specifically when it is an alias, getting the name of the alias which is calling our alias, getting the script file and line number where it called our alias etc, to build a stack trace when debugging.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Originally Posted By: Khaled
I made the same mistake when testing it initially as well :-) Is this identifier useful in any way? Does it have a practical use?


It really depends on where you take it. Currently its just a more verbose variant of $fromeditbox but this has potential if it is later extended to be able to return the caller's name, file, line, etc when appropriate.

Code:
;; remotes.ini - call /t1 via editbox
alias t1 {
  echo -s $caller      = editbox
  echo -s $caller.name = $null
  echo -s $caller.file = $null
  echo -s $caller.line = $null
  echo -s $caller.pos  = 0

  t2
}
alias t2 {
  echo -s $caller      = command
  echo -s $caller.name = t1
  echo -s $caller.file = c:\example\mirc\scripts\remotes.ini
  echo -s $caller.line = 8
  echo -s $caller.pos  = 2
}

Last edited by FroggieDaFrog; 09/01/18 07:19 AM.

I am SReject
My Stuff

Link Copied to Clipboard