Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ General
➜ 'Type Mismatch'
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Buhawi
(6 posts) Bio
|
Date
| Wed 04 May 2005 02:06 PM (UTC) |
Message
| I don't know if this is primarily Perl-related or MUSH related, but here's the scenario:
I have all my aliases in a plugin script (i.e. pattern matching on OnPluginSend parameters). However, when I press enter two times in quick succession, I get a 'Type Mismatch' Error, and the OnPluginSend function does not work anymore. Any help would be greatly appreciated. | Top |
|
Posted by
| Tsunami
USA (204 posts) Bio
|
Date
| Reply #1 on Wed 04 May 2005 06:24 PM (UTC) |
Message
| Perhaps you could post your aliases here, as well as the contents of your OnPluginSend function? | Top |
|
Posted by
| Buhawi
(6 posts) Bio
|
Date
| Reply #2 on Wed 04 May 2005 07:04 PM (UTC) |
Message
| I don't have any in-client aliases. They're all in the script. (sorry for the misleading statement). Anyway here's part of the script:
sub OnPluginSend {
my $command=@_[0];
$command=aliases_general($command);
if ($command) {
$world->Send($command);
}
}
sub aliases_general {
my $command=@_[0];
if ($command=~/^clanlist$/i) {
$clanlist="Your clans are: ";
for my $ctr (@clanlist) {
$clanlist=$clanlist."\t".$ctr."\n\t\t";
}
$clanlist=$clanlist."\n";
$world->note($clanlist);
$command=0;
#=============================================
# A. Fishing Aliases
#=============================================
} elsif ($command=~s/^tl$/tease line/i) {
} elsif ($command=~s/^jl$/jerk line/i) {
} elsif ($command=~s/^rl$/reel line/i) {
} elsif ($command=~s/^rcl$/reel line\ncast line $castdir/i) {
} elsif ($command=~s/^castdir (\D+)$//i) {
$castdir=$1;
$command=0;
} elsif ($command=~s/^recast$/bait hook with bait/i) {
@to_do=("rcl");
}
return $command;
}
When I press two CR's in quick succession, I get an error message box ('Type Mismatch') and suddenly the OnPluginSend sub does not get any parameters anymore. | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Wed 04 May 2005 07:59 PM (UTC) |
Message
| It doesn't work anymore because the script engine (for the plugin) isn't working anymore (just like normal script errors, scripts turn off until you recompile).
It's any script error, what you posted looks fine, does anything else happen when you send things?
Not that this should cause the problem, but you're better off using $_[0] instead of @_[0] to get arguments for subroutines.
Why are you using a plugin callback instead of aliases? Since youre doing a lot of work that mushclient would be happy to do for you. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Buhawi
(6 posts) Bio
|
Date
| Reply #4 on Wed 04 May 2005 08:10 PM (UTC) |
Message
| I'm trying to reduplicate the event, albeit unsuccessfully :D I added somethings recently, but I doubt they should have solved that problem since they were but superficial.
However here's how I recall what happens:
1. All my triggers are in a plugin callback too. And they still work after that error comes up (i.e. OnPluginPacketReceived still works)
2. Reinstalling the plugin does not help. The least drastic thing that helps is closing the World and opening a new one.
3. OnPluginSend does not even run (I put there a $world->note for debugging purposes, and it does not go through)
And I put all my triggers and aliases into the plugin callback because I'm wierd. :D I'd rather have one huge text file to work with than having to switch between multiple dialog boxes. | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #5 on Wed 04 May 2005 09:17 PM (UTC) |
Message
| Why dont you put your triggers/aliases in triggers and aliases (and whatever else) INSIDE of the plugin? Then it's still just one big file (or if you want to, edit your world file with a text editor, although then you'd lose curret stuff each time you reloaded).
I couldn't duplicate errors either. Could it have perhaps been some other plugin (receiving text or whatnot) at the same time as you hitting return twice (response from the server from your blank line?) |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Buhawi
(6 posts) Bio
|
Date
| Reply #6 on Wed 04 May 2005 11:40 PM (UTC) |
Message
| I really opt not to put my triggers inside the plugin (not part of the script) since that would defeat the whole point of my project (which actually alters the entire look of the MUD, packet per packet).
I just duplicated the event though... this is only one plugin running, no others, and yes, from all my tests I've narrowed it down to the fact that a fatal error with the OnPluginSend function occurs when there's an error with the parameter. Everything else works perfectly fine except for that one single callback. This is a rather huge project so its driving me nuts. Maybe I'll have to trap errors or something... Something I've never done before. I'll figure out something somehow. | Top |
|
Posted by
| Nick Gammon
Australia (23,100 posts) Bio
Forum Administrator |
Date
| Reply #7 on Thu 05 May 2005 07:17 AM (UTC) |
Message
| I'm not a Perl expert, but I would think you can check the type of the argument before using it in such a way that it causes type mismatch.
Flannel is correct that once a script has a runtime error MUSHclient marks the script as "in error" until such time as the error is corrected and does not call it again. Otherwise you might get spammed with thousands of error messages, which might prevent you fixing the error. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,621 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top