Register forum user name Search FAQ

Gammon Forum

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 ➜ Suggestions ➜ Include files

Include files

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


Posted by Rire   (5 posts)  Bio
Date Fri 24 May 2002 06:21 AM (UTC)
Message
OK... I have over 200,000 lines of code. Fankly, it get's difficult to read in the nice little code editor. Can you make an include command, and just parse it out before loading script? That way, I can include objects and other blocks of code separately.

Thanks...

Oh, also, you may not know this, but you can add the script control as an object of itself. If you do this, we can write our own include function by opening a file, reading the text, and adding it to the script control.

PEACE!
--Rire
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 24 May 2002 07:08 AM (UTC)
Message
Krenath did a sub that would include files, just take that.

In the next version I am working hard on the concept of code snippets, in XML files. Amongst other things the XML format will support include files directly, and snippets will allow you to break up your code into scripts that are relevant to a particular piece of code (eg. a trigger) into one spot.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #2 on Fri 24 May 2002 10:12 AM (UTC)
Message
200,000 ?
200,000 !!!

* boggle *

...and I thought I had a big script with 2000 lines.

Man, what do you do? Have fully automated bot with graphical mapping? Hell, write your own graphical interface?

:) :) :)

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

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #3 on Fri 24 May 2002 10:15 AM (UTC)
Message

Dim ScriptPath
ScriptPath = "E:\User\Magnum\MUSHclient\Worlds\Ages of Despair\"

Function GetFileContents(sFileName)
	Dim FSO, ScriptFile
	Set FSO = CreateObject("Scripting.FileSystemObject")
	Set ScriptFile = FSO.OpenTextFile(sFilename,1)
	GetFileContents = ScriptFile.ReadAll
	Set ScriptFile = Nothing
	Set FSO = Nothing
End Function

World.Note "Include Script File:  SCRIPT Tools.vbs"
Execute GetFileContents("E:\User\Magnum\MUSHclient\Worlds\- Defaults -\" & "SCRIPT Tools.vbs")
World.Note "Include Script File:  AOD_EQ.vbs"
Execute GetFileContents(ScriptPath & "AOD_EQ.vbs")

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

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Rire   (5 posts)  Bio
Date Reply #4 on Fri 24 May 2002 06:26 PM (UTC)
Message
Thanks... I couldn't use your code, because I'm in JScript, but I modified it to fit my needs.

In case anyone wants it, I've appended it to the end of this message.

...And yes, I wrote my own fully-automated bot, that walks, autoquests, maps, remembers people and interactes with them accordingly, allows external users to operate it, if they are registered, and offers several services to people such as directions, assistance in combat, training, and --on rare occasion-- money :-) However, it was fully written in zMud and I'm porting it over slowly.
I expect to be done in about a month.

PEACE!
--Rire

// ----------------------------------------
var FileScriptingObject = new ActiveXObject("Scripting.FileSystemObject");

function Include( FileName ) {
FileName = "c:\\Program Files\\MUSHclient\\worlds\\xyllomer\\scripts\\" + FileName;
var File = FileScriptingObject.OpenTextFile( FileName, 1 );
var Code = File.ReadAll();
File.Close();
return( Code );
}

// YOU CANNOT EXECUTE THIS STATEMENT FROM INSIDE OF ANY
// BLOCK OR OTHER SCOPE. IF YOU DO, THE INCLUDED FILE
// WILL ONLY APPLY TO THAT SCOPE.
eval( Include( "main.js" ) );
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #5 on Fri 24 May 2002 07:10 PM (UTC)
Message
Or you could try SciTE from www.scintilla.org. It has a lot of nice features including the ability to close subs like you would a folder in a file tree, thus getting anything you are not working on out of your hair. ;)

There is a minor flaw in most versions of MUSHClient though so you may need to use:

c:\Progra~1\MUSHclient\worlds\xyllomer\scripts\{whatever}

The method used to run programs worked when the program only expected a single file, but bugged on programs that accepted more than one on the command line and you used a filename with a space in it. Not sure if the current version has been patched to fix this (as of a day or so ago) or it is in the next version.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #6 on Fri 24 May 2002 09:57 PM (UTC)
Message
Is "xyllome" the name of the mud you use your bot at?

I am considering switching muds, and would want to move to a mud that is very easy to script for, and where they don't really frown so much on bots. (Illegal on most muds).

I've been pretty open about my scripting at my current mud, but next time, I may keep it secret to avoid "legal" hassles with Admin.

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

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #7 on Fri 24 May 2002 10:26 PM (UTC)
Message
You may want to use ExecuteGlobal rather than Execute. From the docs:


Description

Executes one or more specified statements in the global namespace of a script.

All statements used with ExecuteGlobal are executed in the script's global namespace. This allows code to be added to the program so that any procedure can access it. For example, a VBScript Class statement can be executed at run time and functions can subsequently create new instances of the class.


It won't matter in your case, but with ExecuteGlobal you wouldn't have to worry about doing it outside other subs.

I might put your suggested routine in Tips and Tricks, where it can be found more easily.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Fri 24 May 2002 10:38 PM (UTC)
Message
Quote:


There is a minor flaw in most versions of MUSHClient though so you may need to use:

c:\Progra~1\MUSHclient\worlds\xyllomer\scripts\{whatever}

The method used to run programs worked when the program only expected a single file, but bugged on programs that accepted more than one on the command line and you used a filename with a space in it. Not sure if the current version has been patched to fix this (as of a day or so ago) or it is in the next version.


The bug you are referring to only applies to ShellExecute, which only applies when opening the script file from within MUSHclient. To load a file within a script like that should work fine.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #9 on Sat 25 May 2002 12:29 AM (UTC)
Message
Umm right.. So I should have said:

<However if you do use SciTE>, there is a minor flaw in most versions of MUSHClient ...

I wasn't intending it to refer to script inclusion. ;)

My only major complaint with such 'included' scripts is that there is not direct way to edit them. But then since I don't use any I can't say that this has been a major problem for me. lol
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #10 on Sat 25 May 2002 02:44 AM (UTC)
Message
Also, if there is an error in your "include" script, the line number is reported as the line from your main file which loaded the script.

I therefor keep "include" script I am working on in the main file until it has "gone gold", after which I move it to an "include" file, where it shouldn't need further editing.

Nick is working hard at implementing new ways of having "include" files work very naturally and in a user friendly manner, thereby making "Plugins" a nicely viable option. :)

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

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Rire   (5 posts)  Bio
Date Reply #11 on Sat 25 May 2002 07:12 PM (UTC)
Message
Hey, Magnum:
Xyllomer is the MUD I play, and it is illegal to use any kind of bot in this MUD. I, however, didn't find a definition of the word "illegal" anywhere in the help files, so for now, I just assume that it means "cool."
The way I have my bot setup used to be very sloppy, but people started yelling at me for having scripts. Now it delays a random 1 to 3 seconds and generates occasional typos so that they believe that it is real... They still have their doubts, but Rire will not be removed, because I never impose a threat to the games I play or the people in them. I don't exploit... much... and I stay IC. Even wth scripts.
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #12 on Sat 25 May 2002 10:00 PM (UTC)

Amended on Sat 25 May 2002 10:02 PM (UTC) by Shadowfyr

Message
And you assume that admitting it here means no one else from your mud will ever see it including an admin? However I do agree that banning scripts and bots is a bit stupid. Bots will generally get caught, if for no other reason than the fact that unless you are two years old and your bot is a copy of the Cyc AI that has a two year old intelligence, someone will say something significant and it will respond incorrectly or not at all. But in general, triggers and other auto-responses just increase speed and limit failability. A lot of stuff can be done in some games in the background that 'never' send stuff to the mud that give 500 times the advantage than even a fairly complex trigger/script combo can.

Examples: Automatic potion calculation, auto-mapping, offline data analysis for games like the old TradeWars 2002 from BBS days which require making 'trades' between different ports (hopefully in the best combos possible), etc. These are A) undetectable and B) not technically illegal on most muds, but a trigger to heal you if you drop under x hp is... :p

The logic behind banning them seems to be the same as in the following hypothetical situation:

1. Threaten someone with automatic failure on a test.
2. Tell them that they can't use a calculator to take it.
3. Administer the test through the mail because the person taking the test is in Australia and the testers are in the US.

Unless the subject is a complete idiot (and often people who cheat are), the people giving the test probably won't even notice the difference. As I told someone else who was argueing about the definition of 'player interaction' in help files of the mud I play at, legalistic logic cannot surplant the laws of physics, even if most businesses (and many muds) today seem to think so. lol
Top

Posted by Rire   (5 posts)  Bio
Date Reply #13 on Mon 27 May 2002 04:27 AM (UTC)
Message
Heh... All I can say is "Good point"

--Rire
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.


36,621 views.

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

Go to topic:           Search the forum


[Go to top] top

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