0 votes
by (470 points)
reopened by

trying to make widget, what can combine words in short description sentence

vars:

<<set $face_title to ["he", "she", "it"]>>

widget:

<<widget "face">>\
	<<widget "face_gender">>\
		<<if $player.face_type is "masculine">>\
			<<print [
				"мужественное"
			].random()>>\
		<<elseif $player.face_type is "feminine">>\
			<<print [
				"женственное"
			].random()>>\
		<</if>>\
	<</widget>>\
	<<print [
		"",
		"довольно",
		"вполне"
	].random()>>\
	<<set $face_title to $face_title.random()>>\	
	<<if $face_title is "it">>\	
		<<if $player.beauty < 20>>\
			<<print [
				"мерзкое",
				"уродское",
				"ужасное"
		  ].random()>>\
		<<elseif $player.beauty >= 20 and $player.beauty < 40>>\
			<<print [
				"неприятное"
			].random()>>\
		<<elseif $player.beauty >= 40 and $player.beauty < 60>>\
			<<print [
				"обычное",
			].random()>>\
		<<elseif $player.beauty >= 60 and $player.beauty < 80>>\
			<<print [
				"приятное",
				"миленькое",
				"симпотичное"
			].random()>>\
		<<elseif $player.beauty >= 80 and $player.beauty < 100>>\
			<<print [
				"прекрасное",
				"красивое"
			].random()>>\
		<</if>>\
		<<face_gender>>\
		<<print [
			"лицо",
			"личико"
		].random()>>\
	<<elseif $face_title is "he">>\	
		<<if $player.beauty < 20>>\
			<<print [
				"мерзкий",
				"уродский",
				"ужасный"
		  ].random()>>\
		<<elseif $player.beauty >= 20 and $player.beauty < 40>>\
			<<print [
				"неприятный"
			].random()>>\
		<<elseif $player.beauty >= 40 and $player.beauty < 60>>\
			<<print [
				"обычный",
			].random()>>\
		<<elseif $player.beauty >= 60 and $player.beauty < 80>>\
			<<print [
				"приятный",
				"миленький",
				"симпотичный"
			].random()>>\
		<<elseif $player.beauty >= 80 and $player.beauty < 100>>\
			<<print [
				"прекрасный",
				"красивый"
			].random()>>\
		<</if>>\
		<<face_gender>>\
		<<print [
			"ебальник",
			"еблет"
		].random()>>\
	<<elseif $face_title is "she">>\	
		<<if $player.beauty < 20>>\
			<<print [
				"мерзкая",
				"уродская",
				"ужасная"
		  ].random()>>\
		<<elseif $player.beauty >= 20 and $player.beauty < 40>>\
			<<print [
				"неприятная"
			].random()>>\
		<<elseif $player.beauty >= 40 and $player.beauty < 60>>\
			<<print [
				"обычная",
			].random()>>\
		<<elseif $player.beauty >= 60 and $player.beauty < 80>>\
			<<print [
				"приятная",
				"миленькая",
				"симпотичная"
			].random()>>\
		<<elseif $player.beauty >= 80 and $player.beauty < 100>>\
			<<print [
				"прекрасная",
				"красивая"
			].random()>>\
		<</if>>\
		<<face_gender>>\
		<<print [
			"рожа",
			"физиономия"
		].random()>>\
	<</if>>\
<</widget>>\

but as a result i have this 

Error: <<face>>: error within widget contents (Error: <<set>>: bad evaluation: Cannot read property 'random' of undefined)

I've found examples of using random and do by analogies, but still not working

i ask your help again guys 

1 Answer

0 votes
by (470 points)
selected by
 
Best answer

i found a problem. $face_title was outside a storyinit cool. Ahh but i have another one...

Error: <<face>>: error within widget contents (Error: <<set>>: bad evaluation: State.variables.face_title.random is not a function)

This happens after the updating passage

by (64.2k points)

That's because you're changing the type of $face_title from an array to a string within the widget.  Specifically, this line:

<<set $face_title to $face_title.random()>>

 

by (470 points)
will try. thanks!
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...