Browse Source

[Modified] Refactored the clothing shops into a single file

Creamel 4 months ago
parent
commit
05c9469dfc

+ 2 - 0
glife.qproj

@@ -1392,5 +1392,7 @@
 		<Location name="st_petersburg_canals"/>
 	</Folder>
 	<Location name="cleanHTML"/>
+	<Location name="utils"/>
+	<Location name="shop_generic"/>
 	</Structure>
 </QGen-project>

+ 7 - 225
locations/budgetclothes.qsrc

@@ -95,53 +95,14 @@ if $ARGS[0] = 'clothes':
 	$loc = 'budgetclothes'
 	$menu_loc = 'budgetclothes'
 	$menu_arg = 'clothes'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing G&M outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'gm_outfits'
+	gs 'shop_generic', 'list', 'gm', 'outfits', 3
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'budgetclothes', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopgm_outfits_filter
-
-		if Clothingstock - 16 > 0:
-			i = 1
-		elseif Clothingstock - 8 > 0:
-			i = 2
-		else
-			i = 3
-		end
-
-		:loopgm_outfits
-			if gm_outfits[i] = 0:
-				gs 'clothing_attributes', 'gm_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''budgetclothes'', ''gm_outfits''"><img src="images/pc/items/gm/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-
-		if i <= total:jump 'loopgm_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopgm_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopgm_outfits_filter'
-	end
 end
 
 if $ARGS[0] = 'gm_outfits':
@@ -160,54 +121,14 @@ if $ARGS[0] = 'dresses':
 	$loc = 'budgetclothes'
 	$menu_loc = 'budgetclothes'
 	$menu_arg = 'dresses'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing G&M dresses</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'gm_dress'
+	gs 'shop_generic', 'list', 'gm', 'dresses', 4
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'budgetclothes', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopgm_dress_filter
-
-		if Clothingstock > 17:
-			i = 1
-		elseif Clothingstock > 11:
-			i = 2
-		elseif Clothingstock > 5:
-			i = 3
-		else
-			i = 4
-		end
-
-		:loopgm_dress
-			if gm_dress[i] = 0:
-				gs 'clothing_attributes', 'gm_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''budgetclothes'', ''gm_dress''"><img src="images/pc/items/gm/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-		if i <= total:jump 'loopgm_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopgm_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopgm_dress_filter'
-	end
 end
 
 if $ARGS[0] = 'gm_dress':
@@ -227,45 +148,14 @@ if $ARGS[0] = 'office':
 	menu_off = 0
 	$loc_arg = $ARGS[0]
 	$loc = 'budgetclothes'
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing G&M office clothing</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'gm_office'
+	gs 'shop_generic', 'list', 'gm', 'office', 1
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'budgetclothes', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopoffice_filter
-
-		i = 1
-
-		:loopoffice
-			if gm_office[i] = 0:
-				gs 'clothing_attributes', 'gm_office', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''budgetclothes'', ''officeclo''"><img src="images/pc/items/gm/office/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 1
-		if i <= total:jump 'loopoffice'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopoffice_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopoffice_filter'
-	end
 end
 
 if $ARGS[0] = 'officeclo':
@@ -285,49 +175,14 @@ if $ARGS[0] = 'gm_maid':
 	menu_off = 0
 	$loc_arg = $ARGS[0]
 	$loc = 'budgetclothes'
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing G&M maid outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'gm_maid'
+	gs 'shop_generic', 'list', 'gm', 'maid', 2
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'budgetclothes', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopgm_maid_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopgm_maid
-			if gm_maid[i] = 0:
-				gs 'clothing_attributes', 'gm_maid', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''budgetclothes'', ''gm_maidclo''"><img src="images/pc/items/gm/maid/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopgm_maid'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopgm_maid_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopgm_maid_filter'
-	end
 end
 
 if $ARGS[0] = 'gm_maidclo': gt 'clothing', 'view_clothing_item', 'gm_maid',i, 2000, 'shop'
@@ -338,49 +193,14 @@ if $ARGS[0] = 'gm_server':
 	menu_off = 0
 	$loc_arg = $ARGS[0]
 	$loc = 'budgetclothes'
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing G&M server uniforms</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'gm_outfits'
+	gs 'shop_generic', 'list', 'gm', 'server', 2
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'budgetclothes', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopgm_server_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopgm_server
-			if gm_server[i] = 0:
-				gs 'clothing_attributes', 'gm_server', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''budgetclothes'', ''gm_serverclo''"><img src="images/pc/items/gm/server/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopgm_server'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopgm_server_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopgm_server_filter'
-	end
 end
 
 if $ARGS[0] = 'gm_serverclo': gt 'clothing', 'view_clothing_item', 'gm_server', i, 2000, 'shop'
@@ -391,52 +211,14 @@ if $ARGS[0] = 'school':
 	menu_off = 0
 	$loc_arg = $ARGS[0]
 	$loc = 'budgetclothes'
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing G&M school uniforms</font></b></center>'
-	*nl
-
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'gm_school'
 
+	gs 'shop_generic', 'list', 'gm', 'school', 3
+	
 	act 'Return':
 		cla
 		minut += 1
 		gt 'budgetclothes', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopgm_school_filter
-
-		if Clothingstock > 15:
-			i = 1
-		elseif Clothingstock > 7:
-			i = 2
-		else
-			i = 3
-		end
-
-		:loopschool
-			if gm_school[i] = 0:
-				gs 'clothing_attributes', 'gm_school', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''budgetclothes'', ''schoolclo''"><img src="images/pc/items/gm/school/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-			if i = 6:i = 9
-		if i <= total:jump 'loopschool'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopgm_school_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopgm_school_filter'
-	end
 end
 
 if $ARGS[0] = 'schoolclo':

+ 2 - 1
locations/cikl.qsrc

@@ -180,7 +180,8 @@ end
 streetevent_hour = -2
 
 !!Clothing stock and price randomizers
-Clothingstock = rand (0,23)
+maximum_clothingstock_randomized_value = 23
+Clothingstock = rand (0, maximum_clothingstock_randomized_value)
 i = 1
 :loopprice
 Clothingstock[i] = rand (0,500)

+ 2 - 33
locations/city_market.qsrc

@@ -163,48 +163,17 @@ end
 if $ARGS[0] = 'clo':
 	$loc_arg = 'clo'
 	$loc = 'city_market'
-	cls
-	gs'stat'
-	gs 'themes', 'indoors'
-	'<center><b><font color="maroon">Clothes.</font></b></center>'
-	'You inspect the cheap clothing the stall has to offer.'
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'market_outfits'
+	gs 'shop_generic', 'list', 'market', 'clothes', 1
 
 	act 'Return':
 		cla
 		minut += 5
 		gt 'city_market', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopmarket_outfits_filter
-
-	i = 1
-	:loopmarket_outfits
-		if market_outfits[i] = 0:
-			gs 'clothing_attributes', 'market_outfits', i
-			gs 'clothing_QV', 'shop_filter'
-
-			!!sort by filter
-			if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-				if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1:*p '<a href="exec: i = <<i>> & gt ''city_market'', ''marketclo''"><img <<$set_imgh>> src="images/pc/items/market/clothes/<<i>>.jpg" 	height="250" /></a>'
-			end
-		end
-	i += 1
-	if i <= total:jump 'loopmarket_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopmarket_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopmarket_outfits_filter'
-	end
 end
 
-if $ARGS[0] = 'marketclo':
+if $ARGS[0] = 'market_outfits':
 	cla
 
 	if market_outfits[i] ! 0:

+ 2 - 68
locations/exhibitionistshop.qsrc

@@ -161,45 +161,14 @@ end
 if $ARGS[0] = 'outfits':
 	$loc_arg = 'outfits'
 	$loc = 'exhibitionistshop'
-	cls
-	gs'stat'
-	'<center><b><font color="maroon">Salacious outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'salacious_outfits'
+	gs 'shop_generic', 'list', 'salacious', 'outfits', 1
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'exhibitionistshop', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopsalacious_outfits_filter
-
-		i = 1
-
-		:loopsalacious_outfits
-			if salacious_outfits[i] = 0:
-				gs 'clothing_attributes', 'salacious_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''exhibitionistshop'', ''salacious_outfits''"><img <<$set_imgh>> src="images/pc/items/salacious/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 1
-		if i <= 20:jump 'loopsalacious_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopsalacious_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopsalacious_outfits_filter'
-	end
 end
 
 if $ARGS[0] = 'salacious_outfits': gt 'clothing', 'view_clothing_item', 'salacious_outfits',i, 1000, 'shop'
@@ -207,49 +176,14 @@ if $ARGS[0] = 'salacious_outfits': gt 'clothing', 'view_clothing_item', 'salacio
 if $ARGS[0] = 'dresses':
 	$loc_arg = 'dresses'
 	$loc = 'exhibitionistshop'
-	cls
-	gs'stat'
-	'<center><b><font color="maroon">Salacious dresses</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'salacious_dress'
+	gs 'shop_generic', 'list', 'salacious', 'dress', 2
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'exhibitionistshop', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopsalacious_dress_filter
-
-		if Clothingstock >= 12:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopsalacious_dress
-			if salacious_dress[i] = 0:
-				gs 'clothing_attributes', 'salacious_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''exhibitionistshop'', ''salacious_dress''"><img <<$set_imgh>> src="images/pc/items/salacious/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= 60:jump 'loopsalacious_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopsalacious_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopsalacious_dress_filter'
-	end
 end
 
 if $ARGS[0] = 'salacious_dress': gt 'clothing', 'view_clothing_item', 'salacious_dress',i, 1000, 'shop'

+ 2 - 33
locations/pav_train_market.qsrc

@@ -231,48 +231,17 @@ end
 if $ARGS[0] = 'clo':
 	$loc_arg = 'clo'
 	$loc = 'pav_train_market'
-	cls
-	gs'stat'
-	gs 'themes', 'indoors'
-	'<center><b><font color="maroon">Clothes.</font></b></center>'
-	'Cheap clothing on the market stall.'
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'market_outfits'
+	gs 'shop_generic', 'list', 'market', 'clothes', 1
 
 	act 'Return':
 		cla
 		minut += 5
 		gt 'pav_train_market', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopmarket_outfits_filter
-
-	i = 1
-	:loopmarket_outfits
-		if market_outfits[i] = 0:
-			gs 'clothing_attributes', 'market_outfits', i
-			gs 'clothing_QV', 'shop_filter'
-
-			!!sort by filter
-			if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-				if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1:*p '<a href="exec: i = <<i>> & gt ''pav_train_market'', ''marketclo''"><img <<$set_imgh>> src="images/pc/items/market/clothes/<<i>>.jpg" 	height="250" /></a>'
-			end
-		end
-	i += 1
-	if i <= total:jump 'loopmarket_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopmarket_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopmarket_outfits_filter'
-	end
 end
 
-if $ARGS[0] = 'marketclo':
+if $ARGS[0] = 'market_outfits':
 	cla
 
 	if market_outfits[i] ! 0:

+ 3 - 107
locations/sexshop.qsrc

@@ -124,46 +124,10 @@ if $ARGS[0] = 'dress':
 	$loc = 'sexshop'
 	$menu_loc = 'sexshop'
 	$menu_arg = 'dress'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Fetish dresses - for all your personal needs</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'eroto_dress'
+	gs 'shop_generic', 'list', 'eroto', 'dress', 2
 
 	act 'Return': minut += 1 & gt 'sexshop', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:looperoto_dress_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:looperoto_dress
-			if eroto_dress[i] = 0:
-				gs 'clothing_attributes', 'eroto_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''sexshop'', ''eroto_dress''"><img src="images/pc/items/eroto/dress/<<i>>.jpg"	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'looperoto_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'looperoto_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'looperoto_dress_filter'
-	end
 end
 
 if $ARGS[0] = 'eroto_dress': gt 'clothing', 'view_clothing_item', 'eroto_dress',i, 1000, 'shop'
@@ -173,46 +137,10 @@ if $ARGS[0] = 'outfits':
 	$loc = 'sexshop'
 	$menu_loc = 'sexshop'
 	$menu_arg = 'outfits'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Fetish outfits - for all your personal needs</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'eroto_outfits'
+	gs 'shop_generic', 'list', 'eroto', 'outfits', 2
 
 	act 'Return': minut += 1 & gt 'sexshop', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:looperoto_outfits_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:looperoto_outfits
-			if eroto_outfits[i] = 0:
-				gs 'clothing_attributes', 'eroto_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''sexshop'', ''eroto_outfits''"><img src="images/pc/items/eroto/outfits/<<i>>.jpg"	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'looperoto_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'looperoto_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'looperoto_outfits_filter'
-	end
 end
 
 if $ARGS[0] = 'eroto_outfits': gt 'clothing', 'view_clothing_item', 'eroto_outfits',i, 1000, 'shop'
@@ -222,42 +150,10 @@ if $ARGS[0] = 'strip':
 	$loc = 'sexshop'
 	$menu_loc = 'sexshop'
 	$menu_arg = 'strip'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">eroto_strip clothing - for all your personal needs</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'eroto_strip'
+	gs 'shop_generic', 'list', 'eroto', 'strip', 1
 
 	act 'Return': minut += 1 & gt 'sexshop', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:looperoto_strip_filter
-
-		i = 1
-
-		:looperoto_strip
-			if eroto_strip[i] = 0:
-				gs 'clothing_attributes', 'eroto_strip', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''sexshop'', ''eroto_strip''"><img src="images/pc/items/eroto/strip/<<i>>.jpg"	height="250" /></a>'
-				end
-			end
-			i += 1
-		if i <= total:jump 'looperoto_strip'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'looperoto_strip_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'looperoto_strip_filter'
-	end
 end
 
 if $ARGS[0] = 'eroto_strip': gt 'clothing', 'view_clothing_item', 'eroto_strip',i, 1000, 'shop'

+ 3 - 79
locations/shop_coco_carmen.qsrc

@@ -32,50 +32,10 @@ if $ARGS[0] = 'dress':
 	$loc = 'shop_coco_carmen'
 	$menu_loc = 'shop_coco_carmen'
 	$menu_arg = 'dress'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Coco Carmen dresses</font></b></center>'
-	*nl
-
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'coco_dress'
+	
+	gs 'shop_generic', 'list', 'coco', 'dress', 4
 
 	act 'Return': minut += 1 & gt 'shop_coco_carmen', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopcoco_dress_filter
-
-		if Clothingstock > 17:
-			i = 1
-		elseif Clothingstock > 11:
-			i = 2
-		elseif Clothingstock > 5:
-			i = 3
-		else
-			i = 4
-		end
-
-		:loopcoco_dress
-			if coco_dress[i] = 0:
-				gs 'clothing_attributes', 'coco_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_coco_carmen'', ''coco_dress''"><img src="images/pc/items/coco/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopcoco_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopcoco_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopcoco_dress_filter'
-	end
 end
 
 if $ARGS[0] = 'coco_dress':
@@ -94,46 +54,10 @@ if $ARGS[0] = 'outfits':
 	$loc = 'shop_coco_carmen'
 	$menu_loc = 'shop_coco_carmen'
 	$menu_arg = 'outfits'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Coco Carmen outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'coco_outfits'
+	gs 'shop_generic', 'list', 'coco', 'outfits', 2
 
 	act 'Return': minut += 1 & gt 'shop_coco_carmen', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopcoco_outfits_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopcoco_outfits
-			if coco_outfits[i] = 0:
-				gs 'clothing_attributes', 'coco_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_coco_carmen'', ''coco_outfits''"><img src="images/pc/items/coco/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopcoco_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopcoco_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopcoco_outfits_filter'
-	end
 end
 
 if $ARGS[0] = 'coco_outfits':

+ 2 - 76
locations/shop_dolls.qsrc

@@ -70,52 +70,14 @@ if $ARGS[0] = 'dress':
 	$loc = 'shop_dolls'
 	$menu_arg = 'dress'
 	$menu_loc = 'shop_dolls'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Patchwork Dolls dresses</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'dolls_dress'
+	gs 'shop_generic', 'list', 'dolls', 'dress', 3
 
 	act 'Return':
 		cla
 		minut += 5
 		gt 'shop_dolls', 'browse'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopdolls_dress_filter
-
-		if Clothingstock > 15:
-			i = 1
-		elseif Clothingstock > 7:
-			i = 3
-		else
-			i = 2
-		end
-
-		:loopdolls_dress
-			if dolls_dress[i] = 0:
-				gs 'clothing_attributes', 'dolls_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_dolls'', ''dolls_dress''"><img src="images/pc/items/dolls/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-		if i <= total:jump 'loopdolls_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopdolls_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopdolls_dress_filter'
-	end
 end
 
 if $ARGS[0] = 'dolls_dress':
@@ -138,50 +100,14 @@ if $ARGS[0] = 'clothing':
 	$loc = 'shop_dolls'
 	$menu_arg = 'clothing'
 	$menu_loc = 'shop_dolls'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Patchwork Dolls clothing</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'dolls_outfits'
+	gs 'shop_generic', 'list', 'dolls', 'outfits', 2
 
 	act 'Return':
 		cla
 		minut += 5
 		gt 'shop_dolls', 'browse'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopdolls_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopdolls
-			if dolls_outfits[i] = 0:
-				gs 'clothing_attributes', 'dolls_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_dolls'', ''dolls_outfits''"><img src="images/pc/items/dolls/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopdolls'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopdolls_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopdolls_filter'
-	end
 end
 
 if $ARGS[0] = 'dolls_outfits':

+ 1 - 37
locations/shop_fancy_pancy.qsrc

@@ -31,46 +31,10 @@ if $ARGS[0] = 'clothes':
 	$loc = 'shop_fancy_pancy'
 	$menu_loc = 'shop_fancy_pancy'
 	$menu_arg = 'clothes'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Fancy Pancy outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'fancy_burlesque'
+	gs 'shop_generic', 'list', 'fancy', 'burlesque', 2
 
 	act 'Return': minut += 1 & gt 'shop_fancy_pancy', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopfancy_burlesque_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopfancy_burlesque
-			if fancy_burlesque[i] = 0:
-				gs 'clothing_attributes', 'fancy_burlesque', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_fancy_pancy'', ''fancy_burlesque''"><img src="images/pc/items/fancy/burlesque/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopfancy_burlesque'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopfancy_burlesque_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopfancy_burlesque_filter'
-	end
 end
 
 if $ARGS[0] = 'fancy_burlesque':

+ 4 - 76
locations/shop_fashionista.qsrc

@@ -128,56 +128,16 @@ if $ARGS[0] = 'dressingclothes':
 	*clr & cla
 	$loc_arg = 'dressingclothes'
 	$loc = 'shop_fashionista'
-	menu_off = 1
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing shop_fashionista clothing</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'fashionista_dress'
+	gs 'shop_generic', 'list', 'fashionista', 'dress', 4
 
 	act 'Return':
 		minut += 1
 		gt 'shop_fashionista', 'changingroom'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopfashionista_filter
-
-		if Clothingstock >= 18:
-			i = 1
-		elseif Clothingstock >= 12:
-			i = 2
-		elseif Clothingstock >= 6:
-			i = 3
-		else
-			i = 4
-		end
-
-		:loopfashionista_dress
-			if fashionista_dress[i] = 0:
-				gs 'clothing_attributes', 'fashionista_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_fashionista'', ''dressingclothes2''"><img src="images/pc/items/fashionista/dress/<<i>>.jpg" 	height="250" /></a>  '
-				end
-			end
-			i += 4
-		if i <= total:jump 'loopfashionista_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopfashionista_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopfashionista_filter'
-	end
 end
 
-if $ARGS[0] = 'dressingclothes2':
+if $ARGS[0] = 'fashionista_dress':
 	cla
 	
 	if fashionista_dress[i] ! 0:
@@ -192,48 +152,16 @@ if $ARGS[0] = 'dressingoutfit':
 	*clr & cla
 	$loc_arg = 'dressingoutfit'
 	$loc = 'shop_fashionista'
-	menu_off = 1
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing shop_fashionista clothing</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'fashionista_outfits'
+	gs 'shop_generic', 'list', 'fashionista', 'outfits', 1
 
 	act 'Return':
 		minut += 1
 		gt 'shop_fashionista', 'changingroom'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopfashionista_outfits_filter
-
-	i = 1
-
-	:loopfashionista_outfits
-		if fashionista_outfits[i] = 0:
-			gs 'clothing_attributes', 'fashionista_outfits', i
-			gs 'clothing_QV', 'shop_filter'
-
-			!!sort by filter
-			if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-				if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_fashionista'', ''dressingoutfit2''"><img src="images/pc/items/fashionista/outfits/<<i>>.jpg" 	height="250" /></a>  '
-			end
-		end
-		i += 1
-	if i <= total:jump 'loopfashionista_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopfashionista_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopfashionista_outfits_filter'
-	end
 end
 
-if $ARGS[0] = 'dressingoutfit2':
+if $ARGS[0] = 'fashionista_outfits':
 	cla
 	
 	if fashionista_outfits[i] ! 0:

+ 2 - 76
locations/shop_flamingos.qsrc

@@ -31,48 +31,10 @@ if $ARGS[0] = 'dresses':
 	$loc = 'shop_flamingos'
 	$menu_loc = 'shop_flamingos'
 	$menu_arg = 'dresses'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Flamingo''s dresses</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'flamingos_dress'
+	gs 'shop_generic', 'list', 'flamingos', 'dress', 3
 
 	act 'Return': minut += 1 & gt 'shop_flamingos', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopflamingos_dress_filter
-
-		if Clothingstock > 15:
-			i = 1
-		elseif Clothingstock > 7:
-			i = 2
-		else
-			i = 3
-		end
-
-		:loopflamingos_dress
-			if flamingos_dress[i] = 0:
-				gs 'clothing_attributes', 'flamingos_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_flamingos'', ''flamingos_dress''"><img src="images/pc/items/flamingos/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-		if i <= total:jump 'loopflamingos_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopflamingos_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopflamingos_dress_filter'
-	end
 end
 
 if $ARGS[0] = 'flamingos_dress':
@@ -91,46 +53,10 @@ if $ARGS[0] = 'clothes':
 	$loc = 'shop_flamingos'
 	$menu_loc = 'shop_flamingos'
 	$menu_arg = 'clothes'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Flamingo''s outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'flamingos_outfits'
+	gs 'shop_generic', 'list', 'flamingos', 'outfits', 2
 
 	act 'Return': minut += 1 & gt 'shop_flamingos', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopflamingos_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopflamingos
-			if flamingos_outfits[i] = 0:
-				gs 'clothing_attributes', 'flamingos_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_flamingos'', ''flamingos_outfits''"><img src="images/pc/items/flamingos/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopflamingos'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopflamingos_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopflamingos_filter'
-	end
 end
 
 if $ARGS[0] = 'flamingos_outfits':

+ 162 - 0
locations/shop_generic.qsrc

@@ -0,0 +1,162 @@
+# shop_generic
+!! 2024/02/04
+!! This allows a refactoring of all clothing shops into a generic one, to avoid code duplication everywhere
+!! Creamel
+!!
+!! gs 'shop_generic', 'list', shop, type, amount_of_sets
+!! shop : the short name for the shop : coco, dolls, fancy, fashionista, flamingos
+!! type : the type of the items to display : dress, outfits, burlesque
+!! amount_of_sets : the amount of different set the shop can have for that type of clothes
+if $ARGS[0] = 'list':
+	$shopname = $ARGS[1]
+	$itemtype = $ARGS[2]
+	amount_of_sets = ARGS[3]
+
+	gs 'shop_generic', 'set_shop_related_strings'
+
+	menu_off = 0
+	*clr & cla
+	gs'stat'
+	'<center><b><font color="maroon">Viewing <<$shopdisplayname>> <<$itemtypedisplayname>></font></b></center>'
+	*nl
+
+	gs 'clothing_QV', 'shop_filter_header'
+	gs 'clothing', 'totals', '<<$shopname>>_<<$itemtype>>'
+
+	!{
+		cikl randomly sets a value to Clothingstock between 0 and maximum_clothingstock_randomized_value.
+		This variable defines which clothes will be available for the current day
+		set_number uses Clothingstock to calculate which is the set number of the day and the resulting value is between 1 and amount_of_sets
+	}
+	set_number = ((Clothingstock * amount_of_sets) / maximum_clothingstock_randomized_value) + 1
+	amount_of_clothes_per_sets = total / amount_of_sets
+
+	killvar 'current_set'
+	
+	!{
+		Build current set to be displayed, excluding items already bought or filtered out
+		The values of the array are the identifiers of each clothes and match the picture name (1.jpg, 2.jpg, ...)
+		as well as the values passed as ARGS[1] in each _attribute_ files
+		The range goes from 1 to total
+	}
+	i = 0
+	:build_current_set
+		cloth_number = i * amount_of_sets + set_number
+		if dyneval('RESULT = <<$shopname>>_<<$itemtype>>[ARGS[0]]', cloth_number) = 0:
+			gs 'clothing_attributes', '<<$shopname>>_<<$itemtype>>', cloth_number
+			gs 'clothing_QV', 'shop_filter'
+
+			if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: current_set[] = cloth_number
+		end
+		i += 1
+	if i <= amount_of_clothes_per_sets and i * amount_of_sets + set_number <= total: jump 'build_current_set'
+
+	!{
+		This functions takes 2 parameters : cloth_a and cloth_b
+		It compares 2 clothes depending of which sorting type is used (sort by quality/inhibition/number)
+		and returns :
+			- a negative value if cloth_a should be before cloth_b
+			- a positive value if cloth_a should be after cloth_b
+			- Zero if cloth_a is equal to cloth_b
+	}
+	$clothes_comparer = {
+		cloth_a = ARGS[0]
+		cloth_b = ARGS[1]
+
+		gs 'clothing_attributes', '<<$shopname>>_<<$itemtype>>', cloth_a
+		cloth_a_quality = CloQuality
+		cloth_a_inhibit = CloInhibit
+
+		gs 'clothing_attributes', '<<$shopname>>_<<$itemtype>>', cloth_b
+		cloth_b_quality = CloQuality
+		cloth_b_inhibit = CloInhibit
+
+		if clothingfilter['quality'] = 0:
+			cloth_a_comparison = cloth_a_quality
+			cloth_b_comparison = cloth_b_quality
+		elseif clothingfilter['inhibition'] = 0:
+			cloth_a_comparison = cloth_a_inhibit
+			cloth_b_comparison = cloth_b_inhibit
+		else
+			cloth_a_comparison = cloth_a
+			cloth_b_comparison = cloth_b
+		end
+
+		if cloth_a_comparison < cloth_b_comparison:
+			RESULT = -1
+		elseif cloth_a_comparison > cloth_b_comparison:
+			RESULT = 1
+		else
+			RESULT = 0
+		end
+	}
+
+	!! sort the set
+	gs 'utils', 'i_arrays', 'sort', 'current_set', $clothes_comparer
+	!! Get back the sorted array
+	copyarr('current_set', 'sorted_array')
+
+	!! Display the clothes
+	i = 0
+	:loop_clothes
+		*p '<a href="exec: i = <<current_set[i]>> & gt ''<<$loc>>'', ''<<$shopname>>_<<$itemtype>>''"><img src="images/pc/items/<<$shopname>>/<<$itemtype>>/<<current_set[i]>>.jpg" 	height="250" /></a>'
+		i += 1
+	if i < arrsize('current_set'): jump 'loop_clothes'
+elseif $ARGS[0] = 'set_shop_related_strings':
+	if $shopname = 'coco':
+		$shopdisplayname = 'Coco Carmen'
+	elseif $shopname = 'dolls':
+		$shopdisplayname = 'Patchwork Dolls'
+	elseif $shopname = 'fancy':
+		$shopdisplayname = 'Fancy Pancy'
+	elseif $shopname = 'fashionista':
+		$shopdisplayname = 'Fashionista'
+	elseif $shopname = 'flamingos':
+		$shopdisplayname = 'Flamingo'
+	elseif $shopname = 'nerdvana':
+		$shopdisplayname = 'Nerdvana'
+	elseif $shopname = 'cats':
+		$shopdisplayname = 'Pussy Kats'
+	elseif $shopname = 'scandalicious':
+		$shopdisplayname = 'Scandalicious'
+	elseif $shopname = 'bomba':
+		$shopdisplayname = 'Tsar Bomba'
+	elseif $shopname = 'gm':
+		$shopdisplayname = 'G&M'
+	elseif $shopname = 'danilovich':
+		$shopdisplayname = 'Danilovich Sportswear'
+	elseif $shopname = 'salacious':
+		$shopdisplayname = 'Simply Salacious'
+	elseif $shopname = 'market':
+		$shopdisplayname = 'Market cheap'
+	elseif $shopname = 'eroto':
+		$shopdisplayname = 'Erotomaniac - for all your personal needs - Fetish'
+	end
+
+	if $itemtype = 'dress':
+		$itemtypedisplayname = 'dresses'
+	elseif $itemtype = 'outfits':
+		$itemtypedisplayname = 'outfits'
+	elseif $itemtype = 'burlesque':
+		$itemtypedisplayname = 'outfits'
+	elseif $itemtype = 'cosplay':
+		$itemtypedisplayname = 'cosplay outfits'
+	elseif $itemtype = 'office':
+		$itemtypedisplayname = 'office clothing'
+	elseif $itemtype = 'maid':
+		$itemtypedisplayname = 'maid outfits'
+	elseif $itemtype = 'server':
+		$itemtypedisplayname = 'server uniforms'
+	elseif $itemtype = 'school':
+		$itemtypedisplayname = 'school uniforms'
+	elseif $itemtype = 'clothes':
+		$itemtypedisplayname = 'outfits'
+	elseif $itemtype = 'strip':
+		$itemtypedisplayname = 'stripper outfits'
+	end
+end
+
+
+
+--- shop_generic ---------------------------------
+

+ 3 - 75
locations/shop_nerdvana.qsrc

@@ -35,46 +35,10 @@ if $ARGS[0] = 'cosplay':
 	$loc = 'shop_nerdvana'
 	$menu_loc = 'shop_nerdvana'
 	$menu_arg = 'cosplay'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Nerdvana Cosplay Outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'nerdvana_cosplay'
+	gs 'shop_generic', 'list', 'nerdvana', 'cosplay', 2
 
 	act 'Return': minut += 1 & gt 'shop_nerdvana', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopnerdvana_cosplay_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopnerdvana_cosplay
-			if nerdvana_cosplay[i] = 0:
-				gs 'clothing_attributes', 'nerdvana_cosplay', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_nerdvana'', ''nerdvana_cosplay''"><img src="images/pc/items/nerdvana/cosplay/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopnerdvana_cosplay'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopnerdvana_cosplay_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopnerdvana_cosplay_filter'
-	end
 end
 
 if $ARGS[0] = 'nerdvana_cosplay':
@@ -93,46 +57,10 @@ if $ARGS[0] = 'outfits':
 	$loc = 'shop_nerdvana'
 	$menu_loc = 'shop_nerdvana'
 	$menu_arg = 'outfits'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Nerdvana outfits</font></b></center>'
-	*nl
-
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'nerdvana_outfits'
 
+	gs 'shop_generic', 'list', 'nerdvana', 'outfits', 2
+	
 	act 'Return': minut += 1 & gt 'shop_nerdvana', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopnerdvana_outfits_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopnerdvana_outfits
-			if nerdvana_outfits[i] = 0:
-				gs 'clothing_attributes', 'nerdvana_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_nerdvana'', ''nerdvana_outfits''"><img src="images/pc/items/nerdvana/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopnerdvana_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopnerdvana_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopnerdvana_outfits_filter'
-	end
 end
 
 if $ARGS[0] = 'nerdvana_outfits':

+ 8 - 86
locations/shop_pussycats.qsrc

@@ -1031,51 +1031,12 @@ end
 if $ARGS[0] = 'dress':
 	$loc_arg = 'dress'
 	$loc = 'shop_pussycats'
-	cls
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Pussy Kats dresses</font></b></center>'
-	*nl
-
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'cats_dress'
-
-	act 'Return':
-		cla
-		minut += 1
-		gt 'shop_pussycats', 'start'
-	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopcats_dress_filter
-
-		if Clothingstock > 15:
-			i = 1
-		elseif Clothingstock > 7:
-			i = 3
-		else
-			i = 2
-		end
-
-		:loopcats_dress
-			if cats_dress[i] = 0:
-				gs 'clothing_attributes', 'cats_dress', i
-				gs 'clothing_QV', 'shop_filter'
+	$menu_loc = 'shop_pussycats'
+	$menu_arg = 'dress'
 
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_pussycats'', ''yshopclo_dress''"><img <<$set_imgh>> src="images/pc/items/cats/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-		if i <= total:jump 'loopcats_dress'
+	gs 'shop_generic', 'list', 'cats', 'dress', 3
 
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopcats_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopcats_dress_filter'
-	end
+	act 'Return': minut += 1 & gt 'shop_pussycats', 'start'
 end
 
 if $ARGS[0] = 'yshopclo_dress': gt 'clothing', 'view_clothing_item', 'cats_dress',i, 3000, 'shop'
@@ -1083,51 +1044,12 @@ if $ARGS[0] = 'yshopclo_dress': gt 'clothing', 'view_clothing_item', 'cats_dress
 if $ARGS[0] = 'clothes':
 	$loc_arg = 'clothes'
 	$loc = 'shop_pussycats'
-	cls
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Pussy Kats outfits</font></b></center>'
-	*nl
-
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'cats_outfits'
-
-	act 'Return':
-		cla
-		minut += 1
-		gt 'shop_pussycats', 'start'
-	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopcats_outfits_filter
-
-		if Clothingstock > 15:
-			i = 1
-		elseif Clothingstock > 7:
-			i = 3
-		else
-			i = 2
-		end
-
-		:loopcats_outfits
-			if cats_outfits[i] = 0:
-				gs 'clothing_attributes', 'cats_outfits', i
-				gs 'clothing_QV', 'shop_filter'
+	$menu_loc = 'shop_pussycats'
+	$menu_arg = 'clothes'
 
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_pussycats'', ''yshopclo_outfit''"><img <<$set_imgh>> src="images/pc/items/cats/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-		if i <= total:jump 'loopcats_outfits'
+	gs 'shop_generic', 'list', 'cats', 'outfits', 3
 
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopcats_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopcats_outfits_filter'
-	end
+	act 'Return': minut += 1 & gt 'shop_pussycats', 'start'
 end
 
 if $ARGS[0] = 'yshopclo_outfit': gt 'clothing', 'view_clothing_item', 'cats_outfits',i, 3000, 'shop'

+ 4 - 83
locations/shop_scandalicious.qsrc

@@ -60,47 +60,10 @@ if $ARGS[0] = 'clothes':
 	$loc = 'shop_scandalicious'
 	$menu_loc = 'shop_scandalicious'
 	$menu_arg = 'clothes'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Scandalicious outfits</font></b></center>'
-	*nl
-
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'scandalicious_outfits'
-
-	act 'Return':
-		cla
-		minut += 1
-		gt 'shop_scandalicious', 'start'
-	end
 
-	!!To filter just this set
-	clo_i = 0
-	:loopscandalicious_outfits_filter
-
-	i = 1
+	gs 'shop_generic', 'list', 'scandalicious', 'outfits', 1
 
-		:loopscandalicious_outfits
-			if scandalicious_outfits[i] = 0:
-				gs 'clothing_attributes', 'scandalicious_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_scandalicious'', ''scandalicious_outfits''"><img src="images/pc/items/scandalicious/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 1
-
-		if i <= total:jump 'loopscandalicious_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopscandalicious_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopscandalicious_outfits_filter'
-	end
+	act 'Return': minut += 1 & gt 'shop_scandalicious', 'start'
 end
 
 if $ARGS[0] = 'scandalicious_outfits':
@@ -119,52 +82,10 @@ if $ARGS[0] = 'dresses':
 	$loc = 'shop_scandalicious'
 	$menu_loc = 'shop_scandalicious'
 	$menu_arg = 'dresses'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Scandalicious dresses</font></b></center>'
-	*nl
-
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'scandalicious_dress'
-
-	act 'Return':
-		cla
-		minut += 1
-		gt 'shop_scandalicious', 'start'
-	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopscandalicious_dress_filter
-	
-		if Clothingstock >= 16:
-			i = 3
-		elseif Clothingstock >= 8:
-			i = 2
-		else
-			i = 1
-		end
 
-		:loopscandalicious_dress
-			if scandalicious_dress[i] = 0:
-				gs 'clothing_attributes', 'scandalicious_dress', i
-				gs 'clothing_QV', 'shop_filter'
+	gs 'shop_generic', 'list', 'scandalicious', 'dress', 3
 
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_scandalicious'', ''scandalicious_dress''"><img src="images/pc/items/scandalicious/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-		if i <= total:jump 'loopscandalicious_dress'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopscandalicious_dress_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopscandalicious_dress_filter'
-	end
+	act 'Return': minut += 1 & gt 'shop_scandalicious', 'start'
 end
 
 if $ARGS[0] = 'scandalicious_dress':

+ 2 - 74
locations/shop_tsar_bomba.qsrc

@@ -36,46 +36,10 @@ if $ARGS[0] = 'dresses':
 	$loc = 'shop_tsar_bomba'
 	$menu_loc = 'shop_tsar_bomba'
 	$menu_arg = 'dresses'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Tsar Bomba dresses</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'bomba_dresses'
+	gs 'shop_generic', 'list', 'bomba', 'dress', 2
 
 	act 'Return': minut += 1 & gt 'shop_tsar_bomba', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopbomba_dresses_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopbomba_dresses
-			if bomba_dress[i] = 0:
-				gs 'clothing_attributes', 'bomba_dress', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_tsar_bomba'', ''bomba_dresses''"><img src="images/pc/items/bomba/dress/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopbomba_dresses'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopbomba_dresses_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopbomba_dresses_filter'
-	end
 end
 
 if $ARGS[0] = 'bomba_dresses':
@@ -94,46 +58,10 @@ if $ARGS[0] = 'clothes':
 	$loc = 'shop_tsar_bomba'
 	$menu_loc = 'shop_tsar_bomba'
 	$menu_arg = 'clothes'
-	menu_off = 0
-	*clr & cla
-	gs'stat'
-	'<center><b><font color="maroon">Viewing Tsar Bomba outfits</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'bomba_outfits'
+	gs 'shop_generic', 'list', 'bomba', 'outfits', 2
 
 	act 'Return': minut += 1 & gt 'shop_tsar_bomba', 'start'
-
-	!!To filter just this set
-	clo_i = 0
-	:loopbomba_filter
-
-		if Clothingstock > 11:
-			i = 1
-		else
-			i = 2
-		end
-
-		:loopbomba
-			if bomba_outfits[i] = 0:
-				gs 'clothing_attributes', 'bomba_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''shop_tsar_bomba'', ''bomba_outfits''"><img src="images/pc/items/bomba/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 2
-		if i <= total:jump 'loopbomba'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopbomba_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopbomba_filter'
-	end
 end
 
 if $ARGS[0] = 'bomba_outfits':

+ 1 - 38
locations/sportShop.qsrc

@@ -46,51 +46,14 @@ end
 if $ARGS[0] = 'clo':
 	$loc_arg = 'clo'
 	$loc = 'sportShop'
-	cls
-	gs'stat'
-	'<center><b><font color="maroon">Sportswear - one size fits all</font></b></center>'
-	*nl
 
-	gs 'clothing_QV', 'shop_filter_header'
-	gs 'clothing', 'totals', 'danilovich_outfits'
+	gs 'shop_generic', 'list', 'danilovich', 'outfits', 3
 
 	act 'Return':
 		cla
 		minut += 1
 		gt 'sportshop', 'start'
 	end
-
-	!!To filter just this set
-	clo_i = 0
-	:loopdanilovich_outfits_filter
-
-		if Clothingstock > 16:
-			i = 1
-		elseif Clothingstock > 8:
-			i = 2
-		else
-			i = 3
-		end
-
-		:loopdanilovich_outfits
-			if danilovich_outfits[i] = 0:
-				gs 'clothing_attributes', 'danilovich_outfits', i
-				gs 'clothing_QV', 'shop_filter'
-
-				!!sort by filter
-				if (clothingfilter['quality'] = 0 and CloQuality = clo_i) or (clothingfilter['inhibition'] = 0 and CloInhibit = clo_i) or clothingfilter['number'] = 0:
-					if clothingfilter['inc'] = 1 and clothingfilter['only'] = 1: *p '<a href="exec: i = <<i>> & gt ''sportshop'', ''danilovich''"><img src="images/pc/items/danilovich/outfits/<<i>>.jpg" 	height="250" /></a>'
-				end
-			end
-			i += 3
-		if i <= 160:jump 'loopdanilovich_outfits'
-
-	clo_i += 1
-	if clothingfilter['quality'] = 0 and clo_i <= 7:
-		jump 'loopdanilovich_outfits_filter'
-	elseif clothingfilter['inhibition'] = 0 and clo_i <= 50:
-		jump 'loopdanilovich_outfits_filter'
-	end
 end
 
 if $ARGS[0] = 'danilovich': gt 'clothing', 'view_clothing_item', 'danilovich_outfits',i, 2000, 'shop'

+ 132 - 0
locations/utils.qsrc

@@ -0,0 +1,132 @@
+# utils
+!! 2024/02/04
+!! This file contains various helper functions, not related with scenes but rather with code
+!! Creamel
+
+!! Functions about integers arrays manipulation
+if $ARGS[0] = 'i_arrays':
+    !! Sorts the array passed as parameter using a provided comparer and the quicksort algorithm
+    !! More infos here https://en.wikipedia.org/wiki/Quicksort
+    if $ARGS[1] = 'sort':
+        $array_name = $ARGS[2]
+        copyarr('sorted_array', $array_name)
+        $comparer = $ARGS[3]
+        $partition = {
+            sorted_array = ARGS[0]
+            low[] = ARGS[1]
+            high[] = ARGS[2]
+
+            pivot_value[] = sorted_array[low[]]
+
+            i[] = low[] - 1
+            j[] = high[] + 1
+
+            run_main_loop[] = 1
+            :partition_main_loop
+                run[] = 1
+                :partition_i_increment
+                    i[arrsize('i') - 1] += 1
+                    if dyneval($comparer, sorted_array[i[]], pivot_value[]) > -1: run[arrsize('run') - 1] = 0
+                if run[] = 1: jump 'partition_i_increment'
+
+                run[arrsize('run') - 1] = 1
+                :partition_j_decrement
+                    j[arrsize('j') - 1] -= 1
+                    if dyneval($comparer, sorted_array[j[]], pivot_value[]) < 1: run[arrsize('run') - 1] = 0
+                if run[] = 1: jump 'partition_j_decrement'
+                killvar 'run', arrsize('run') - 1
+
+                if i[] >= j[]:
+                    RESULT = j[]
+                    run_main_loop[arrsize('run_main_loop') - 1] = 0
+                end
+
+                if run_main_loop[arrsize('run_main_loop') - 1] = 1:
+                    temp[] = sorted_array[i[]]
+                    sorted_array[i[]] = sorted_array[j[]]
+                    sorted_array[j[]] = temp[]
+                    killvar 'temp', arrsize('temp') - 1
+                end
+
+            if run_main_loop[] = 1: jump 'partition_main_loop'
+            
+            killvar 'low', arrsize('low') - 1
+            killvar 'high', arrsize('high') - 1
+            killvar 'pivot_value', arrsize('pivot_value') - 1
+            killvar 'i', arrsize('i') - 1
+            killvar 'j', arrsize('j') - 1
+            killvar 'run_main_loop', arrsize('run_main_loop') - 1
+        }
+        gs 'utils', 'i_arrays', 'quicksort', sorted_array, 0, arrsize('sorted_array') - 1
+        !!killvar '$comparer'
+    elseif $ARGS[1] = 'quicksort':
+        sorted_array = ARGS[2]
+        low[] = ARGS[3]
+        high[] = ARGS[4]
+
+        if low[] >= 0 and high[] >= 0 and low[] < high[]:
+            pivot[] = dyneval($partition, sorted_array, low[], high[])
+
+            gs 'utils', 'i_arrays', 'quicksort', sorted_array, low[], pivot[]
+            gs 'utils', 'i_arrays', 'quicksort', sorted_array, pivot[] + 1, high[]
+            killvar 'pivot', arrsize('pivot') - 1
+        end
+        killvar 'low', arrsize('low') - 1
+        killvar 'high', arrsize('high') - 1
+    elseif $ARGS[1] = 'test':
+    !! gs 'utils', 'i_arrays', 'test'
+        arr[] = 0
+        arr[] = 4
+        arr[] = 10
+        arr[] = 2
+        arr[] = 7
+        arr[] = 5
+        arr[] = 2
+        arr[] = 9
+        arr[] = 5
+        arr[] = 6
+
+        $test_comparer = {
+            element_a[] = ARGS[0]
+		    element_b[] = ARGS[1]
+
+            if element_a[] < element_b[]:
+                RESULT = -1
+            elseif element_a[] > element_b[]:
+                RESULT = 1
+            else
+                RESULT = 0
+            end
+            killvar 'element_a', arrsize('element_a') - 1
+            killvar 'element_b', arrsize('element_b') - 1
+        }
+
+        'last is <<arr[]>>'
+
+        'before'
+        gs 'utils', 'i_arrays', 'dump', 'arr'
+
+        gs 'utils', 'i_arrays', 'sort', 'arr', $test_comparer
+        copyarr('arr', 'sorted_array')
+
+        'after'
+        gs 'utils', 'i_arrays', 'dump', 'arr'
+
+        killvar '$test_comparer'
+        killvar 'arr'
+    elseif $ARGS[1] = 'dump':
+        copyarr('arr', $ARGS[2])
+
+        *nl
+        '['
+        i = 0
+        :loop_dump
+            '<<arr[i]>>' + iif(i < arrsize('arr') - 1, ',', '')
+            i+=1
+            if i < arrsize('arr'): jump 'loop_dump'
+        ']'
+    end
+end
+
+--- utils ---------------------------------
+