A few basic scripts (Copypasta-able)

Jul 16, 2009 at 8:21 PM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
With the recent influx of new modders making new mods, I figure I'd give them a break and post these few basic TSC scripts for functions common to most mods. They are very, very basic, only expanding a little into flags, but, with a few changes to the numbers provided in the examples, you can use these for many, many things. I may expand to include a teleports script and a few others, such as a pitfall trap or a basic boss fight. I don't intend to make this a script-mart for easy scripts, I intend this to be a dissection of the basic functions, as well as a learning tool. The scripts, while *theorhetically* just usable as a copy-and-paste idea, will probably have to have a few values changed (and thus learn what the values do). I encourage those reading this to a.) view my organized and fully-explained TSC notes found here and b.) experiment with everything.

Basic Door (Inter-map)

On the map you're leaving:

#0100
<KEY<CNP0100:0000:0000<SOU0011<HMC<FAO0004<TRA0002:0100:0006:0009

On the map you're arriving at:
#0100
<CMU0024<SMC<FAI0004<MNA<END

Entities used:
#0100: Door sprite with flag 2000 set (run on interact)

Explanation:
The above is a basic room-to-room door script.
Upon interacting with entity 101 (a door), the game locks out player control (<KEY), changes the door to a <nothing> (<CNP), makes a door opening sound (<SOU), hides your character (<HMC), fades out into the center (FAO), and travels to map 2, coordinates X: 6 Y: 9, then runs script 0100 on that map (TRA).
Upon arriving at the destination map, the game changes the music (<CMU), unhides your character (<SMC), fades in from the center (<FAI), displays the name of the area (<MNA) and finally frees the earlier player control lock (<END).

Basic Door (Intre-map)

#0100
<KEY<CNP0100:0000:0000<SOU0011<HMC<WAI0010<CNP0100:0018:0000<MOV0006:0009<WAI0020<CNP0101:0000:0000<SOU0011<SMC<CNP0101:0018:0000<END

#0101
<KEY<CNP0101:0000:0000<SOU0011<HMC<WAI0010<CNP0101:0018:0000<MOV0009:0006<WAI0020<CNP0100:0000:0000<SOU0011<SMC<CNP0100:0018:0000<END

Entities used:
#0100: Door sprite with flag 2000 set (run on interact)
#0101: Door sprite with flag 2000 set (run on interact)

Explanation:
The above is a simple script to move a character via a door within a single room, and back. The doors are: #0100 @ (9,6) and #0101 @ (6,9). The similarities between the inter-map and intra-map script warrent no real explaination, apart from pointing out the major difference: intra-map uses the <MOV command instead of <TRA, and no additional script is called beyond the event that is triggered.

Locking Inter-map Door (Item)

On the map you're leaving:

#0100
<KEY<ITJ0001:0101<MSG
It's locked...
Try getting a key!<NOD<CLO<END

#0101
<CNP0100:0000:0000<SOU0011<HMC<FAO0004<TRA0002:0100:0006:0009

On the map you're arriving at:
#0100
<CMU0024<SMC<FAI0004<MNA<END

Entities used:
#0100: Door sprite with flag 2000 set (run on interact)

Explanation:
In this case, when you interact with the door, it called a check to see if you have item 0001 (Arthurs Key). If you have it, it continues (jumps) to event 0101 and runs the standard intra-map door script. If you lack the item, it give a message: "It's locked. Try getting a key!"

Additional: the above can be done using a flag as well by replacing the <ITJ with a <FLJ. In doing so, to unlock the door you need to set the flag.


Locking Intra-map Door (Item)

#0100
<KEY<ITJ0001:0101<MSG
It's locked...
Try getting a key!<NOD<CLO<END

#0101
<KEY<CNP0100:0000:0000<SOU0011<HMC<WAI0010<CNP0100:0018:0000<MOV0006:0009<WAI0020<CNP0101:0000:0000<SOU0011<SMC<CNP0101:0018:0000<END

#0102
<KEY<CNP0101:0000:0000<SOU0011<HMC<WAI0010<CNP0101:0018:0000<MOV0009:0006<WAI0020<CNP0100:0000:0000<SOU0011<SMC<CNP0100:0018:0000<END

Entities used:
#0100: Door sprite with flag 2000 set (run on interact)
#0102: Door sprite with flag 2000 set (run on interact)

Explanation:
This case provides (depending on context) a one-way door (if the first door you encounter is #0102) or a locked door requiring an item to open. Again, the doors are: #0100 @ (9,6) and #0102 @ (6,9).

Lock-if-has (Inter)

On the map you're leaving:

#0100
<KEY<ITJ0001:0101<CNP0100:0000:0000<SOU0011<HMC<FAO0004<TRA0002:0100:0006:0009

#0101
<FLJ0100:0102<MSG
Oops, you bwoke it!<FL+0100<NOD<CLO<END

#0102
<KEY<MSG
Still bowken... <NOD<CLO<END

On the map you're arriving at:
#0100
<CMU0024<SMC<FAI0004<MNA<END

Entities used:
#0100: Door sprite with flag 2000 set (run on interact)

Explanation:
The above is an interesting variation; the door is unlocked if you DON'T have the item, and locked (broken) if you do. Additionally, by the addition of a <FLJ to #0101 and a <FL+ that sets the appropriate flag, you create a second message that says "Still bwoken..." upon re-examining the door. Upon the removal of the item from the inventory, the door will once again function; you need not clear the flag because it is inside an event that is not triggered if the door is unlocked.

Chest (Basic)

#0100
<KEY<FLJ0100:0101<MSG
Opened the chest...<NOD<CLR<CNP0100:0021:0000<SOU0022
<CMU0010<GIT1001<IT+0001You got =Arthurs Key=!<WAI0160<NOD<GIT0001<CLO<FL+0100<END
#0101
<KEY<MSG
Empty...<NOD<CLO<END

Entities used:
#0100: Chest (closed) sprite with flags 2000 (run on interact) and 4000 (invisible if flag ID is set), and it's flag ID set to 100
#0101: Chest (open) sprite with 2000 (run on interact) and 800 (visible if flag ID is set), and it's flag ID set to 100, positioned one tile above #0100

Explanation:
This is a basic script for a chest. Upon opening the chest (#0100), the closed chest is changed to an open one, and the player recieves an item and a little message with the "Got item" jingle, as well as the little graphic of the item. After that, flag #0100 is set. Upon re-examining the now open chest, the player recieves the "Empty..." message (it can be called as event #0001 from any map, but is provided here as #0101 for clarity). Upon leaving and re-entering the stage, because flag #0100 is set, entity #0100 doesn't appear and entity #0101 does. Upon interacting with the chest again, the player still recieves the "Empty..." message.
 
Jul 16, 2009 at 10:28 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
Sticky please! :D
 
Jul 16, 2009 at 10:32 PM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
Jul 17, 2009 at 3:34 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
P.S. Why pasta?
 
Jul 17, 2009 at 6:27 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
DragonBoots said:

Basic Door (Inter-map)

On the map you're leaving:

#0100
<KEY<CNP0101:0000:0000<SOU0011<HMC<FAO0004<TRA0002:0100:0006:0009

On the map you're arriving at:
#0100
<CMU0024<SMC<FAI0004<MNA<END

Entities used:
#0100: Door sprite with flag 2000 set (run on interact)

Explanation:
The above is a basic room-to-room door script.
Upon interacting with entity 101 (a door), the game locks out player control (<KEY), changes the door to a <nothing> (<CNP), makes a door opening sound (<SOU), hides your character (<HMC), fades out into the center (FAO), and travels to map 2, coordinates X: 6 Y: 9, then runs script 0100 on that map (TRA).
Upon arriving at the destination map, the game changes the music (<CMU), unhides your character (<SMC), fades in from the center (<FAI), displays the name of the area (<MNA) and finally frees the earlier player control lock (<END).

Should be <CNP0100:0000:0000, since it's not event #0101.

Some of the other scripts you've posted have similar errors, please double check them.
 
Jul 17, 2009 at 8:37 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3052
hey, speaking of scripts, anybody have zts scripts? those were really useful...
 
Jul 18, 2009 at 2:15 AM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
GIRakaCHEEZER said:
Should be <CNP0100:0000:0000, since it's not event #0101.

Some of the other scripts you've posted have similar errors, please double check them.

Kay thanks.
I'll get right on that, and mebbe add a few.
 
Jul 18, 2009 at 2:30 AM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3052
yay, found what I was looking for! (Here) Now those are some useful scripts. maybe you could do spinoffs
 
Jul 18, 2009 at 4:18 AM
Senior Member
"I, Ikachan. The Life and Documentary of the OrigiNAL SQuiD."
Join Date: Jul 14, 2009
Location:
Posts: 155
How about door disappearing, person appearing, person say some stuff, person disappears, door appears again.

But, on the same map without refreshing, so you can't use flags I suppose.
I hope I learn something from this, thanks.
 
Jul 18, 2009 at 4:47 AM
Luls
"Bleep, Bloop, Bleep, Bloop"
Join Date: Oct 6, 2007
Location: I dunnos
Posts: 1584
Eh... I don't quite think this is a good idea...

Despite the fact that these are commonly used scripts, you can't expect nubs to be copying and pasting these into their mods all their modding life >.> They'll never learn D:

These simple scripts. It's not that hard for them to figure out on their own how to write them. Should leave it to their logic to figure out how to make these types of scripts.

All they need to know to make such features are:
1) How flags work
2) Basic TSC knowledge

Well, at least that's what I feel.

For all you know, they may even know how to come up with more creative ways to make similar scripts, without the need to refer to pre-written ones.
 
Jul 18, 2009 at 5:20 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
For the record, if someone just copy-pastes these scripts without tweaking them, it would demonstrate that they had no clue what they are doing. Fortunately Dragonboots gives some idea of what you would need to tweak with them. An alternative would be to make them in a template format, but that's not really any better (I'd say it's roughly equal).



HOWEVER



I disagree with Metalogz. The presence of this sort of thing means that new designers can focus more on the important parts of designing a mod and less on common idioms such as doors and stuff. Why reinvent the wheel? If it's already done for you, make use of it. Chances are it's better than what you would come up with, simply due to being subjected to collective scrutiny and tweaked until optimal.

(I don't mean to imply that no-one could possibly come up with something better; rather, I'm pointing out that something like this would improve over time, whereas anything you come up with in half an hour or whatever is most likely less developed and more likely to contain subtle errors.)
 
Jul 18, 2009 at 8:30 AM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
While Logz, you do raise a good point, my point has been stated by Minstrel: These scripts are a basic template; not an all-over patch for everything. They provide a basic example of syntax, as well as a template for the most basic of the basic functions. While yes, there always will be the foolish who copy-and-paste these into their mod, and yes they'll never learn that way, but this is a tool for those with drive and curiosity for figuring out how to do many, many things with a very limited pool of resources.

Further more, these are, as stated God knows how many times, the most BASIC of functions, the kind of thing every other script is somehow based on. I will state this again: THESE ARE NOT MEANT TO BE AN ALL-OVER PATCH FOR EVERYTHING. And they are most certainly not a patch for incompetence or an unwillingness to learn; they are a tool.

Lastly, they aren't just for new modders. This can be considered a reference to experienced modders to make sure they get it right and a database of those oh-so-basic but oh-so-irritating to type scripts that we all use but get so tired of typing in.

In conclusion, I put these here to teach. If you are not willing to learn, I cannot change that. If you are willing to learn, these will help. But if none of those reasons conform to your definitions of a good idea, I'll just say I put them here for myself and anyone who wants to read them.


Or, for a CS reference:

"I've long believed that one's weapons should be crafted by oneself. That one who fights with another's weapons and considers that force his own is witless. That one who blames his tools for that which his own power cannot achieve is a fool." - Hermit Gunsmith

This sums it up pretty well; I give you the tools to make your own scripts, and though you could just copy what is here, it would be foolish.
 
Jul 18, 2009 at 5:10 PM
Senior Member
"I, Ikachan. The Life and Documentary of the OrigiNAL SQuiD."
Join Date: Jul 14, 2009
Location:
Posts: 155
My locked chest script doesn't work for some reason.

Code:
#0200
<KEY<ITJ0001:0201<MSGLocked.<NOD<END

#0201
<KEY<FLJ0001:0201<FL+0001<SOU0022<CNP0004:0021:0000
<MSGOpened the chest.<NOD<GIT1001<IT+0001:0000<CLR
<CMU0010Got the =Weaponry Key=!<WAI0160<NOD<GIT0000<CLO<RMU

#0202
<KEY<MSGEmpty.<NOD<END

If you have the answer, could you add a locked script parts for people who are also having problems?

Also, no full colored posts, better change it @_@
 
Jul 18, 2009 at 7:09 PM
Luls
"Bleep, Bloop, Bleep, Bloop"
Join Date: Oct 6, 2007
Location: I dunnos
Posts: 1584
DragonBoots said:
Hueg essay of redness

Lolk.

Thought having them trying to figure out how to make such scripts themselves would make their brain work :x

Edit -

In Gaa's above post, the quote, event #0201 haz problemz: you haz no <END at the end. DUNDUNDUNDUNNNNNNnnn.

nitpicking ftw.
 
Jul 18, 2009 at 7:55 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3052
Also, no full colored posts, better change it @_@
*smacks upside the head.*
 
Jul 18, 2009 at 11:08 PM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
Gaajashin said:
My locked chest script doesn't work for some reason.

Code:
#0200
<KEY<ITJ0001:0201<MSGLocked.<NOD<END

#0201
<KEY<FLJ0001:0201<FL+0001<SOU0022<CNP0004:0021:0000
<MSGOpened the chest.<NOD<GIT1001<IT+0001:0000<CLR
<CMU0010Got the =Weaponry Key=!<WAI0160<NOD<GIT0000<CLO<RMU

#0202
<KEY<MSGEmpty.<NOD<END

If you have the answer, could you add a locked script parts for people who are also having problems?

Also, no full colored posts, better change it @_@

Also, you're script is self-referencing. Ie. Your <FLJ0001:0201 is calling the event it is in, thus never ending.

And for future note, you can use <FLJXXXX:0001 to call the "Empty..." chest line. It's found in Head.tsc, the global script.
(So #0202 is redundant.)

Also also, you're calling to see if the item you get from the box is in your inventory before you get it, and if it isn't, the chest is locked. @_@

Here, lemme see if I can clean this up...

Code:
#0200
<KEY<FLJ0001:0201<MSGLocked.<NOD<END

#0201
<KEY<ITJ0001:0001<SOU0022<CNP0004:0021:0000
<MSGOpened the chest.<NOD<GIT1001<IT+0001<CLR
<CMU0010Got the =Weaponry Key=!<WAI0160<NOD<GIT0000<CLO<RMU<END

So, to call the chest, you put it as #0200
On doing this, the chest is locked.
To unlock it, you have to set flag 0001.
And now it checks to see if you have the item before telling you "Empty..."
For future note, jumps ONLY check to see if it's true, ie. <ITJ0001:0001 checks to see if it's true, and if it is it DOES the jump.

Ps. <IT+XXXX only requires one value.
 
Jul 19, 2009 at 3:51 AM
Senior Member
"I, Ikachan. The Life and Documentary of the OrigiNAL SQuiD."
Join Date: Jul 14, 2009
Location:
Posts: 155
DragonBoots said:


Also, you're script is self-referencing. Ie. Your <FLJ0001:0201 is calling the event it is in, thus never ending.

And for future note, you can use <FLJXXXX:0001 to call the "Empty..." chest line. It's found in Head.tsc, the global script.
(So #0202 is redundant.)

Also also, you're calling to see if the item you get from the box is in your inventory before you get it, and if it isn't, the chest is locked. @_@

Here, lemme see if I can clean this up...

Code:
#0200
<KEY<FLJ0001:0201<MSGLocked.<NOD<END

#0201
<KEY<ITJ0001:0001<SOU0022<CNP0004:0021:0000
<MSGOpened the chest.<NOD<GIT1001<IT+0001<CLR
<CMU0010Got the =Weaponry Key=!<WAI0160<NOD<GIT0000<CLO<RMU<END

So, to call the chest, you put it as #0200
On doing this, the chest is locked.
To unlock it, you have to set flag 0001.
And now it checks to see if you have the item before telling you "Empty..."
For future note, jumps ONLY check to see if it's true, ie. <ITJ0001:0001 checks to see if it's true, and if it is it DOES the jump.

Ps. <IT+XXXX only requires one value.

I hate referencing with head.tsc. So is this ok?

Code:
#0200
<KEY<ITJ0001:0201<MSGLocked.<NOD<END

#0201
<KEY<FLJ0001:0202<FL+0001<SOU0022<CNP0004:0021:0000
<MSGOpened the chest.<NOD<GIT1001<IT+0001:0000<CLR
<CMU0010Got the =Weaponry Key=!<WAI0160<NOD<GIT0000<CLO<RMU<END

#0202
<KEY<MSGEmpty...<NOD<END
 
Jul 19, 2009 at 4:07 AM
Luls
"Bleep, Bloop, Bleep, Bloop"
Join Date: Oct 6, 2007
Location: I dunnos
Posts: 1584
Gaajashin said:
I hate referencing with head.tsc. So is this ok?

Code:
#0200
<KEY<ITJ0001:0201<MSGLocked.<NOD<END

#0201
<KEY<FLJ0001:0202<FL+0001<SOU0022[B][color=#7F7F7F]<CNP0004:0021:0000[/COLOR][/B]
<MSGOpened the chest.<NOD<GIT1001[color=#7F7F7F][B]<IT+0001:0000[/B][/COLOR]<CLR
<CMU0010Got the =Weaponry Key=!<WAI0160<NOD<GIT0000<CLO<RMU<END

#0202
<KEY<MSGEmpty...<NOD<END

<CNP0004:0021:0000?

Aren't you supposed to be CNP'ing sprite 0200? o.o;;

<IT+0001:0000

Like BOoTz saed, <IT+XXXX, not <IT+XXXX:XXXX
 
Jul 19, 2009 at 4:08 AM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
Gaajashin said:
I hate referencing with head.tsc. So is this ok?

Code:
#0200
<KEY<ITJ0001:0201<MSGLocked.<NOD<END

#0201
<KEY<FLJ0001:0202<FL+0001<SOU0022<CNP0004:0021:0000
<MSGOpened the chest.<NOD<GIT1001<IT+0001:0000<CLR
<CMU0010Got the =Weaponry Key=!<WAI0160<NOD<GIT0000<CLO<RMU<END

#0202
<KEY<MSGEmpty...<NOD<END

Hmmm...
The only thing I can see stopping it from working, and I'm not sure of this (lol context), is that the <ITJ in #0200 jumps based on the item INSIDE the chest, thus unlocking the chest if you have the key inside the chest in which you need the key to open.
@_@
Did I get that out right?

But anyways, apart from that, it looks pretty good. No extraneous or missed functions catch my eye, all required commands in the right place.

Hmmm...
<CNP0004... I assume that's the chest?
 
Back
Top