Sep 4, 2011 at 10:08 PM
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
I was originally planning to post this in Modding General Discussion, but it looks like other demonstration-type mods are always in the showcase, so here we go.
On modern computers, you can run multiple applications in parallel.
For example, you could have a text editor, an image editor, and a web browser open simultaneously.
Have you noticed that when you edit TSC scripts, there's normally no way to run multiple TSC events at the same time?
Well - I've created this little assembly hack (a proof of concept hack)
that lets you run up to two TSC events at the same time.
There are many limitations to this prototype hack, so it may not be able to do what you actually want it to do (such as running an event in the background while still allowing you to open doors / talk to NPCs). With a little work, this hack should become more advanced in the future and may be able to support such things.
The implementation is based on three TSC commands. Two of them are newly hacked ones:
<THRXXXX
Creates a new thread that runs event X. In other words, this command will continue to run the current event and will begin running event X at the same time.
If two threads are already running, this command does nothing.
<DCT
Destroy current thread. This will end the currently running thread without affecting any other threads.
If no other threads are running, then <DCT is the same as <END.
<END
Destroys all threads, including the one that is running.
Download the Demonstration Mod
(use the Terminal on the right to run events 103 and 104 at the same time.
use the Computer on the left to run events 105 and 106 at the same time.
Do not start up a new game - just use the existing save file.)
Here is some of the TSC code for the room.
The computer will begin with event #0102 and the terminal will begin with the event #0101.
Event 103 will create explosion sounds and event 104 will create teleportation sounds.
Because the events are run in parallel using <THR, you will hear the explosion and teleportation sounds at the same time.
Event 105 will destroy some tiles on the map and will create a sound effect when each tile is removed.
Event 106 will create hearts and missiles at the same coordinates of the destroyed tiles.
These two events are also run in parallel, so when a tile is destroyed, a heart or missile will automatically show up in its place.
Event 105 ends earlier than 106 because it executes a <DCT before 106 can execute its <END.
Download the ASM Files (Doukutsu Assembler format)
Download the installable hex codes (Autohacker format)
WARNING:
--This hack uses the Heavy Press code as if it were free space, so don't use the heavy press in your mod if you want to install this hack without modifying the ASM.
--Do not use flags 7904 through 7969. Actually, I don't remember which set of flags I used for the hack, but they were definitely inside the range 7904 - 7969.
--This hack does not overwrite the second <FAC command, <XX1, or any other existing TSC command. All the normal commands are still there.
This is also my sneaky way of telling you that the Assembler has been updated to version 1.31 because of a progress bar bug in version 1.3.
To all ASM hackers: this is an open-sourcy hack, so go ahead and make modifications to make this hack more effective, etc. I really encourage you to post your findings and/or progress.
On modern computers, you can run multiple applications in parallel.
For example, you could have a text editor, an image editor, and a web browser open simultaneously.
Have you noticed that when you edit TSC scripts, there's normally no way to run multiple TSC events at the same time?
Well - I've created this little assembly hack (a proof of concept hack)
that lets you run up to two TSC events at the same time.
There are many limitations to this prototype hack, so it may not be able to do what you actually want it to do (such as running an event in the background while still allowing you to open doors / talk to NPCs). With a little work, this hack should become more advanced in the future and may be able to support such things.
The implementation is based on three TSC commands. Two of them are newly hacked ones:
<THRXXXX
Creates a new thread that runs event X. In other words, this command will continue to run the current event and will begin running event X at the same time.
If two threads are already running, this command does nothing.
<DCT
Destroy current thread. This will end the currently running thread without affecting any other threads.
If no other threads are running, then <DCT is the same as <END.
<END
Destroys all threads, including the one that is running.
Download the Demonstration Mod
(use the Terminal on the right to run events 103 and 104 at the same time.
use the Computer on the left to run events 105 and 106 at the same time.
Do not start up a new game - just use the existing save file.)
Here is some of the TSC code for the room.
The computer will begin with event #0102 and the terminal will begin with the event #0101.
Code:
#0101
<KEY<MSGRunning events 103 and 104
at the same time...<NOD<CLO<EVE0103
#0102
<KEY<MSGRunning events 105 and 106
at the same time...<NOD<CLO<EVE0105
#0103
[color=#FF0000]<THR0104[/COLOR]
<SOU0044<WAI0015
<SOU0044<WAI0015
<SOU0044<WAI0015
<SOU0044<WAI0015
<SOU0044<WAI0015[color=#FF0000]<DCT[/COLOR]
#0104
<SOU0029<WAI0015
<SOU0029<WAI0015
<SOU0029<WAI0015
<SOU0029<WAI0015
<SOU0029<WAI0015[color=#FF0000]<DCT[/COLOR]
#0105
[color=#FF0000]<THR0106[/COLOR]<SOU0012<CMP0101:0078:0000
<WAI0010
<SOU0012<CMP0102:0078:0000
<WAI0010
<SOU0012<CMP0103:0078:0000
<WAI0010
<SOU0012<CMP0101:0079:0000
<WAI0010
<SOU0012<CMP0102:0079:0000
<WAI0010
<SOU0012<CMP0103:0079:0000
<WAI0010[color=#FF0000]<DCT[/COLOR]
#0106
<SNP0087:0101:0078:0001
<WAI0005<WAI0005
<SNP0086:0102:0078:0001
<WAI0005<WAI0005
<SNP0087:0103:0078:0001
<WAI0005<WAI0005
<SNP0086:0101:0079:0001
<WAI0005<WAI0005
<SNP0087:0102:0079:0001
<WAI0005<WAI0005
<SNP0086:0103:0079:0001
<WAI0005<WAI0005
<PRI<MSGEnjoy your hearts & missiles.<NOD<CLO<END
Event 103 will create explosion sounds and event 104 will create teleportation sounds.
Because the events are run in parallel using <THR, you will hear the explosion and teleportation sounds at the same time.
Event 105 will destroy some tiles on the map and will create a sound effect when each tile is removed.
Event 106 will create hearts and missiles at the same coordinates of the destroyed tiles.
These two events are also run in parallel, so when a tile is destroyed, a heart or missile will automatically show up in its place.
Event 105 ends earlier than 106 because it executes a <DCT before 106 can execute its <END.
Download the ASM Files (Doukutsu Assembler format)
Download the installable hex codes (Autohacker format)
WARNING:
--This hack uses the Heavy Press code as if it were free space, so don't use the heavy press in your mod if you want to install this hack without modifying the ASM.
--Do not use flags 7904 through 7969. Actually, I don't remember which set of flags I used for the hack, but they were definitely inside the range 7904 - 7969.
--This hack does not overwrite the second <FAC command, <XX1, or any other existing TSC command. All the normal commands are still there.
This is also my sneaky way of telling you that the Assembler has been updated to version 1.31 because of a progress bar bug in version 1.3.
To all ASM hackers: this is an open-sourcy hack, so go ahead and make modifications to make this hack more effective, etc. I really encourage you to post your findings and/or progress.
Last edited by a moderator: