Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Running Scripts from Text Files (https://forums.graalonline.com/forums/showthread.php?t=73219)

killerogue 04-02-2007 12:47 AM

Running Scripts from Text Files
 
I was thinking, is there a way to run a script from a text file? Like having the script in a text file, then loading the text file into a class then joining the class?

Or something similar to that?

DustyPorViva 04-02-2007 12:58 AM

As far as I know, the classes are text files.

killerogue 04-02-2007 01:11 AM

I mean like uploading:

blahscript.txt

The create a weapon, "-Test".

Then using loadlines and it will read everything in the text file and run it in the "-Test" NPC.

napo_p2p 04-02-2007 01:24 AM

Would need eval().

Angel_Light 04-02-2007 03:42 AM

all weapons/Classes/DB are .txt files

killerogue 04-02-2007 04:13 AM

Quote:

Originally Posted by Angel_Light (Post 1295696)
all weapons/Classes/DB are .txt files

Not what I mean,


I mean having a text file, like,

"test.txt" in levels.

Then in a script named: "-TestScript"

Load the text from the .txt file and run everything in the text file as a script in the "-TestScript" weapon.

JkWhoSaysNi 04-02-2007 04:17 AM

Isn't putnpc's 2nd param the name of a text file which contains the script for that NPC?

Though it will only work for level NPCs.

Inverness 04-02-2007 05:52 AM

Quote:

Originally Posted by JkWhoSaysNi (Post 1295711)
Isn't putnpc's 2nd param the name of a text file which contains the script for that NPC?

Though it will only work for level NPCs.

And you could use a TStaticVar to create a static reference to the object, but it would be a lot of hassle.

killerogue 04-02-2007 06:00 AM

Yeah, but I mean as far as a Databased and everything, it would be nice to have them all aptly named text files, like:

"Pointandclick.txt" containing a script for the movement system.

Then open a weapon named, "-Movement".

As a command name, something like, "runtextasscript("textfilename")".

It would read all the contents of the text file and run the contents as script using the "-Movement" Weapon NPC.

killerogue 04-02-2007 06:13 AM

Question answered in future improvements. Nevermind. :p

Inverness 04-02-2007 06:27 AM

If you're not using the default Graal Q Menu then don't name your weapons with anything but letter characters and numbers in them. That way you can reference the object name without funky stuff.

napo_p2p 04-02-2007 08:56 AM

Quote:

Originally Posted by Inverness (Post 1295750)
And you could use a TStaticVar to create a static reference to the object, but it would be a lot of hassle.

Dangit, Inver. Avatar had me confused for a good 2 seconds or so.

napo_p2p 04-02-2007 09:01 AM

Quote:

Originally Posted by killerogue (Post 1295754)
Yeah, but I mean as far as a Databased and everything, it would be nice to have them all aptly named text files, like:

"Pointandclick.txt" containing a script for the movement system.

Then open a weapon named, "-Movement".

As a command name, something like, "runtextasscript("textfilename")".

It would read all the contents of the text file and run the contents as script using the "-Movement" Weapon NPC.

I don't really see the point of that though. It's basically replacing text files with more text files. -Movement will work just fine containing the script for the movement system. Plus, if you don't like seeing weapon scripts getting too big, you can always use classes.

Rapidwolve 04-02-2007 08:48 PM

Hotrian made a GUI Window editor, in which when you save a Gui Control, it saves as a weapon text file. I still don't know how he made that Gui editor x.x

Angel_Light 04-02-2007 10:29 PM

Invern >:O Thought you were Yen XD Oh wait are you trying to save a file then load it later?

Twinny 04-03-2007 12:03 AM

Quote:

Originally Posted by Rapidwolve (Post 1295991)
Hotrian made a GUI Window editor, in which when you save a Gui Control, it saves as a weapon text file. I still don't know how he made that Gui editor x.x

Probably a damn big script >_<. Stefan released a gui maker as well as did Novo.

Skyld 04-03-2007 12:06 AM

Quote:

Originally Posted by Twinny (Post 1296074)
Probably a damn big script >_<. Stefan released a gui maker as well as did Novo.

I think I posted an improved version of Stefan's GUI editor a while ago.

Gambet 04-03-2007 12:17 AM

GS2 GUIs have got to be the easiest to handle. If people need a GUI Editor for GS2 GUIs, I can just imagine how they managed in GS1, when they had to make everything custom x-x

Admins 04-03-2007 12:20 AM

A new improved version of the Gui Editor is in the making, will be added to the scripted RC once done.

Angel_Light 04-03-2007 03:19 AM

add that to your list stefan for stuff in production

Inverness 04-04-2007 04:54 AM

Quote:

Originally Posted by napo_p2p (Post 1295780)
Dangit, Inver. Avatar had me confused for a good 2 seconds or so.

I thought I was Yen when I first posted with this. Did the double-take and everything.


All times are GMT +2. The time now is 07:03 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.