Custom scripts (Script Define)

Post Reply
User avatar
baardbi
Posts: 77
Joined: Sun Jul 07, 2019 2:28 pm
Location: Norge

Custom scripts (Script Define)

Post by baardbi » Wed Feb 12, 2020 7:59 pm

I tried to find something here on the forums, but couldn't find exactly what I was looking for.

My question is split in two:

1. When I make my own custom ASM script and add it to Script Defines (Script Settings), how do I call the script from other asm scripts? ...or have I misunderstood something, and should be making a macros instead?

2. When I add this custom script, I found out the other scripts used "SCR_ something something" as Define, so I did it with my script as well. What is this define used for (is this the answer to my first question? :lol: )...?
User avatar
Bucket Mouse
Posts: 354
Joined: Wed Mar 07, 2018 2:25 am

Re: Custom scripts (Script Define)

Post by Bucket Mouse » Wed Feb 12, 2020 9:15 pm

I'm no Dale, but I believe what you want to do is call a subroutine. Like.....

JSR Nameofcustomscript

Just be sure the script itself returns you back. For that it needs RTS at the end.
User avatar
Mugi
Posts: 806
Joined: Thu Dec 27, 2018 8:30 pm

Re: Custom scripts (Script Define)

Post by Mugi » Thu Feb 13, 2020 1:31 am

the define is the calling name of the script.

using JMP like bucket mouse said, can be used to jump into a LABEL of a code (something that ends with : in code)
the SCR_***** define given to the script in script settings defines how the compiler sees this file. this define is used to include the .asm into the project (.include SCR_whatever)

when you make a script define in nesmaker UI, the script will become wisible in the scripts list, but it is not actually added to the project and is not usable before the include has been made
to include a script you simply do

Code: Select all

.include SCR_whateveryourscriptdefinenameis

this needs to be done in a bank which you wish to use to store the script (for userscripts, this is bank14)
bank defines can be found from gameenginedata/routines/basic/bankdata
"what are you up to?" "Oh, not much... just... Parallaxing"
- Raftronaut
User avatar
Bucket Mouse
Posts: 354
Joined: Wed Mar 07, 2018 2:25 am

Re: Custom scripts (Script Define)

Post by Bucket Mouse » Thu Feb 13, 2020 7:31 am

JMP and JSR are two different things though. JMP is a permanent move to the script. If he's trying to call his script from another script, then I'm assuming he wants to return to that other script after it's done its thing, so he would want JSR.
User avatar
baardbi
Posts: 77
Joined: Sun Jul 07, 2019 2:28 pm
Location: Norge

Re: Custom scripts (Script Define)

Post by baardbi » Thu Feb 13, 2020 2:33 pm

Thanks a lot guys. This was really helpful :) I also found out that most of the time I could just make macros to do the things I want.
User avatar
Mugi
Posts: 806
Joined: Thu Dec 27, 2018 8:30 pm

Re: Custom scripts (Script Define)

Post by Mugi » Fri Feb 14, 2020 3:51 am

Bucket Mouse wrote:
Thu Feb 13, 2020 7:31 am
JMP and JSR are two different things though. JMP is a permanent move to the script. If he's trying to call his script from another script, then I'm assuming he wants to return to that other script after it's done its thing, so he would want JSR.
thanks for confifming that im dyslexic :P

either way the point stands. if you wish to add a completely new assembly to the project, it has to be included into the bank asm in order to be usable.
you cannot JMP (or JSR for that matter) to something that does not exist.
"what are you up to?" "Oh, not much... just... Parallaxing"
- Raftronaut
Post Reply