Jump to content

Verifying script in dice hud


LunaMael
 Share

You are about to reply to a thread that has been inactive for 2169 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello


Is there a way to listen for a particular string on one channel and if it's there, start a listen event on a different channel for further action? I've created RP dice hud that will "roll" for the player when used. I'm aware how easy it is to make dice so I was looking at a way to minimize the ability to have others creating more favorable die without detection.

I had wondered if I should to have a listen for the roll. Once the roll was defined by the script, it would say on the public channel what my roll was and on an obscure channel, some embedded text as verification of the correct script being ran. If the script hears particular text on an obscure channel, then it validates roll as sim dice. If it didn't get the embedded text, then it would announce in public chat its an invalid roll as well as im'ing the sim owners.

The problem I'm having with the logic of this is that if I had made a cheat script that would produce the same text in public chat  as well as naming the object the same as the hud like this "Sparkle Hud 4000: Luna rolls for a ...", its not going to have anything going to the obscure channel so the listen won't have anything to act on. 

Any ideas how I could  ensure that my hud was the one used? I had thought of using the creator key somehow but not sure if that would work. Maybe global definition of the hud as the one speaking with the uuid or something rather than listening events? I'm just not sure how to go about writing this. Any help as to where to start would be most appreciated!

I hope I explained it so not to confuse you. Thank you for your consideration on this.
 

Link to comment
Share on other sites

I just came across a post from Rolig saying an object can't listen to itself so I guess it would have to be something with the creator id and a sensor? Will keep looking. If I'm headed to the right place, please let me know.

Thanks for your help :)

 

Link to comment
Share on other sites

It's very simple to start listening on an additional channel when you hear from something but I'm wondering if that is necessary.

You want to ensure that the message is from one of your dice, which you presumably sell no-mod.   So why not make a note of the OBJECT_CREATION_TIME of your dice (use llList2String(llGetObjectDetails(llGetKey(),[OBJECT_CREATION_TIME]),0);) and store it as a global variable in your listener script as strCreationTime.

Then, in your listen event, have a filter like this:

	listen(integer channel, string name, key id, string message)
	{
		if(llList2String(llGetObjectDetails(id,[OBJECT_CREATION_TIME]),0) == strCreationTime){
			//then process the message.   Otherwise ignore it.
		}
	}

That pretty much guarantees the listener will ignore messages from anything other than one of your dice.

ETA:     I've just seen your second post.  I am thoroughly confused.  I thought there were two objects -- a die and something that listens to the die.    What exactly is the set up?   

Edited by Innula Zenovka
Link to comment
Share on other sites

These huds will only be on our sims, not for sale so they can function for that sole purpose rather than it being a useless feature anywhere else. I see what you mean and I truly appreciate your time on this, but what I'm needing is for when the roll is not from our dice that it informs us of the cheat/incorrect dice. 

 

Perhaps I'm not seeing how this string would help in the case of someone else creating dice to use instead. 

 

 

Edited by LunaMael
hit send before completing my thought :S
Link to comment
Share on other sites

In that case, 

listen(integer channel, string name, key id, string message)
	{
		if(llList2String(llGetObjectDetails(id,[OBJECT_CREATION_TIME]),0) == strCreationTime){
			//then process the message.  
		}
		else{
			//message is from something pretending to be one of your dice.  
			//might at this point want to check llGetObjectDetails)id,[OBJECT_OWNER,OBJECT_CREATOR]) for the uuids of the object's owner and of the creator
		}
	}

 

Edited by Innula Zenovka
  • Like 1
Link to comment
Share on other sites

So this was the original thought behind the hud when I was thinking an object could listen to itself, so I know it won't work ATM but my thought is this .... somehow verify that the roll produced and announced in public chat came from my hud. If not, then instant messages sent to owners with who used the fake dice and the fact that it was not the hud.

 

========================

   llListen(-#, "", llGetOwner(), " embedded text");
      listen(integer chan, string what, key who, string msg)
    {
          if (msg != "embedded text");
        {
        llSay (0, "llGetOwner()" + "Invalid roll.");
        llInstantMessage( person2IM, "llGetOwner()" + " used unofficial die!!! -TEST1" );
        llInstantMessage( person3IM, "llGetOwner()" + " used unofficial die!!! -TEST1" );
        llInstantMessage( person4IM, "llGetOwner()" + " used unofficial die!!! -TEST1" );
        }
     {     
         if (msg == "embedded text");  
         {
         llSay (0, "Valid Roll.");
         } 
     }


default
{
state_entry()
}
   touch_start(integer num_detected) 
    {        integer i = 0;        for (; i<NumberOfRolls; ++i ) 
        {        integer roll = (integer)(llFrand(SIDES) + 1);        total += roll;        
        }        
             llSay (0, llGetDisplayName(llDetectedKey(0)) + " rolled a " + (string)total);
             llSay (-#, llGetOwner()) + "embedded text");
            llResetScript();
    }
}

Link to comment
Share on other sites

I'm still confused.   Are you saying that people simply wear HUDs that announce, in public chat (channel 0) what their dice roll is?

You're right that objects can't listen to themselves, so I would thought the way forward (and also the securest way) is for the HUDs to announce the score on a non-zero channel (a long, negative integer, for preference) and a separate object, belonging to whoever is running the game, listens on the channel and announces the scores (assuming that the scores come from one of your dice).

Link to comment
Share on other sites

oh Wow. Hadn't thought of that as an option. Interesting thought. I think this would work if I needed the roll for things like # of moves or whatnot.

I guess I hadn't explained the dice well, and to that, I'm sorry. The dice would be used in case there was a draw between 2 players and a clear winner wouldn't be able to be named with RP so they would roll. High score wins the battle and they would RP the remainder of the fight with those results. So we'd need to compare the 2 rolls to see who won. Figured their roll in local chat would be best bet. I'm trying to work out a system so that someone cannot make a quick script that would mimic the roll either by name of object or the text written along with the number generated that would favor them unfairly and if at all possible to inform the sim owners of the attempt to cheat during their RP.

Link to comment
Share on other sites

I see.  Does your RP HUD know who the wearer is fighting?   If it does, then you could have the HUDs use llRegionSayTo(id,somechannel, message), where "id" is the UUID of the wearer's opponent, and then the wearer's HUD will hear the message (assuming it's listening to the right channel).    That way, each player's HUD can announce the other player's score (assuming the message passes the filter).   That would stop cheating.

Link to comment
Share on other sites

Not something I had thought about. I see your point about grabbing the uuid of the opponents to limit outside scripts. Will have to think on that. Have to run to the shop before it gets too late but I appreciate the thought and will see what I can come up with when I get back :D Thanks for the nudge!!!

Link to comment
Share on other sites

to maintain integrity my approach would be similar to Innula by only have one dice generator for the game.

create a independent dice cup object (game controller) containing script which rolls the numbers and regulates the players' turn.

the dice cup sends a message to each players HUD in their turn that its their roll.

the player clicks the roll button on their HUD. A message is sent to the dice cup which does the roll. The dice cup says in public what they rolled.

some other advantages of game controller

- multiple and out of turn clicks can be safely ignored by the game controller.

- if the player doesn't roll in X time, their turn can be forfeit or dice auto-rolled depending on game rules. In either case the game can proceed and not be held up by slow play

- the issue of ppl using fake HUDs has no effect on the integrity of the game. All gameplay is performed by the game controller. The HUD is only an interface to receive inputs (roll dice now) and display outputs (your score is)

etc

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2169 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...