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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Numerical calculator/tracker.
|
Numerical calculator/tracker.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #15 on Sun 31 Aug 2003 12:26 AM (UTC) |
| Message
| Hmm. Ok.. Lets step through this..
This line gets rid of what ever was in there before. In your case this was a time and day, so this will have gotten rid of that:
SetVariable ("total_gain"), ""
A better option would be to move it to a new sub:
sub OnPluginInstall
setvariable "total_gain",""
end sub
This will make it so each time the plugin is loaded it clears the value, 'but' only once, not every time you try to use it.
This is a problem:
ototal = GetVariable (total_gain)
getvariable requires a string. By leaving off the "" you are telling it to look in a VB variable called total_gain for a name that doesn't exist. It needs to be:
ototal = GetVariable ("total_gain")
This will work. The one you have for this will fail, because you don't tell it what they 'end' of the 'if' is actually at:
if IsEmpty (ototal) then
Note "Tracking Started."
end if
Here you have the opposite problem to when you tried to 'get' the value:
SetVariable ("total_gain"), "ntotal"
Your actually telling it here to store the value "ntotal" in totla_gain, not the contents of the variable ntotal. Change it to:
SetVariable "total_gain", ntotal
So the end result is:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Saved on Saturday, August 30, 2003, 6:31 AM -->
<!-- MuClient version 3.42 -->
<!-- Plugin "PL_Tracker" generated by Notepad? -->
<!--
Change the entity above to reflect the message you get when you gain powerlevel.
-->
<muclient>
<plugin
name="PL_Tracker"
author="Gar"
id="224913675cf54a90c032df56"
language="VBscript"
purpose="Displays how much PL you have gained this session"
save_state="y"
date_written="2003-08-30 06:31:00"
requires="3.24"
version="1.0"
>
<description trim="y">
<![CDATA[
When installed, this plugin will display how much PL you have gained so far.
]]>
</description>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
custom_colour="7"
enabled="y"
match="Your power level increases by ((\d+)\,|)((\d+)\,|)(\d+) points\.$"
regexp="y"
script="OnLevel"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
</triggers>
<!-- Script -->
<script>
<![CDATA[
sub OnPluginInstall
setvariable "total_gain",""
end sub
sub OnLevel (name, line, wildcards)
dim cgain
dim ototal
dim ntotal
'calculate the gain
cgain = Int(wildcards(2) & wildcards(4) & wildcards(5))
'get the previous gain
ototal = GetVariable ("total_gain")
'if there is no previous gain, note that we started tracking
if IsEmpty (ototal) then
Note "Tracking Started."
end if
'set ntotal to total gain
ntotal = Int(ototal + cgain)
'display it
ColourNote "white", "blue", "Total PL Gained = " & ntotal & "."
'store it
SetVariable ("total_gain"), ntotal
'we're done
end sub
]]>
</script>
</muclient>
I think that will fix it. | | Top |
|
| Posted by
| Xyborg
Canada (47 posts) Bio
|
| Date
| Reply #16 on Sun 31 Aug 2003 12:33 AM (UTC) |
| Message
| Thx Shadowfyr. I'll copy that too. But yeah. Now I'll juat have to get the ntotal to place proper commas, put in a command to reset the total PL gained to zero and maybe have it so you just type a command to see how much PL you've gained so far.
But for now. I'm going to bed. |
We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept. | | Top |
|
| Posted by
| Xyborg
Canada (47 posts) Bio
|
| Date
| Reply #17 on Sun 31 Aug 2003 01:27 AM (UTC) Amended on Sun 31 Aug 2003 01:41 AM (UTC) by Xyborg
|
| Message
| Ok. I woke up and now none of my scripts are working. This is really driving me nuts. I did everything I did the first time I got it to work and it isn't now. Giving me that same error I got the first time about the ototal and OnLever trigger stuff.
[EDIT]
Oh yeah. And Nick. The trigger you gave me isn't working. says Send-to-script cannot execute because scripting is not enabled. every time the trigger goes off. |
We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #18 on Sun 31 Aug 2003 03:24 AM (UTC) |
| Message
| | Well, enable scripting in the scripting configuration tab. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Xyborg
Canada (47 posts) Bio
|
| Date
| Reply #19 on Sun 31 Aug 2003 05:37 AM (UTC) |
| Message
| I do have it enabled. Shift+Ctrl+6 and then click the little checkbox marked "Enable Script" Click 'OK' then it should be all good. But I used Shadowfyr's script there and this is the error I get.
Error number: -2146828275
Event: Execution of line 19 column 1
Description: Type mismatch: 'ototal'
Called by: Function/Sub: OnLevel called by trigger
Reason: processing trigger ""
I'm not sure what this means exactly, but it's confusing me.
And as for the trigger thing of yours Nick. I made the plugin as below since I have no idea how to use triggers the way you do.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Saved on Saturday, August 30, 2003, 6:31 AM -->
<!-- MuClient version 3.42 -->
<!-- Plugin "PL_Tracker" generated by Notepad? -->
<muclient>
<plugin
name="PL_Tracker"
author="Gar"
id="224913675cf54a90c032df56"
language="VBscript"
purpose="Displays how much PL you have gained this session"
save_state="y"
date_written="2003-08-30 06:31:00"
requires="3.24"
version="1.0"
>
<description trim="y">
<![CDATA[
When installed, this plugin will display how much PL you have gained so far.
]]>
</description>
</plugin>
<triggers>
<trigger
enabled="y"
match="Your power level increases by * points."
send_to="12"
sequence="100"
>
<send>SetVariable "power", CInt (GetVariable ("power")) + _
CInt (Replace ("%1", ",", ""))
Note "Your power level is now " & GetVariable ("power")</send>
</trigger>
</triggers>
</muclient>
Then when I have "Enable Script" checked, I still get this kind of message.
You _traumatize_ A Newbie Fighter! [35]
Your power level increases by 6 points.
Send-to-script cannot execute because scripting is not enabled.
So I'm lost as to what's wrong. I know I'm a total newb, but hey, everyone is when they first start. |
We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #20 on Sun 31 Aug 2003 06:23 AM (UTC) |
| Message
| | A problem compiling your script file might temporarily disable scripting. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Xyborg
Canada (47 posts) Bio
|
| Date
| Reply #21 on Sun 31 Aug 2003 06:24 AM (UTC) |
| Message
| | Ok. Uh, how do i know if there is a problem compiling the script? |
We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #22 on Sun 31 Aug 2003 06:35 AM (UTC) |
| Message
| You posted it above:
Error number: -2146828275
Event: Execution of line 19 column 1
Description: Type mismatch: 'ototal'
Called by: Function/Sub: OnLevel called by trigger
Reason: processing trigger ""
Take out that part that causes that. (or, if that is all there is, blank out the script file, so scripting is still enabled, but there is no file). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Poromenos
Greece (1,037 posts) Bio
|
| Date
| Reply #23 on Sun 31 Aug 2003 07:45 AM (UTC) |
| Message
| It's not a problem in compiling the script file. It's the bug that MUSHClient doesn't load the scripting engine if you don't use a script in a plugin, which is fixed in the next version. Just take the trigger Nick gave you, go to the Triggers window in MUSHClient, and press the "Paste" button... It'll work. Or, alternately, put this in the end of your plugin, above </muclient>:
<script>
<![CDATA[
'comment
]]>
</script>
|
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #24 on Sun 31 Aug 2003 07:56 AM (UTC) |
| Message
| The CDATA just stops things like & from being expanded. This would do:
<script>
'comment
</script>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Xyborg
Canada (47 posts) Bio
|
| Date
| Reply #25 on Sun 31 Aug 2003 02:33 PM (UTC) Amended on Sun 31 Aug 2003 03:02 PM (UTC) by Xyborg
|
| Message
| This makes no sense to me. I open the trigger window (Shift+Ctrl+8) but I don't understand exactly where I'm pasting the trigger so it'll work. I mean, I'm totally lost here.
Perhaps a step by step instruction for this would help.
[EDIT]
Ok. Well I found the paste button which does all the work for me. Now I found that it was the ntotal = Int(ototal + cgain) line that's causing a problem in the script that I want to use. But I don't see what kind of conflict it's having with the rest. I mean, without that line, we can't get the ntotal which ultimately makes the script useless.
[EDIT]
Ok. New problem... *sigh*
Error number: -2146828282
Event: Execution of line 1 column 1
Description: Overflow: 'CInt'
Line in error:
Called by: Immediate execution
I don't know what this means... as usual...
[EDIT]
Bet you love the fact that I know how to edit posts eh?
Ok. I changed CInt to Int in both instances and it's working fine now. However, I wouldn't mind finding a way to put the commas back into the total number that's displayed. |
We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept. | | Top |
|
| Posted by
| Poromenos
Greece (1,037 posts) Bio
|
| Date
| Reply #26 on Sun 31 Aug 2003 06:27 PM (UTC) |
| Message
|
Function fnAddCom(strNumber)
Dim strTemp
Dim intCounter
For intCounter = Len(strNumber) To 1 Step -1
If (((Len(strNumber) - intCounter) + 1) Mod 3) <> 0 Then
strTemp = strTemp & Mid(strNumber, intCounter, 1)
Else
If intCounter <> 1 Then
strTemp = strTemp & Mid(strNumber, intCounter, 1) & ","
Else
strTemp = strTemp & Mid(strNumber, intCounter, 1)
End If
End If
Next
For intCounter = Len(strTemp) To 1 Step -1
fnAddCom = fnAddCom & Mid(strTemp, intCounter, 1)
Next
End Function
|
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | | Top |
|
| Posted by
| Xyborg
Canada (47 posts) Bio
|
| Date
| Reply #27 on Sun 31 Aug 2003 06:28 PM (UTC) |
| Message
| | Huh? What's that for? |
We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept. | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #28 on Sun 31 Aug 2003 07:23 PM (UTC) |
| Message
| | Dang it Poromenos, I was right in the middle of coding and testing something to add commas myself and at the last minute scrolled down to see something only to find you had posted a solution right at the same time as I started writing mine. No fair... lol Anyway, yours is a bit shorter and less complex than mine anyway. | | Top |
|
| Posted by
| Xyborg
Canada (47 posts) Bio
|
| Date
| Reply #29 on Sun 31 Aug 2003 07:27 PM (UTC) |
| Message
| Ok. Let me put my newbie trigger script up here cause I don't know if that will work with what I'm using right now. And it's all about Nick's triggers.
http://www.badtrip-designs.com/PL_Tracker.xml
That is my script thing. I don't know if what you posted would work Poromenos, but god knows.
Let me know if there's anything different I could do to make this more effecient. |
We offer power to those willing to take it. Sadly, few are unburdened enough by their prejudices to accept. | | 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.
109,774 views.
This is page 2, subject is 3 pages long:
1
2 3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top