de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 15 posts ] 
Author Message
 The use of tags?
PostPosted: Tue Feb 20, 2018 3:10 pm 
Offline
Veteran
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?


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Tue Feb 20, 2018 7:56 pm 
Offline
Site Admin
User avatar
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 }


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Wed Feb 21, 2018 9:30 am 
Offline
Veteran
Thanks:)


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Wed May 22, 2019 3:55 pm 
Offline
Veteran
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.


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Thu May 23, 2019 7:39 pm 
Offline
Site Admin
User avatar
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 ?")
}


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Thu May 23, 2019 9:31 pm 
Offline
Veteran
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:)


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Thu May 23, 2019 10:22 pm 
Offline
Veteran
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


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Fri May 24, 2019 11:27 am 
Offline
Site Admin
User avatar
Sorry, corrected above (parenthesis)


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Fri May 24, 2019 6:12 pm 
Offline
Veteran
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


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Mon May 27, 2019 6:43 pm 
Offline
Site Admin
User avatar
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)


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Mon May 27, 2019 9:55 pm 
Offline
Veteran
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


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Mon May 27, 2019 10:10 pm 
Offline
Veteran
Found the error:

it is :

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


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Wed Jun 19, 2019 7:13 pm 
Offline
Veteran
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?


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Thu Jun 20, 2019 4:51 pm 
Offline
Site Admin
User avatar
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() }


Top
 Profile Send private message 
 
 Re: The use of tags?
PostPosted: Thu Jun 20, 2019 10:41 pm 
Offline
Veteran
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!


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.