Browse Source

minor bug and syntax fixes

KeyMasterOfGozer 5 years ago
parent
commit
b2149eb6e4
5 changed files with 61 additions and 63 deletions
  1. 42 46
      locations/Cheatmenu_din.qsrc
  2. 14 14
      locations/castSpell.qsrc
  3. 3 1
      locations/lab.qsrc
  4. 1 1
      locations/magik.qsrc
  5. 1 1
      locations/spellList.qsrc

+ 42 - 46
locations/Cheatmenu_din.qsrc

@@ -1515,76 +1515,72 @@ $cheatmenu['month'] = {
 	'<a href="exec:temp_month = 12 & $temp_month = ''December'' & dynamic $cheatmenu[''time'']">December</a>'
 }
 
-$cheatmenu['magic'] = {
-	gs'stat'
-	*clr & cla
-	gs 'obj_din', 'cheattabs'
-	'<center><h1>Cheat Menu - Magic</h1></center>'
-	'<center>Is magical: <a href="exec:pcs_magik += 1 & dynamic $cheatmenu[''magic'']">+1<<pcs_magik>></a></center>'
-	if succubusflag = 1:
-		'<center><a href="exec:dynamic $cheatmenu[''succubreset'']"><b>Remove & Reset Succubus status</b></a></center>'
-		*nl
-	end
+$cheatmenu['magicTable'] = {
+	!Build a cheat table for spells with a given Array of spell names.
+	!	ARGS[0] = Friendly name for table
+	!	ARGS[1] = the name of the arraay to use
 
+	$SpellTabName = $ARGS[0]
+	$ThisArrName = $ARGS[1]
+	maxArrSizeC = dyneval("result=arrsize('<<$ThisArrName>>')")
+
+	! make the header for the table
 	$SpellListStr = "<center>
-		<table width='90%' cellspacing='0' cellpadding='0' valign='top'>
+		<table width='90%' cellspacing='0' cellpadding='5' valign='top' border='1'>
+			<tr><th colspan='4'><b><<$SpellTabName>></b></th></tr>
 			<tr>
-				<th>X</th>
+				<th></th>
 				<th>Spell</th>
 				<th>Mana</th>
 				<th>Description</th>
 			</tr>"
 	i = 0
-	:CheatDinSpell
-	$ThisSpellName = $combatSpells[i]
-	if i < arrsize('$combatSpells'):
-		if spellKnown[$ThisSpellName] = 1:
-			$spellFlipper = "<a href=""EXEC: spellKnown['<<$ThisSpellName>>'] = 0"">[Unlearn]</a>"
-		else
-			$spellFlipper = "<a href=""EXEC: spellKnown['<<$ThisSpellName>>'] = 1"">[Learn]</a>"
-		end
-		$SpellListStr = $SpellListStr + " 
-		<tr>
-			<td><<$spellFlipper>></td>
-			<td><<$spellName[$ThisSpellName]>></td>
-			<td><<spellMana[$ThisSpellName]>></td>
-			<td><<$spellDesc[$ThisSpellName]>></td>
-		</tr>"
-		i += 1
-		jump 'CheatDinSpell'
-	end
-	i = 0
-	:CheatDinSpell2
-	$ThisSpellName = $nonComSpells[i]
-	if i < arrsize('$nonComSpells'):
+	:CheatDinSpell1
+	$ThisSpellName = dyneval("$result=<<$ThisArrName>>[<<i>>]")
+	if i < maxArrSizeC:
 		if spellKnown[$ThisSpellName] = 1:
-			$spellFlipper = "<a href=""EXEC: spellKnown['<<$ThisSpellName>>'] = 0"">[Unlearn]</a>"
+			$spellFlipper = "<a href=""EXEC: spellKnown['<<$ThisSpellName>>'] = 0 & dynamic $cheatmenu['magic']"">[Unlearn]</a>"
 		else
-			$spellFlipper = "<a href=""EXEC: spellKnown['<<$ThisSpellName>>'] = 1"">[Learn]</a>"
-		end
-		$SpellListStr = $SpellListStr + " 
-		<tr>
-			<td><<$spellFlipper>></td>
-			<td><<$spellName[$ThisSpellName]>></td>
-			<td><<spellMana[$ThisSpellName]>></td>
-			<td><<$spellDesc[$ThisSpellName]>></td>
-		</tr>"
+			$spellFlipper = "<a href=""EXEC: spellKnown['<<$ThisSpellName>>'] = 1 & dynamic $cheatmenu['magic']"">[Learn]</a>"
+		end
+		$SpellListStr = $SpellListStr + " <tr><td><<$spellFlipper>></td><td><<$spellName[$ThisSpellName]>></td><td><<spellMana[$ThisSpellName]>></td><td><<$spellDesc[$ThisSpellName]>></td></tr>"
 		i += 1
-		jump 'CheatDinSpell2'
+		jump 'CheatDinSpell1'
 	end
 
 	$SpellListStr = $SpellListStr + " 
 		</table>
 	</center>"
 
-	$SpellListStr
+	*p $SpellListStr
 
 	killvar 'i'
 	killvar '$ThisSpellName'
+	killvar '$ThisArrName'
+	killvar 'maxArrSizeC'
+	killvar '$SpellTabName'
 	killvar '$spellFlipper'
 	killvar '$SpellListStr'
 }
 
+$cheatmenu['magic'] = {
+	gs'stat'
+	*clr & cla
+	gs 'obj_din', 'cheattabs'
+	'<center><h1>Cheat Menu - Magic</h1></center>'
+	'<center>Is magical: <a href="exec:pcs_magik += 1 & dynamic $cheatmenu[''magic'']">+1<<pcs_magik>></a></center>'
+	if succubusflag = 1:
+		'<center><a href="exec:dynamic $cheatmenu[''succubreset'']"><b>Remove & Reset Succubus status</b></a></center>'
+		*nl
+	end
+
+	!Make sure spell list is initialized
+	if spellMana['fog'] = 0:gs 'spellList'
+
+	dynamic $cheatmenu['magicTable'], 'Combat Spells', '$combatSpells'
+	dynamic $cheatmenu['magicTable'], 'Non-Combat Spells', '$nonComSpells'
+}
+
 $cheatmenu['dynamic'] = {
 	$dynamicCommand = input("Enter command to execute.")
 	if $dynamicCommand = '':exit

+ 14 - 14
locations/castSpell.qsrc

@@ -13,7 +13,7 @@ gs 'spellList'
 
 spellSuccess = 0
 
-$SpellName = $ARGS[0]
+$SpellID = $ARGS[0]
 $SpellArgs = ""
 i=1
 :ArgLoop
@@ -24,38 +24,38 @@ if i < arrsize('$ARGS'):
 end
 killvar 'i'
 
-if spellKnown[$SpellName] = 1:
+if spellKnown[$SpellID] = 1:
 	!Make a Skill Check to see if the Spell succeeds
-	spellRoll = pcs_splcstng - spellDiff[$SpellName] - (pcs_horny/5) + rand(1,100)
+	spellRoll = pcs_splcstng - spellDiff[$SpellID] - (pcs_horny/5) + rand(1,100)
 	if spellRoll > 50:
 		!Critical Success
 		spellSuccess = 2
-		splcstng_exp += rand(1,spellDiff[$SpellName]) + rand(0,5)
+		splcstng_exp += rand(1,spellDiff[$SpellID]) + rand(0,5)
 	elseif spellRoll > 10:
 		!Success
 		spellSuccess = 1
-		splcstng_exp += rand(1,spellDiff[$SpellName])
+		splcstng_exp += rand(1,spellDiff[$SpellID])
 	elseif spellRoll > -20:
 		!Failure
 		spellSuccess = 0
-		splcstng_exp += rand(1,spellDiff[$SpellName]) / 2
+		splcstng_exp += rand(1,spellDiff[$SpellID]) / 2
 	else
 		!Critical Failure
 		spellSuccess = -1
-		splcstng_exp += rand(1,spellDiff[$SpellName]) / 2
+		splcstng_exp += rand(1,spellDiff[$SpellID]) / 2
 	end
 	killvar 'spellRoll'
 
 	!Incur the costs of casting the spell
 	if spellSuccess = 2:
-		manaCost = spellMana[$SpellName] / 2
+		manaCost = spellMana[$SpellID] / 2
 	elseif spellSuccess = -1:
-		manaCost = spellMana[$SpellName] * 2
+		manaCost = spellMana[$SpellID] * 2
 	else
-		manaCost = spellMana[$SpellName]
+		manaCost = spellMana[$SpellID]
 	end
 	pcs_manna -= manaCost
-	!pcs_willpwr -= spellWill[$SpellName]
+	!pcs_willpwr -= spellWill[$SpellID]
 	arouseVal = manaCost / 50
 	gs 'arousal', 'voyeur', arouseVal
 	minut -= arouseVal
@@ -64,15 +64,15 @@ if spellKnown[$SpellName] = 1:
 
 end
 
-minut += spellTime[$SpellName]
+minut += spellTime[$SpellID]
 
 gs 'stat'
 
-$SpellExec = "gs 'spell', '<<$SpellName>>', '<<spellSuccess>>'<<$SpellArgs>>"
+$SpellExec = "gs 'spell', '<<$SpellID>>', '<<spellSuccess>>'<<$SpellArgs>>"
 
 dynamic $SpellExec
 
-killvar '$SpellName'
+killvar '$SpellID'
 killvar '$SpellArgs'
 killvar '$SpellExec'
 

+ 3 - 1
locations/lab.qsrc

@@ -453,6 +453,8 @@ if $ARGS[0] = 'Tatiana':
 		end
 	end
 
+	!Make sure spell list is initialized
+	if spellMana['fog'] = 0:gs 'spellList'
 
 	$tatianaSpells[0] = 'fog'
 	$tatianaSpells[1] = 'clone'
@@ -470,7 +472,7 @@ if $ARGS[0] = 'Tatiana':
 				cla
 				minut += 60
 				spellKnown['<<$ThisSpellName>>'] = 1
-				'You learned a spell that can <<$spellDesc[$ThisSpellName]>>'
+				'You learned a spell that can... <<$spellDesc[$ThisSpellName]>>'
 
 				act 'Leave':gt 'lab', 'Tatiana'
 			end"

+ 1 - 1
locations/magik.qsrc

@@ -14,7 +14,7 @@ if i < arrsize('$combatSpells'):
 	if spellKnown[$ThisSpellName] = 1:
 		$SpellListStr = $SpellListStr + " 
 		<tr>
-			<td><a href=""EXEC: gs 'castSpell', '<<$ThisSpellName>>' & xgt 'fight','sta' & act 'Physical attacks':gt'boxing' & act 'Magic attacks':gt'magik'""><<$spellName[$ThisSpellName]>></a></td>
+			<td><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><<spellMana[$ThisSpellName]>></td>
 			<td><<$spellDesc[$ThisSpellName]>></td>
 		</tr>"

+ 1 - 1
locations/spellList.qsrc

@@ -24,7 +24,7 @@ spellMana['fog'] = 10
 spellTime['fog'] = 0
 spellDiff['fog'] = 1
 $spellName['fog'] = "Fog"
-$spellDesc['fog'] = "Create a fog on the battlefield, obscuring the review of the enemy."
+$spellDesc['fog'] = "Create a fog on the battlefield, obscuring the view of the enemy."
 !clone
 spellMana['clone'] = 15
 spellTime['clone'] = 0