Kaynağa Gözat

CleanHTML function added. When making HTML tables, if any whitespace is included between the tags, extra space is rendered above the table in the main viewing area. I added a function to remove whitespace from in between HTML tags so that I can write Readable code, but it will be rendered to the screen as the render engine needs.

KeyMasterOfGozer 5 yıl önce
ebeveyn
işleme
cfc9793c05

+ 1 - 0
glife.qproj

@@ -1125,5 +1125,6 @@
 		<Location name="treeCircActs"/>
 		<Location name="treeCircEntry"/>
 	</Folder>
+	<Location name="cleanHTML"/>
 	</Structure>
 </QGen-project>

+ 2 - 2
locations/Cheatmenu_din.qsrc

@@ -1538,7 +1538,7 @@ $cheatmenu['magicTable'] = {
 		</table>
 	</center>"
 
-	*p $SpellListStr
+	*pl func('cleanHTML',$SpellListStr)
 
 	killvar 'i'
 	killvar '$ThisSpellName'
@@ -1590,7 +1590,7 @@ $cheatmenu['magic'] = {
 		</table>
 	</center>"
 
-	*p $SpellListStr
+	*pl func('cleanHTML',$SpellListStr)
 
 	killvar 'i'
 	killvar '$ThisLocation'

+ 26 - 0
locations/cleanHTML.qsrc

@@ -0,0 +1,26 @@
+#cleanHTML
+!Removes Whitespace from between HTML tags in a string.
+!	Purpose is because having whitespace in writing code makes readablility,
+!	but the rendering engine adds extra lines at top for no reason.
+!
+!	$ARGS[0] = is the string to be cleaned up.
+!
+!	Call this as a Function to get the cleaned string returned
+!	example:
+!		*pl func('cleanHTML', $HTMLString)
+
+$HTMLString = $ARGS[0]
+
+:cleanHTMLloop
+$BadStr = STRFIND($HTMLString, '\>\s+\<', 0)
+if $BadStr ! "":
+	$HTMLString = REPLACE( $HTMLString , $BadStr , "><" )
+	jump 'cleanHTMLloop'
+end
+
+$result = $HTMLString
+
+killvar '$HTMLString'
+killvar '$BadStr'
+
+--- cleanHTML ---------------------------------

+ 14 - 1
locations/lab.qsrc

@@ -345,7 +345,7 @@ if $ARGS[0] = 'Tatiana':
 		$VirginTab = "<a href=""EXEC:pcs_vag = 0 & pcs_manna -= 40 & gs 'arousal', 'voyeur', 30 & gs 'stat' & gt 'lab', 'BodyModded', 'Virginity', 'renewed'"">Renew Virginity</a>"
 		$SiliconeTab = "<a href=""EXEC:brSurTemp = 0 & stringimplant = 0 & fillimplant = 0 & pcs_manna -= 40 & gs 'arousal', 'voyeur', 30 & gs 'stat' & gt 'lab', 'BodyModded', 'Boobs', 'natural again'"">Remove Silicone</a>"
 
-		"<CENTER>
+		$SpellListStr = "<CENTER>
 	<TABLE CELLPADDING = '5'>
 		<TR>
 			<TD><<$SkinTab>></TD>
@@ -365,6 +365,19 @@ if $ARGS[0] = 'Tatiana':
 	</TABLE>
 </CENTER>"
 
+		*pl func('cleanHTML',$SpellListStr)
+
+		killvar '$HairColorTab'
+		killvar '$HairLengthTab'
+		killvar '$EyeColorTab'
+		killvar '$EyeLashTab'
+		killvar '$LipTab'
+		killvar '$BreastTab'
+		killvar '$SkinTab'
+		killvar '$VirginTab'
+		killvar '$SiliconeTab'
+		killvar '$SpellListStr'
+
 		act 'No, no, I''ve changed my mind. Thank you':gt 'lab', 'Tatiana'
 
 

+ 20 - 4
locations/magik.qsrc

@@ -6,26 +6,42 @@ if spellMana['fog'] = 0:
 	gs 'spellList'
 end
 
-$SpellListStr = "<center><h1>Choose a Spell to cast.</h1><br><table CELLPADDING = '5'><tr><th align='left'>Spell</th><th align='left'>Mana</th><th align='left'>Description</th></tr>"
+$SpellListStr = "
+<center>
+	<h1>Choose a Spell to cast.</h1>
+	<br>
+	<table CELLPADDING = '5'>
+		<tr>
+			<th align='left'>Spell</th>
+			<th align='left'>Mana</th>
+			<th align='left'>Description</th>
+		</tr>"
 i = 0
 numSpellsKnown = 0
 :CombatSpellLoop
 $ThisSpellName = $combatSpells[i]
 if i < arrsize('$combatSpells'):
 	if spellKnown[$ThisSpellName] = 1:
-		$SpellListStr = $SpellListStr + "<tr><td align='left'><a href=""EXEC: cls & gs 'castSpell', '<<$ThisSpellName>>'& xgt 'fight','sta' & act 'Physical attacks':gt'boxing' & act 'Magic attacks':gt'magik'""><<$spellName[$ThisSpellName]>></a></td><td align='right'><<spellMana[$ThisSpellName]>></td><td align='left'><<$spellDesc[$ThisSpellName]>></td></tr>"
+		$SpellListStr = $SpellListStr + " 
+		<tr>
+			<td align='left'><a href=""EXEC: cls & gs 'castSpell', '<<$ThisSpellName>>'& xgt 'fight','sta' & act 'Physical attacks':gt'boxing' & act 'Magic attacks':gt'magik'""><<$spellName[$ThisSpellName]>></a></td>
+			<td align='right'><<spellMana[$ThisSpellName]>></td>
+			<td align='left'><<$spellDesc[$ThisSpellName]>></td>
+		</tr>"
 		numSpellsKnown += 1
 	end
 	i += 1
 	jump 'CombatSpellLoop'
 end
 
-$SpellListStr = $SpellListStr + "</table></center>"
+$SpellListStr = $SpellListStr + " 
+	</table>
+</center>"
 
 if numSpellsKnown = 0:
 	"No combat spells known."
 else
-	$SpellListStr
+	*pl func('cleanHTML',$SpellListStr)
 end
 
 killvar 'i'

+ 1 - 1
locations/obj_din.qsrc

@@ -1532,7 +1532,7 @@ if $ARGS[0] = 'magic':
 			</table>
 		</center>"
 
-		$SpellListStr
+		*pl func('cleanHTML',$SpellListStr)
 
 		killvar 'i'
 		killvar '$ThisSpellName'