Can't add more to my script file..

Posted by Gore on Fri 16 Jan 2004 05:22 AM — 20 posts, 75,425 views.

#0
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?
Australia Forum Administrator #1
I'm not sure what you mean by "it won't let me" - is there an error message? If so, what is it?
#2
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.
USA #3
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.
Amended on Fri 16 Jan 2004 07:29 PM by Shadowfyr
USA #4
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. :)
Australia Forum Administrator #5
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.
USA #6
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.
Australia Forum Administrator #7
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.
USA #8
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.
Australia Forum Administrator #9
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.
USA #10
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.
USA #11
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...
Canada #12
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...
Amended on Mon 19 Jan 2004 03:28 PM by Magnum
USA #13
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.
#14
Thanks guys, I decided to go to SciTE, works pretty awesome.
USA #15
Umm, this is possibly related to the tangent, but not to the main... anyway, here goes.

As far as Im aware, I can no longer view source of webpages in internet exploder. I know I used to be able to, but it seems to have mysteriously stopped working. Im thinking this MIGHT (I dont really remember exactly when it stopped) have to do with me trying to make the editor something else?

I honestly dont know, Ive changed everything back (as far as I know) and still cannot.
The Edit button is greyed out (once the page loads fully), and when I try to View > Source Nothing happens.

Anyone have any idea why this is happening? or more importantly, what I can do to remedy it?
Im running winXP and Internet Exploder version 6.0.2something or other
Australia Forum Administrator #16
Hard to say. In my version of IE I have the "HTML editor" set to UltraEdit (about 5th configuration tab) however when I select View Source, it uses Notepad. So much for that.

Try looking in the Registry, this bit might help:


REGEDIT4

[HKEY_CLASSES_ROOT\.htm]
@="htmlfile"
"Content Type"="text/html"

[HKEY_CLASSES_ROOT\.htm\OpenWithList]

[HKEY_CLASSES_ROOT\.htm\OpenWithList\Windows Notepad ]

[HKEY_CLASSES_ROOT\.htm\OpenWithList\Windows Notepad \shell]

[HKEY_CLASSES_ROOT\.htm\OpenWithList\Windows Notepad \shell\edit]

[HKEY_CLASSES_ROOT\.htm\OpenWithList\Windows Notepad \shell\edit\command]
@="D:\\WINNT\\Notepad.exe %1"

[HKEY_CLASSES_ROOT\.htm\ShellEx]

[HKEY_CLASSES_ROOT\.htm\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
@="{EAB841A0-9550-11cf-8C16-00805F1408F3}"


Notice how it points to Notepad.exe in D:\WINNT (my Windows directory).

Maybe this is the right part, I'm not sure.
Greece #17
PFE rocks! (Irrelevant)
Shadowfyr, have you been able to get Scintilla to stop messing up when trying to edit plugins? It would be great if it recognised the XML and the VBScript, but just the VBScript would be nice too... I use AnyEdit which uses Scintilla, but it just gags when it sees the XML stuff :/
USA #18
Nah. The problem is that XML would need to support 'every' language that could be in the scripting and the editor can't be 100% sure which language you are using. It could be done if you coded your own lexer for it and had it check for the script type in the XML to determine which is used. It isn't too suprising that SciTE doesn't do this automatically.
Greece #19
Well, it could at least ignore what it doesn't understand... Oh well...