SexScripts : The use of tags? - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=741 Page 1 of 1

The use of tags?

cd228 [ Tue Feb 20, 2018 3:10 pm ]

Hello.

Does anyone have a suggestion of how to use tags?
What I am trying to. Obtain is to have a list of events - i imagine in an array - where each of them are tagged with a fetish.
I want the player to be able to select personal limits, so when a functions randomly selects between the events, the ones tagged with the limits are excluded.
Any ideas?

Re: The use of tags?

doti [ Tue Feb 20, 2018 7:56 pm ]

There's no way to use tags declared in the function setInfos().

You can save a list a user fetishes.
You can have a similar list in each event. Then you have to find the size of the intersection.

Code:
if( userFetishes.disjoint(thisEvent.fetishes) ) { ... //not ok }

Re: The use of tags?

cd228 [ Wed Feb 21, 2018 9:30 am ]

Thanks:)

Re: The use of tags?

cd228 [ Wed May 22, 2019 3:55 pm ]

How would you do the following:

I want to have a list of pictures that has tags on them (I am thinking maybe an array) which describes what is in the picture. For instance
Code:
imageTags = [Caucasian, BlueLingerie, Brunette]


I would like every time a person is edging to a picture - the tags are registered.
In the final part, I would like to evaluate which tags have been edged to the most, and randomly select a final image that has that tag.

I am thinking of making an integer variable for each tag - determine which integer is the largest (the tag which has been triggered the most) - and basically make a for-loop which runs through every single picture to determine if it has the tag - if it has add it to an array - and then randomly select one from the array.

I think there might be a much more elegant solution, as I feel this is a huge workaround.

Re: The use of tags?

doti [ Thu May 23, 2019 7:39 pm ]

There are maps for that. That's like a list, but the key can be a text string so it's like a bunch of variables put together.
(you can also save a whole map in SexScripts)

Lets says a bunch of images, and a egding session (advanced example) :
Code:
def edgings = [:] // empty map
def images = [
  [name:"a.jpeg", tags:["Caucasian", "BlueLingerie", "Brunette"]],
  [name:"b.jpeg", tags:["Cuckold", "Trans"]],
....
]

Code:
def imgNum = 1 // select this by any method
setImage(images[imgNum]["name"])
for(def t:images[imgNum]["tags"]) {
  if(!edgings.containsKey(t)) {
    edgings[t] = 0
  }
  edgings[t]++
}

if(edgings.containsKey("Caucasian") && edgings["Caucasian"]>3) {
  show("You like that white skin, uh ?")
}

Re: The use of tags?

cd228 [ Thu May 23, 2019 9:31 pm ]

Thanks a bunch as always Doti!

I won't pretend I understood the whole answer, but I will study the link a bit, and see if I can wrap my head around it:)

Re: The use of tags?

cd228 [ Thu May 23, 2019 10:22 pm ]

When I use this part:

Code:
for(def t:images[imgNum]["tags"]) {
  if(!edgings.containsKey[t]) {
    edgings[t] = 0
  }
  edgings[t]++
}


I get the error:
Cannot get property 'Caucasian' on null object

Re: The use of tags?

doti [ Fri May 24, 2019 11:27 am ]

Sorry, corrected above (parenthesis)

Re: The use of tags?

cd228 [ Fri May 24, 2019 6:12 pm ]

Thanks - it works now.

However, how would you sort a map?
I would like to be able to sort the tags, from highest value to lowest, so I can determine which tag was activated the most. After that I would like to get the most, second and third most used tag, and find a random image from the images[] array that contains the most, second and third most used tag respectively

Re: The use of tags?

doti [ Mon May 27, 2019 6:43 pm ]

Sorting by decreasing order, then showing the first key :
Code:
edgings.sort { -it.value }
show("More : "+edgings.keySet()[0])


Finding an image need more work ; for example with random number :
Code:

def bestImage = null
while(bestImage==null) {
  def num = getRandom(images.size())
  if(images[num]["tags"].contains(edgings.keySet()[0])) {
    bestImage = images[num]["name"]
  }   
}
setImage(bestImage)

Re: The use of tags?

cd228 [ Mon May 27, 2019 9:55 pm ]

doti wrote:
Sorting by decreasing order, then showing the first key :
Code:
edgings.sort { -it.value }
show("More : "+edgings.keySet()[0])



I tried this part, but it doesn't seem to do anything to the map edgings.
the map has not changed order, but is in the same order as they were added

Re: The use of tags?

cd228 [ Mon May 27, 2019 10:10 pm ]

Found the error:

it is :

Code:
edgings = edgings.sort { -it.value }

Re: The use of tags?

cd228 [ Wed Jun 19, 2019 7:13 pm ]

cd228 wrote:
doti wrote:
Sorting by decreasing order, then showing the first key :
Code:
edgings.sort { -it.value }
show("More : "+edgings.keySet()[0])



I tried this part, but it doesn't seem to do anything to the map edgings.
the map has not changed order, but is in the same order as they were added


Is there anyway to shuffle the edgings before sorting them?
At the moment, they always show up in the same order as they were added, if they have the same value.
Can you shuffle them first?

Re: The use of tags?

doti [ Thu Jun 20, 2019 4:51 pm ]

It will be sorted or shuffled I think.
You can perhaps shuffle then sort, but there's no real shuffle function. Perhaps :
Code:
edgings = edgings.sort { Math.random() }

Re: The use of tags?

cd228 [ Thu Jun 20, 2019 10:41 pm ]

doti wrote:
It will be sorted or shuffled I think.
You can perhaps shuffle then sort, but there's no real shuffle function. Perhaps :
Code:
edgings = edgings.sort { Math.random() }


works like a charm :)
Thanks Doti!

Page 1 of 1 All times are UTC + 1 hour [ DST ]
https://ss.deviatenow.com:443/
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2011