Roleplay +Prefs


  • Tutorialist

    Hello! Here is code for you if you want it. It's about 99% done. It'll work well as it is, there's just one command I haven't finished yet. I'll update here when I do. You can change the categories you think your game might support via changing &data.categories prco=category1.category2.category3.etc. And then the code needs no other updates.

    // help files
    // +prefs - show your own prefs - done
    // +prefs * - show someone else's prefs - done
    // +prefs/list - show what categories the game provides - done
    // +prefs/set <category>=# - rank this pref
    // +prefs/note <set a note of your prefs>
    // +prefs/find <category> - find all people who have that category of at least 3+ stars.
    // categorys: action, adventure, casual, comedy, conflict, mystery, public, romance, social
    // to set up your own categories do the follow: &data.categories prco=category1.category2.category3.etc
    
    @create +Prefs Code Object <PrCO>
    @set prco=inherit
    &data.categories prco=action.adventure.casual.comedy.conflict.mystery.public.romance.social
    &c.+prefs prco=$+prefs:@pemit %#=[setq(p, pmatch(%#))]
    	[if(hasattr(%qp, _prefs.ratings),
    		[header([name(%qp)]'s +Prefs)]%r
    		[u(fn.displayprefs, %qp)]%r
    		[if(hasattr(%qp, _prefs.note),
    			%r%r[ansi(h, Note)]: [u(%qp/_prefs.note)]%r
    			)]
    		[footer()],
    		[alert(+Prefs, alert)] You have not set up +prefs yet! See +help +prefs for help.
    	)]
    &c.+prefs_other prco=$+prefs *:@pemit %#=[setq(p, pmatch(%0))]
    	[if(%qp,
    		[if(hasattr(%qp, _prefs.ratings),
    			[header([name(%qp)]'s +Prefs)]%r
    			[u(fn.displayprefs, %qp)]%r
    			[if(hasattr(%qp, _prefs.note),
    				%r%r[ansi(h, Note)]: [u(%qp/_prefs.note)]%r
    			)]
    			[footer()],
    			[alert(+Prefs, alert)] [name(%qp)] has not set up +prefs.
    		)],
    		[alert(+Prefs, alert)] I can't find player '%0'.  Please check your spelling.
    	)]
    
    &fn.displayprefs prco=[setq(r, get(%0/_prefs.ratings))]
    	[iter(sort(u(data.categories), a, .), 
    		[ljust(
    			ansi(
    				h, [capstr(%i0)]:
    			), 
    		15)]
    		%b
    		[u(fn.dispref, %qr,%i0)],
    		.
    		,%r
    		)]
    
    &fn.dispref prco=[repeat(
    			*, 
    			after(
    				graball(%0, %1*, .), 
    			:)
    		)]
    
    &c.+prefs/list prco=$+prefs/list:@pemit %#=[header(Available +Pref Categories)]%r
    			[itemize(
    				iter(
    					sort(
    						u(data.categories), a, . , .
    					), 
    					[capstr(%i0)], 
    					., .
    				), .
    			)].%r
    			[footer()]
    
    //this is poop!
    &c.+prefs/set prco=$+prefs/set *=*:@pemit %#=[setq(p, pmatch(%#))]
    			[if(u(fn.iscat?, %0),
    				[if(and(lte(%1, 5), gte(%1, 0)),
    					[if(u(fn.hascat?, %qp, %0),
    							[alert(+Prefs)] Changing %0 to %1.[set(%qp, _prefs.ratings:[setdiff(get(%qp/_prefs.ratings), [graball(get(%qp/_prefs.ratings), %0*, .)], .)].%0:%1)],
    							[alert(+Prefs)] Setting %0 to %1.[set(%qp, _prefs.ratings:[get(%qp/_prefs.ratings)].%0:%1)]
    					)],
    						
    					[alert(+Prefs, alert)] You tried to set '%1'.  You must set a rating of 0 to 5.
    				)],
    				[alert(+Prefs, alert)] I'm sorry but '%0' is not a category.  Check +prefs/list for available categories.
    				)]
    
    &fn.iscat? prco=[if(graball(u(data.categories), %0*, .),
    		1,
    		0
    		)]
    &fn.hascat? prco=[if(graball(get(%0/_prefs.ratings), %1*, .),
    		1,
    		0
    		)]
    		
    
    &c.+prefs/note prco=$+prefs/note *:@pemit %#=[setq(p, pmatch(%#))][alert(+prefs)] Setting your Prefs Note to [setr(n, secure(%0))].[set(%qp, _prefs.note:%qn)]
    
    &C.+PREF +Prefs Code Object <PrCO>=$+pref:@force %#=+prefs
    &C.+PREF_OTHER +Prefs Code Object <PrCO>=$+pref *:@force %#=+prefs %0
    &C.+PREF/SET +Prefs Code Object <PrCO>=$+pref/set *=*:@force %#=+prefs/set %0=%1
    &C.+PREF/NOTE +Prefs Code Object <PrCO>=$+pref/note *:@force %#=+prefs/note %0
    &C.+PREF/NOTE_CLEAR +Prefs Code Object <PrCO>=$+pref/note:@force %#=+prefs/note
    &C.+PREFS/NOTE_CLEAR +Prefs Code Object <PrCO>=$+prefs/note:@pemit %#=[setq(p, [pmatch(%#)])][alert(+Prefs, alert)] Clearing your note it was:%R[get(%qp/_prefs.note)][set(%qp, _prefs.note:)]
    
    &c.+prefs/find prco=$+prefs/find *:@pemit %#=[if(u(fn.iscat?, %0), [header(+Prefs/Find: %0)]%r%b[columns(squish(iter(filter(fil.hasprefs, lwho()), if(gte([after(graball([get(%i0/_prefs.ratings)], %0*, .), :)], 3), [name(%i0)]: [u(fn.dispref, [get(%i0/_prefs.ratings)], %0)]~))), 20, ~, 0)]%rThese are all the people [ansi(h, currently connected)] with %0 at 3+.%r[footer()], [alert(+prefs, alert)] Sorry %0 is not a category.  Check +prefs/list.)]
    
    &fil.hasprefs prco=FIL.HASPREFS: hasattr(%0, _prefs.ratings)
    

    You can c/p this into Muxify and then be able to c/p it onto your game.

    added aliases so you can do +pref/<stuff>.

    Also +pref/note by itself will now clear your note.


  • Tutorialist

    helpfu files

    Prefs is code that is meant to help people find likeminded RP partners.

    +prefs
    This command will show your preferences.
    +prefs <name>
    This command will show you someone else's preferences.
    +prefs/list
    This command shows you the list of available categories.
    +prefs/set <category>=<0-5>
    This command lets you rate from 0 to 5 how much you enjoy that kind of RP. Think of these ratings like stat dots. 0 is no interest, 1 is mild, 2 is neutral, 3 is interested, 4 is significant, 5 is what you absolutely love. Roughly.
    +prefs/note <note>
    This code sets a note on your +prefs expanding or explaining anything you choose.
    +prefs/find <category>
    Finds all connected people with the specified category rated 3+.


  • Politics

    @Cobaltasaurus said in Roleplay +Prefs:

    5 is what you absolutely love. Roughly.

    What if I love it gently? Why are you boxing me in, Cobalt? GOD.


  • Tutorialist

    @Coin said in Roleplay +Prefs:

    @Cobaltasaurus said in Roleplay +Prefs:

    5 is what you absolutely love. Roughly.

    What if I love it gently? Why are you boxing me in, Cobalt? GOD.

    Don't be a creep.


  • Tutorialist

    This is what this lovely looks like in game.

    :::::::::::::::::::::::::::::.  Cobalt's +Prefs  .:::::::::::::::::::::::::::::
    Action:         **
    Adventure:      ***
    Casual:         ***
    Comedy:         **
    Conflict:       
    Mystery:        ***
    Public:         ***
    Romance:        **
    Social:         ***
    
    
    Note: Every time I write these words they become a taboo
    Making sure my punctuation curve every letter is true
    Living my life in the margin and that metaphor was proof
    I'm talking poetic justice poetic justice
    If I told you that a flower bloomed in a dark room would you trust it?
    I mean you need to hear this
    Love is not just a verb it's you looking in the mirror
    Love is not just a verb it's you looking for a maybe
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    

  • Coder

    Hey @Cobaltasaurus, this looks cool! How comfortable are you with someone modifying it and using it for a slightly difference means?

    My general idea is to change this from rp-prefs to actual character traits, such as, say, how confrontational your character is, how much your character cares about the suffering of others, etc. I think I would lock it down to use during cgen, and make it replace a background.

    Thoughts?


  • Coder

    @Cobaltasaurus said in Roleplay +Prefs:

    @Coin said in Roleplay +Prefs:

    @Cobaltasaurus said in Roleplay +Prefs:

    5 is what you absolutely love. Roughly.

    What if I love it gently? Why are you boxing me in, Cobalt? GOD.

    Don't be a creep.

    He can't help it.

    Also, I advise putting a "-" in place if there is no item, to be clear that the field is intentionally blank.


  • Tutorialist

    @skew said in Roleplay +Prefs:

    Hey @Cobaltasaurus, this looks cool! How comfortable are you with someone modifying it and using it for a slightly difference means?

    My general idea is to change this from rp-prefs to actual character traits, such as, say, how confrontational your character is, how much your character cares about the suffering of others, etc. I think I would lock it down to use during cgen, and make it replace a background.

    Thoughts?

    Sure, go for it!

    @Thenomain said in Roleplay +Prefs:

    @Cobaltasaurus said in Roleplay +Prefs:

    @Coin said in Roleplay +Prefs:

    @Cobaltasaurus said in Roleplay +Prefs:

    5 is what you absolutely love. Roughly.

    What if I love it gently? Why are you boxing me in, Cobalt? GOD.

    Don't be a creep.

    He can't help it.

    Also, I advise putting a "-" in place if there is no item, to be clear that the field is intentionally blank.

    Smart.


  • Tutorialist

    Updated with +prefs/find, and the function for - for things that aren't there.

    +prefs/find will currently grab multiple logins of the same person. I've got no good way, right now, to cull them out.


  • Coder

    @Cobaltasaurus Just for my own sanity, the data is stored on the player bit, as: _prefs.ratings.category with a rating of 0 to 5?


  • Tutorialist

    @skew said in Roleplay +Prefs:

    @Cobaltasaurus Just for my own sanity, the data is stored on the player bit, as: _prefs.ratings.category with a rating of 0 to 5?

    No, but if you wanted to change it to do that you could. It's stored as on the player as

    _prefs.ratings: category:#.category:#.category:#.category:#

    Mostly because I didn't want to have a bunch of attributes on players.


  • Coder

    @Cobaltasaurus Got it! Thanks. My current plan is have a questionnaire that spits out data into the attrib that +prefs will read. Will let you know how it works! (Or you can see if you pop in when game is open.)



  • How about a pref for how IC conflicts should be handled, and how willing to lose face, resources, limbs, lives, etc you are?


  • Admin

    @Misadventure Not to be the cynic here but almost everyone will claim they are super mature about this kind of thing until it actually happens. At least I've never actually met anyone who openly admitted they are a big baby when they stand to lose.


  • Tutorialist

    @Misadventure said in Roleplay +Prefs:

    How about a pref for how IC conflicts should be handled, and how willing to lose face, resources, limbs, lives, etc you are?

    Game runners could chose to put that category in, sure.


  • Coder

    @Cobaltasaurus

    The easiest way is to setunion( <list of dbrefs>, )

    If you want them to remain in order, then perhaps:

    setq( d, <set of dbrefs> )
    iter( setunion( %qd, ), setq( d, delete( %qd, rest( matchall( %qd, %i0 )))), , @@ )
    %qd

    I'm on a tablet and I can't check, mostly I can't remember if delete works that way. Maybe ldelete()? Anyhow, what I want deletes words at a numeric list of positions. You are skipping the first one with rest(). Should work.


  • Coder

    Is there a way to get commas in the note? I know you're using secure(), just unsure if there's some way to get around that, which doesn't strip out our commas.


  • Tutorialist

    @skew @thenomain might have some thoughts.


  • Coder

    @Cobaltasaurus

    I do, but I never give up a chance to see if you want to jump on a particular code-wagon.

    Without the help files in front of me, I can think of a few things:

    • escape() instead of secure(). Escape will comment out commas and similar. However, when you read the attribute, you will probably need to s( get( <blah> )) to turn it back into legible text.
    • The attribute flag 'no_parse' (or possibly 'no_parse') on the $command attribute. This will mean that the system is reads the text as typed (tho space compression still happens). The danger here is that when you read it, you must use get() or v(). If you don't, you risk running the contents as the object, which could be pretty horrible. If this is what you want (it happens), you want to do it this way: [setq( x, get( <blah >))][eval( %#, s( %qx ))] <-- there may be better ways to do this.

    If you're using my update to @Sammi's notes system, the latter half of the 'no_parse' method is kind of what I do, because showing a %r as a return is pretty darned important for notes. What I think I do is more like this:

    &c.note [no_parse]: $note/add *:@check everything; @set target=attribute:[eval( %#, %0 )]
    

    So this way, the note is stored already parsed, and I don't have to do the 'get() with wizard privs, but eval() as the player' trick. Nope, it's set in stone when it hits the attribute.

    I haven't tested this to make sure I'm right, but I'm pretty sure that I am and this is the way I'd recommend it.


  • Tutorialist

    THIS IS SUPER DUPER IMPORTANT. If you are using this code please, please, please replace this function with this:

    &fn.dispref prco=[repeat(
    			*, 
    			after(
    				graball(%0, %1*, .), 
    			:)
    		)]
    

    The code that was bad was bad recursion, and caused Fallcoast to crash. So please., please go in and change 'fn.dispref' to what's above. If you must have the - for non-set prefs, I'll have not bad code up eventually.


Log in to reply
 

Looks like your connection to MU Soapbox was lost, please wait while we try to reconnect.