Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

JJ's Jank Script examples. Sticky

A topic by JJXB created Aug 25, 2020 Views: 1,067 Replies: 2
Viewing posts 1 to 5
Moderator (15 edits)

CURRENT SCRIPT UPDATE: 10/05/2021 - Fixes and minor feature adds along with refactoring of ui boundary handling

So, you've read the documents and want some more examples of scripts to work with? This is the right topic for you!

TIPS:

1. If you are struggling to find a game to experiment with scripts (read: not as a serious profile),  I would suggest that you try to use "Side Pocket" and go to practice. This gives you a good sandbox to not only explore shape features but also work on your knowledge of scripting in a time-unlimited manner.

2. Work environment. I personally use Notepad++ to do my scripting work because it has room for multiple file tabs. As such i have my reference files and 4 work files that allow me to have multiple scripts at the ready (example: in one tab i can have my UI script on it's own and another tab my rotation script on it's own for me to either work on adding features or to modify them per game). Plus working in notepad++ has the benefit of being able to set lua styling so you can see if anything is out of place. 

DISCLAIMER:

Before you look at these, take into account:

1. These are not created by an expert (read: I ain't as good as geod at this)

2. These may have some weirdness (I created these for my use primarily but i am putting these out there as possible help for others)

3. They are subject to change and as such, if you grabbed a copy of the reference files one day, they may change within the next day (depending on how much I may or may not have done).

4. I am happy to take feedback/suggestions on these to make them less jank but i cannot guarantee how much i will be able to do in some circumstances. 

WITH THAT IN MIND, THE SCRIPTS

The Scripts

Script_Ref_Main.txt

A - a base UI script that has the following features:

1. Automatic UI layering based on an "inGame" tag paired with ui threshhold values to define in renderspace where UI boundaries are.

2. *NEW! - WIP* UI Detection based on shape tags. To use, set uiautoenable=1, set uiautotype to the one you want (1 being shapes outside of the boundaries, 2 for inside the boundaries) and tag a shape at the edge of the UI border with either “bl” for the lower boundaries (referring to bottom left)  and “ur” for the upper boundaries (referring to upper right)

3. Menu state tag (tag any shape with "menu") that auto-sets anything on screen as UI layer. useful for as the tag implies, menus.

4. Manual "ui" tag

5. Camera Lock function so camera view can be locked in place

6. Camera Reset function for use with anything that needs specific camera resets (example: a rotation script) - Kind of useless at the moment, might remove later.

7. UI X and Y Shift Variables and Switch vars. allows for anything UI (either tagged or boundary based) to be shifted on either the X or Y axis (Z axis possibly forthcoming)

8. UI Method switches. Allows for any "ui" elements of either type to be handled in one of two fashions: shape.UI definition *or* extra Z offset applied to bring it out of the main game screen.

9. (Temporary) A camera angle reset hotkey combo (NES Select and B together). a full list of possible NES button input reads available in Script_Ref_Small in case you cant to use it for your own purposes (example: activating cheats in some fashion)

B - Generic Layer Correction script:

Mainly built this to do minor things like possible alpha changes etc. not much here of note at the moment.

C - Rotation Script:

See Next Post.

D - Shape Location Detection

Explanation to be written up

There is no point in explaining Script_Ref_Small.txt as it is literally just a bunch of working script segments to refer to for things that might need good examples (such as ReadMem and WriteMem).

If you have any queries or feedback on these scripts, this thread will remain open to posts and I am available on Discord as both a moderator of the 3DSen Discord or directly with JJXB#0248 (Please try not to DM me every living moment pls :P I have a child and will sometimes be unavailable). Plus, you are free to modify these scripts in your profiles to add things (such as extra tag detects etc) to fit your needs.

Moderator (3 edits)

-ROTATION-

This one gets it's own post. It takes some more explanation to do so. And it's tied in extensively with the UI script so if you want to try this, you need that too.

Since last posting this, i have simplified this down to what was previously called the "EMethod" and removed the CMethod that might have confused people. 

It just rotates the camera to an appropriate angle and sets any sprites to have a 30 degree rotation. Sky code is complete enough that skyenable=1 will work but will still be buggy. I have also added in the ability to tag a shape with “skyt” and enable dynamic sky with dynamicsky=1, which is also wip.

I have also added in the ability to define camera resets. I’ll write this up later but if you wish to poke at it and try it yourself, it’s there.

Moderator (2 edits)

Applying any scripts i have created:

1. Open the maker and your game, then go to the scripting tab in the gui. 


2. open the file you're getting a piece of script from and copy/paste it into the main text window of the scripting tab. Then name your script in the name box and put an asterisk ( a * ) in the tags box to indicate to run this on any tag (I usually end up doing if statements in code to check for tags instead). then click on "New" and the new button should disappear and Adjust and Delete should appear instead along with the script in the list. 


3. test the code. like in this example i copied and pasted in my UI code and then marked a single letter on the HUD as ui tagged (in this case, the Y from "ENEMY":


-----

In the future i will likely outline how to use a couple of the features of my scripts in more depth. in the meantime, experiment and mess around with my janky scripts.