[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Can't add more to my script file..

Can't add more to my script file..

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  

Posted by Gore   (207 posts)  [Biography] bio
Date Fri 16 Jan 2004 05:22 AM (UTC)
Message
Hello, I'm having a problem adding more subroutines to my script file, I've named the file healing.vbs, and I'm just adding to the already supplied examscript.vbs. Here's what I've added -


sub OnWorldOpen
world.note "---------- World Open ------------"
dim anorexia, kalmia, paralysis, stupidity
dim vernalius, clumsiness, sensitivity, pacifism

anorexia = world.GetVariable("VAnorexia")
kalmia = world.GetVariable("VKalmia")
paralysis = world.GetVariable("VParalysis")
stupidity = world.GetVariable("VStupidity")
vernalius = world.GetVariable("VVernalius")
clumsiness = world.GetVariable("VClumsiness")
sensitivity = world.GetVariable("VSensitivity")
pacifism = world.GetVariable("VPacifism")

end sub

' ---------------------------------------------------------
' Heal all sub routine
' ---------------------------------------------------------

sub healing (a,b,c)

if anorexia="0" then

if asthma = "1" then
world.execute "ek"
elseif paralysis = "1" then
world.execute "eb"
elseif stupidity = "1" then
world.execute "eg"
world.execute "eg"
elseif pacifism = "1" then
world.execute "ebe"
elseif clumsiness = "1" then
world.execute "ek"
elseif sensitivity = "1" then
world.execute "ek"
elseif vernalius = "1" then
world.execute "ek"
end if
else
world.execute "aeb"
end if
end sub

' ---------------------------------------------------------
' Sub routines for logging Afflictions
' ---------------------------------------------------------

Sub Asthma (a, b, c)
' You feel a tightening sensation grow in your lungs.
' afflicted by horrible asthma.
' You eat a piece of kelp.
' Your bronchial tubes open up and your asthma is cured.

Asthma = "1"
World.Execute "Healme"
End Sub

Sub Asthma_cure ()
Asthma = "0"
World.Execute "Healme"
End Sub

Sub Clumsiness (a, b, c)
' You gasp as your fine-tuned reflexes disappear into a haze of confusion.
' afflicted with clumsiness.
' You eat a piece of kelp.
' Thank Sarapis, the Logos! Your clumsiness has been cured.

Clumsiness = "1"
World.Execute "Healme"
End Sub

Sub Clumsiness_cure (a, b, c)
Clumsiness = "0"
World.Execute "Healme"

End Sub
Sub Pacifism (a, b, c)
' Your will to harm anything leaves you.
' pacified.
' You eat a bellwort flower.
' The unnatural feeling of peace leaves you.

Pacifism = "1"
World.Execute "Healme"
End Sub
Sub Paralysis (a, b, c)
' A prickly st*nging overcome* your body, fading away*into numbness.
' paralysed.
' You eat a bloodroot leaf.
' Your muscles unlock; you are no longer paralysed.

Paralysis = "1"
World.Execute "Healme"
End Sub

Sub Paralysis_cure (a, b, c)
Paralysis = "0"
World.Execute "Healme"

End Sub

Sub Sensititivy_cure (a, b, c)
Sensitivity = "0"
World.Execute "Healme"

End Sub

Sub Sensitivity (a, b, c)
' A prickly, stinging sensation spreads through your body.
' sensitive to pain.
' You eat a piece of kelp.
' The stinging feeling fades.

Sensitivity = "1"
World.Execute "Healme"
End Sub

Sub Stupidity (a, b, c)
' Hmmmm. Why must everything be so difficult to figure out?
' You eat a goldenseal root.
' You aren't such a complete idiot anymore.
' unnaturally stupid.

Stupidity = "1"
World.Execute "Healme"
End Sub

Sub Stupidity_cure (a, b, c)
Stupidity = "0"
World.Execute "Healme"

End Sub

Sub Vernalius (a, b, c)
' Your limbs grow heavy and you groan feebly.
' wearied in body.
' You eat a piece of kelp.
' Your limbs strengthen and you feel stronger.
Vernalius = "1"
World.Execute "Healme"
End Sub
Sub Vernalius_cure (a, b, c)
Vernalius = "0"
World.Execute "Healme"
End Sub


It.. just simply won't let me add anymore, heh. Is this a memory problem?
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 16 Jan 2004 06:52 AM (UTC)
Message
I'm not sure what you mean by "it won't let me" - is there an error message? If so, what is it?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Gore   (207 posts)  [Biography] bio
Date Reply #2 on Fri 16 Jan 2004 07:53 AM (UTC)
Message
heh sorry to be non-descriptive, well, in the mushclient script file editor, it simply doesn't do anything or add anything. Whereas if I edit my script file in windows notepad, when I reach this "max" point, I'll get a message box saying, "Not enough memory available to complete this operation. Quit one or more applications to increase available memory, and then try again." I mean, that obviously tells me what it is, but I've never encountered a problem of this sort before.
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #3 on Fri 16 Jan 2004 07:25 PM (UTC)

Amended on Fri 16 Jan 2004 07:29 PM (UTC) by Shadowfyr

Message
This is because both Notepad and Mushclient use the same textbox control and are limited to a file size of about 32k or something. You can thank MS for never upgrading the basic editors that come with the OS in the entire time since like Windows 2.0 or something for the reason notepad gives that error... lol

My suggstion would be to download something like SciTE, from www.scintilla.org/SciTE.html and tell MUSHclient to use that for editing scripts instead. There are a few others around, but I like this one and it covers the widest range of languages, including Python, Java, VB, Perl and XML. Conveniently these happen to be the ones currently supported in Mushclient. ;)

You may also want to download a file called npplus.zip - members.aol.com/donnaskani/npplus.html. WARNING: Don't comfuse this with a program actually called Notepad+.exe. The two programs are sadly named the same thing on the web pages, which drove me nuts the last time I lost the zip file for the good one.

Notepad+ is more of a Wordpad want to be, adding extra features you don't need in a notepad, while neglecting others. One example - npplus maintains a list of the last 10 files you have opened in it, Notepad+ couldn't even remember which directory you last opened in the version I tried. Notepad+ however is a lot more impressive looking. lol

Basically to install it you just take the notepad.exe file from the zip and drop it right over the existing one in the Windows directory. It has no internal size limit and some nice added features. Note however that there are a few possible issues:

1. I don't know if something like XP considers this a 'protected' file, so it may try to 'fix' it if you do replace the original. If this happens just unzip it someplace else, like "Program Files\npplus" and reassign .txt files and anything else that currently opens in MS Notepad to load with the new one instead. If the OS lets you replace the original, then this is unnecessary.

2. If you ever run Windows Setup again once you replace the original for some reason, it will overwrite the new notepad.exe with the old one, so keep a copy of the zip around just in case.

3. There have been some programs that use some method that MS Notepad allowed, but npplus doesn't to show files. 'Most' won't have a problem, but a few will load npplus, but not properly tell it which file to open.

While these things can be a tad annoying, it is imho no where near as annoying as the original file size limit.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #4 on Fri 16 Jan 2004 08:39 PM (UTC)
Message
Windows XP actually removes the size limit on notepad. I just opened an 82k file with it, and in the past I've opened files up to a megabyte or more. I'm pretty sure that Windows 2000 removes the limit as well, but I can't test that here.

Another interesting, and most importantly very fast text editor is the Crimson Editor. You should be able to find it with a simple search on google. It has syntax recognition, but I like it the most because it loads extremely fast, whereas some other "improved" versions of notepad take a long time to start up - annoying when you like notepad precisely because it loads up almost instantly. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 16 Jan 2004 09:02 PM (UTC)
Message
Now that MUSHclient supports plugins I would be thinking of making your scripts more modular.

You could put your various aliases/triggers into plugin files, thus making them more modular and easy to move from one world to another, and also the limit of 32 Kb for the notepad window would only then apply per plugin, so your total scripts could add up to much more than that.

You can use the plugin wizard to write the plugin for you, if you just have triggers/aliases and associated scripts.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #6 on Fri 16 Jan 2004 10:21 PM (UTC)
Message
Actually, the error message he's getting sounds more like he's out of system resources than an issue with maximum file size in notepad, esp. considering that what he posted is nowhere near the 32k file limit pre-win2k.

What I would suggest doing is shutting down all the extra stuff in your system tray that you arent using anyway then edit the startup profile in msconfig (last tab) to keep them from starting up again. Then I would defrag and check the amount of freespace on the drive because if its below 20% or so of the total size of your HD, winblows may be eating it up as virtual memory and duping itself into thinking your out of hard drive space. Also, if you have more than a few windows open, you may want to close some of them if you don't have much ram in your system.

On the issue of text editors, you might also want to check out metapad at www.liquidninja.com. Great text editor that can (and will) maintain *nix file encoding in a winblows environment.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Fri 16 Jan 2004 11:15 PM (UTC)
Message
I thought that too, but adding his stuff to the bottom of the example script file comes in at around 35 Kb - just over the limit.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #8 on Sat 17 Jan 2004 12:49 AM (UTC)
Message
Ah, I didn't catch the mention about adding it to the existing example, that would push the size quite a bit higher than working from a clean script file.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Sat 17 Jan 2004 03:39 AM (UTC)
Message
Of course, Gore, you could always start with a clean script file, or at least only keep the constants at the start. All that example stuff you are probably not using.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #10 on Sat 17 Jan 2004 04:25 AM (UTC)
Message
Actually Ksilyan, npplus load almost as fast as the original on my machine (750mhz) and has the added benefit of looking almost exactly like the original notepad, so everything still works the same way in it. As for SciTE, it loads even faster, like a fraction of a second, does code hilighting and covers about 35 languages and file types. Most others require you to plug in new stuff to support more, or even limits you to 3-4 at a time in at least two cases I know of. Both could use a few improvements, but they load fast and are easy to use, unlike AnyEdit, which uses the same basic Scintilla code as SciTE, but has an iterface that is 20 times as complicated (and doesn't support all the languages).

There are quite a few around, some fairly new, but I liked the clean and simple interfaces in both, as well as the vast number of code types supported by default in SciTE. In the end it is a matter of personal taste.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #11 on Sat 17 Jan 2004 07:36 AM (UTC)
Message
I'll have to check those out then, Shadowfyr. So far every "Notepad replacement" I've tried has disappointed me except for Crimson Editor, so hopefully the ones you suggest (which I have not tried yet) will be better. :) Thanks for the info...

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #12 on Mon 19 Jan 2004 03:26 PM (UTC)

Amended on Mon 19 Jan 2004 03:28 PM (UTC) by Magnum

Message
My personal replacement for notepad is a text editor called metapad:
http://liquidninja.com/metapad/

On Win 9x family of operating systems, I used to just make a copy of metepad.exe and rename it to notepad.exe and then over-write the windows version (in the windows directory), and things were peachy.

Under XP, "notepad" is considered a critical operating system file, and thus, XP restores it's own version of notepad if you try and overwrite it with another editor. The only workaround I have found is just to re-assign the .txt extension to metapad. This works for the most part, although I still have to deal with Windows notepad when I call it from another program.

For example, I have MUSHclient configured to call an external text editor rather than use it's own built in editor. Unfortunately, MUSHclient simply calls Windows Notepad, whereas I would really like it to call Metapad. That can still be worked around as well, it just means that rather than, for example, pull up the plugins screen and select a plugin and click "edit", instead I must pull out windows explorer, browse to the directory where my plugins are installed, and then load the file manually in that manner.

Ah well...

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #13 on Mon 19 Jan 2004 07:05 PM (UTC)
Message
Magnum, why dont you just configure MC to use metapad as the default editor?
Ive never had a problem pulling up PFE to edit my stuff.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Gore   (207 posts)  [Biography] bio
Date Reply #14 on Sun 08 Feb 2004 09:20 PM (UTC)
Message
Thanks guys, I decided to go to SciTE, works pretty awesome.
[Go to top] 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.


48,986 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]