No Description

chopeks 9592bc3477 food fix 5 years ago
gradle b39eb2d5f7 init 5 years ago
libs b39eb2d5f7 init 5 years ago
src 9592bc3477 food fix 5 years ago
.gitignore 5fd600c736 npc 5 years ago
README.md 1499a296cf dishes, bathrooms 5 years ago
build.gradle b39eb2d5f7 init 5 years ago
changelog.md 186dbb396c piercing event, traveling in style 5 years ago
gradle.properties b39eb2d5f7 init 5 years ago
gradlew b39eb2d5f7 init 5 years ago
gradlew.bat b39eb2d5f7 init 5 years ago
settings.gradle b39eb2d5f7 init 5 years ago

README.md

Transplier

Can be found here: https://github.com/chopeks/kotlin-to-qsp-transpiler

If there are bugs or so in transpiler, let me know.

Mod writing

  1. Intellij IDEA is recommended (can be community edition)
  2. check Main.kt and change directories
  3. put mod files in src/main/kotlin/qsrc
    • files can be placed in sub directories
    • you can use 'empty_file_you_can_copy.kts' as template
    • you can put qsrc files too, they'll be copied as is

Compiling this project will result in generated .qsp file!

NOTE: mod files have to be .kts (.kt won't transpile)

API

There are a few apis already covered in com.chopeks.glife package, for example:

  • all Girl Life locations
  • most (some may be missing) of Girl Life variables
  • enums for:
    • arousal
    • pain
    • location type
    • fetishes
    • more to come (probably ;))

There are also some kotlin extensions in com.chopeks.glife.extensions. These fragments of code are copied as is (with parameters replaced) during transpiling. For example

fun GLExtensions.image(__image: String) {
  "<center><img ${`$set_imgh`} src=__image/></center>"
}
// and calling it like this:
ext.image("mod/image/whatever.jpg")

will be translated to:

'<center><img <<$set_imgh>> src="mod/image/whatever.jpg"/></center>`

in qsrc file.

You can also define your own in mod.extensions.ModExtensions.kt

NOTE: no comments allowed inside of function body, it's ok to have comment outside of function body

Other API tricks

GS, GT and GLLoc:

Instead of going like:

gs 'bed2', 'start'

You can do that typesafe way like this:

gs(GLLoc.bed2.start)

which will be transpiled to one above. One note here: when using with GT,GS,XGT - it will transpile to whole path, but when using it in if statement, or assignment, it will transpile to last value. For example:

// this will translate to gs 'bed2', 'start'
gs(GLLoc.bed2.start)
// this will translate to if $args[0] = 'start':
if(`$args`[0] == GLLoc.bed2.start)
// but this one will translate to if $args[0] = 'bed2':
if(`$args`[0] == GLLoc.bed2)

You can also define your own mod structure in ModLocation.kt

Separating code in one line

Qsp uses &, kotlin uses ;, so:

// in qsp: *clr& cla
clr(); cla() 

Note that kotlin if can only have 1 statement without brackets, so:

if(n == 0) clr(); cla()

is same as

if(n == 0) {
  clr()
}
cla()
KillVar

you can use variable directly:

killVar(temp) // which will translate to killvar 'temp'
Types

There are 2 types:

  • QspType - which is kotlin Any on steroids (more operators, array access etc)
  • QspCodeTemplate - which is used with conjunction with dynamic() (also allows kotlin anonymous lambda)
Strings

Strings are normal, with " as \" escape, while ' is '. No doubles.