1
0
Просмотр исходного кода

[added] mod options menu to mod_setting page table. Mods need to be reinstalled to activate new menu. Options only show for mods updated with the new config.
[added] mod_isample_options location.
[added] isample mod to the QSP/isample_mod directory for ease of locating and editing.
[changed] mod_isample_setup to activate the new options links.
[fixed] killvar for $mod_info.

3xpurt 5 лет назад
Родитель
Сommit
4d522d0e41

+ 15 - 0
QSP/isample_mod/isample.qproj

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<QGen-project version="4.0.0 beta 1">
+  <Structure>
+    <Folder name="setup">
+      <Location name="mod_isample_options"/>
+      <Location name="mod_isample_setup"/>
+      <Location name="mod_isample_readme"/>
+      <Location name="mod_isample"/>
+    </Folder>
+    <Folder name="locations">
+      <Location name="mod_isample_pavResidential"/>
+      <Location name="mod_isample_street"/>
+    </Folder>
+  </Structure>
+</QGen-project>

BIN
QSP/isample_mod/isample.txt


+ 47 - 0
QSP/isample_mod/locations/mod_isample.qsrc

@@ -0,0 +1,47 @@
+# mod_isample
+!input mod entry point here. this will be checked on every location, please keep it clean and brief to avoid game lag
+
+
+!entry point 1: if player is on bed, create a new link to make her sleepy
+if $curloc = 'bed2' and $args[0] = '':
+	if pcs_sleep > 80:
+		'[mod]... But You can make yourself <a href="exec:pcs_sleep=0&gt $curloc">sleepy!</a>'
+	else
+		'[mod]... And you are already sleepy.'
+	end
+end
+
+
+!entry point 2: goto school directly from room
+!Note that location name are case sensetive. you can use lcase() or ucase() to prevent bug
+if lcase($curloc) = 'bedrpar' or ucase($curloc) = 'KORRPAR':
+		act '[mod]<font color = green><b>Go to school</b></font>': minut += 1 & gt 'gschool_grounds', 'main'
+end
+
+
+!entry point 3: replace exit room act in apartment
+
+if $curloc = 'bedrPar':
+	delact 'Exit the room'
+	act 'Exit the room':
+		msg 'Now mod isample will send you to school directly'
+		minut += 1 & gt 'gschool_grounds', 'main'
+	end
+end
+
+!entry point 4: access in-mod location
+if $curloc = 'pavResidential':
+	act '[mod]Chase the rabbit':
+		gt 'mod_isample_pavResidential'
+	end
+end
+
+if $curloc = 'street':
+	act '[mod]Jump into rabit hole':
+		*clr & cla
+		'[mod]Suddenly, everything blank out'
+		gs 'mod_isample_street'
+	end
+end
+--- mod_isample ---------------------------------
+

+ 10 - 0
QSP/isample_mod/locations/mod_isample_options.qsrc

@@ -0,0 +1,10 @@
+# mod_isample_options
+
+*clr&cla
+! This is where you place the configuration options for your mod.
+'There are currently no options available for this mod.'
+
+act 'return': gt 'mod_setting'
+
+--- mod_isample_options ---------------------------------
+

+ 7 - 0
QSP/isample_mod/locations/mod_isample_pavResidential.qsrc

@@ -0,0 +1,7 @@
+# mod_isample_pavResidential
+!mod event. remember to add a act to exit
+'[mod-isample]'
+'You try to chase the rabbit in town, sadly, this is only a sample mod, so there are no rabbit in sight.'
+act 'Back to town': gt 'pavResidential'
+--- mod_isample_pavResidential ---------------------------------
+

+ 44 - 0
QSP/isample_mod/locations/mod_isample_readme.qsrc

@@ -0,0 +1,44 @@
+# mod_isample_readme
+!input your mod detail readme here. you can use msg or detailed structure, just make sure to create act 'return': gt 'mod_setting'
+*clr&cla
+act 'return': gt 'mod_setting'
+
+'<center>Mod <b>isample</b></center>'
+'This is a sample for new mod system, please fill your own mod in this form
+1. Since QSP can not load location with same name, and there are no warning about this during adding new qsp files, please name ALL YOUR LOCATION NAME with <B>mod_name_xxx</B> to avoid duplication bug.
+
+2. please DO NOT use space or non-ascii character in location name. you can use use _ instead. -- this may cause bug on txtsplit function for git
+
+3. The first location MUST be named as "mod_name_setup", this system will call it and load necessary information from it.
+$mod_info[0] = mod name
+$mod_info[1] = mod version
+10203 will be displayed as version 1.2, fix3.
+40500 will be showen as version 4.5
+$mod_info[2] = author name
+$mod_info[3] = short description for this mod
+
+4. please create "mod_name_readme" location for mod detail readme (just like this location)
+  If you really have only one line for this, you can use a simple msg instead a long text.
+  
+5. put all your entry point in location "mod_name"
+You can use lots of condition check there, check this sample file yourself.
+Frequency used condition:'
+'<table>'
+*p "<tr><td>current location"
+"<td>if $curloc = '...'</td></tr>"
+*p "<tr><td>current stage"
+"<td>if $ARGS[0] = '...'</td></tr>"
+*p "<tr><td>variable value"
+"<td>if aaa > 10 </td></tr>"
+'</table>
+Please note that strings are case sensitive, you can use lcase() or ucase() to shft them before check.
+
+
+6. Due to techinque issue, this mod system CAN NOT recognition locations use value in ARGS (luckly, only system functions use this, so you shall not worry about this.)
+for example, gs ''indik'', ''2'', 100
+
+Have a nice day, and Welcome to join this Community!
+
+--- illume, 2018/1/25'
+--- mod_isample_readme ---------------------------------
+

+ 35 - 0
QSP/isample_mod/locations/mod_isample_setup.qsrc

@@ -0,0 +1,35 @@
+# mod_isample_setup
+!input basic mod information here. 
+!this location must be the first one
+
+$mod_info[0] = 'isample'
+!0=mod name, saved to $mod_name[i] array 
+
+$mod_info[1] = '10203'
+!1=mod version
+!this will be displayed as version 1.2, fix3.
+!if you input 40500, will be showen as version 4.5
+
+$mod_info[2] = 'illume'
+!2=mod author
+
+$mod_info[3] = 'This is a sample for new mod system, please fill your own mod in this form'
+!3=mod description, input a short brief here.
+
+$mod_info[4] = 'Options'
+!4=mod options/settings link name.
+
+
+if curloc = 'mod_<<$mod_info[0]>>_setup':
+	usehtml = 1
+	!this will be only showed if you exec mod file. This location should be only called by gs, so this line will not trigger on normal mod playing
+	'<center><h1><font color=red>ACCESS DENIED</font></h1></center>'
+	'<<$mod_info[0]>> is a mod for <b>Girl Life - English Community Version</b>, and can not be played individually.'
+	''
+	'You can find the main game in <a href="https://www.tfgamessite.com/index.php?module=viewgame&id=597">Tfgames site</a> (external link)'
+	''
+	'Our forum: <a href="https://tfgamessite.com/phpbb3/viewforum.php?f=70">Tfgames site</a> (external link)'
+end
+
+--- mod_isample_setup ---------------------------------
+

+ 7 - 0
QSP/isample_mod/locations/mod_isample_street.qsrc

@@ -0,0 +1,7 @@
+# mod_isample_street
+!mod event. remember to add a act to exit
+'[mod-isample]'
+'You try to jump into rabbit hole, sadly, this is only a sample mod, so you can not even find a hole to jump.'
+act 'Back to street': gt 'street'
+--- mod_isample_street ---------------------------------
+

+ 44 - 0
QSP/isample_mod/txtmerge.py

@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# usage: txtmerge.py <input_dir> <output_file_name> 
+# does the exact opposite of txtsplit.py
+
+import os
+import sys
+import re
+import io 
+import xml.etree.ElementTree as ET
+
+assert len(sys.argv) == 3, "usage:\ntxtmerge.py <input_dir> <output_file_name>"
+idir = str(sys.argv[1])
+oname = str(sys.argv[2])
+
+# read the project xml file first
+# let's do this later in order to implement directory structure
+tree = ET.parse('isample.qproj')
+root = tree.getroot()
+
+
+ofile = io.open(oname, 'w', encoding='utf-16', newline='\r\n')
+
+for location in root.iter('Location'):
+    iname = location.attrib['name']
+    iname = iname.replace("$","_")
+
+    try:
+        ifile = io.open(os.path.join(idir,iname + '.qsrc'), 'rt', encoding='utf-8')
+        text = ifile.read()
+
+        # make sure there's a line at the end of file
+        # (why wouldn't there be one? WINDOWS!
+        if text[-1] != u'\n':
+            text += u'\n\n'
+
+        ofile.write(text)
+        ifile.close()
+    except IOError:
+        print("WARNING: missing location %s" % iname)
+        pass
+
+ofile.close()
+    
+        

+ 11 - 7
locations/mod_setting.qsrc

@@ -17,19 +17,21 @@ end
 '<b>WARNING</b>: Game slowdown may occur when installing too many mods, or mods with bad structure.'
 if mod_list > 0:
 
-	'<table border=1><tr><td>id</td><td>Name</td><td>Version</td><td>Author</td><td>Description</td></tr>'
+	'<table border=1><tr><td>id</td><td>Name</td><td>Version</td><td>Author</td><td>Description</td><td>Options</td></tr>'
 	mod_i=1
 	:mod_alllist
 	if $mod_name[mod_i] ! '':
+		!name
 		gs 'mod_<<$mod_name[mod_i]>>_setup'
 		*p '<tr><td><<mod_i>></td><td><<$mod_info[0]>></td>'
-		!name
-		*p '<td><<val($mod_info[1])/10000>>.<<(val($mod_info[1]) mod 10000)/100>> <<iif(val($mod_info[1]) mod 100 > 0, ''fix <<val($mod_info[1]) mod 100>> '', '' '')>></td>'
 		!version
-		*p '<td><<$mod_info[2]>></td>'
+		*p '<td><<val($mod_info[1])/10000>>.<<(val($mod_info[1]) mod 10000)/100>> <<iif(val($mod_info[1]) mod 100 > 0, ''fix <<val($mod_info[1]) mod 100>> '', '' '')>></td>'
 		!author
-		*p '<td><a href="exec:gs ''mod_<<$mod_info[0]>>_readme''"><img src="images/system/icon/anptekainfo.jpg"></a> <<$mod_info[3]>></td></tr>'
+		*p '<td><<$mod_info[2]>></td>'
 		!description and readme
+		*p '<td><a href="exec:gs ''mod_<<$mod_info[0]>>_readme''"><img src="images/system/icon/anptekainfo.jpg"></a> <<$mod_info[3]>></td></tr>'
+		!mod options page
+		*p '<td>'+iif($mod_opt[mod_i] ! '','<a href="exec:gs ''mod_<<$mod_info[0]>>_options''"><<$mod_info[4]>></a>','')+'</td></tr>'
 	else
 		'ERROR loading mod id <<mod_i>>, no mod name available'
 	end
@@ -38,14 +40,14 @@ if mod_list > 0:
 		mod_i+=1
 		jump 'mod_alllist'
 	end
-	killvar 'mod_info'
+	killvar '$mod_info'
 	'</table>'
 else
 	'<br>You have no Mods activated.'
 end
 '</center>'
 act ''+iif(settingmode = 1, '<center><b>Install new mod</b></center>','Install new mod')+'':
-	killvar 'mod_info'
+	killvar '$mod_info'
 	$mod_temp=input('input mod name (as for the example image above, input <B>isample</B>)')
 	if $mod_temp='':exit
 	addqst 'mod/<<$mod_temp>>.qsp'
@@ -59,6 +61,7 @@ act ''+iif(settingmode = 1, '<center><b>Install new mod</b></center>','Install n
 	$mod_version[mod_list] = $mod_info[1]
 	$mod_author[mod_list] = $mod_info[2]
 	$mod_desc[mod_list] = $mod_info[3]
+	$mod_opt[mod_list] = $mod_info[4]
 	gt $loc, $metka
 end
 act ''+iif(settingmode = 1, '<center><b>Disable all mods</b></center>','Disable all mods')+'':
@@ -69,6 +72,7 @@ act ''+iif(settingmode = 1, '<center><b>Disable all mods</b></center>','Disable
 		killvar '$mod_version'
 		killvar '$mod_author'
 		killvar '$mod_desc'
+		killvar '$mod_opt'
 		'All mod disabled. You can re-install them later.'
 		cla
 		act 'Continue':gt $loc, $metka