Jump to content

deleting an opponets objects


Avex Axon
 Share

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

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

Recommended Posts

Darkie Minotaur and Rolig Loon, very kindly helped me with a *die* script allowing me to specify a particular word which when used in a sentence would delete an inworld object. With this in mind, it set me to wondering if there is a way to use a similar script to delete an OPPONENT’S objects? If this were possible, I realised it would make the game I’m trying to set up on my sim FAR easier! Any help as always would be hugely appreciated!

Link to comment
Share on other sites

If I understand you correctly, you want the object A has to listen to B - right?

If we take the old script:

 

default{    state_entry()    {        llListen(0,"",llGetOwner(),"");    }    listen(integer channel, string name, key id, string m)    {        if (llSubStringIndex(llToLower(m), "delete") > -1)           llDie();    }}

 You would want to react to something a specific person says by:

 

  • listening to a specific person - which you ctually do by havin llGetOwner() in the listen function: 
llListen(0,"",llGetOwner(),"")
  • or checking inside the listen event

 

 listen(integer channel, string name, key id, string m)    {       if(name == "my oponent") {          if (llSubStringIndex(llToLower(m), "delete") > -1)           llDie();       }    }

 The problem I guess is, how do I get the script to know who the opponent is, but that depends on which game we are talking about - there are many potential ways.

 

  • Like 1
Link to comment
Share on other sites

Hi Darkie....thanks for analysing it. Basically it's a case of for example Player A has 3 boxes, which will delete on the words *silver*, *gold* and *bronze*....whilst Player B has 3 boxes deleting with the words *blue*, *red* and *white*.

I'm trying to find a way that Player A could say *the sky was blue*, and Player B's *blue* box vanishes.

This also supposes that Player A and Player B are unknown to each other apart from standing in the arena to *play*

Hope this helps?!

Thanks again

Link to comment
Share on other sites

thats the area that I am not sure of.

I wasn't sure if it could be as simple as having a script in Player A's boxes, that recognises a similar script in ANY opponets boxes.

Or whether the players need to wear a generic attachement, which tells opponents boxes to *listen* for their *delete* command word

Link to comment
Share on other sites

I'm not sure I'm getting the gist of the game. But as fa as I understand:

  • there is an undefined number of potential players - all of them have three boxes
  • all of the boxes listen to some color code on which they die
  • if the players meet in a certain area, they are randomly assigned an opponent without them knowing it - let's say: players A - e are in the area; A and B are assigned as opponents. Now the boxes of A (blue, green and red) listen to B only and vice versa

is that right?

Link to comment
Share on other sites

I think its one of those things thats always difficult to explain......grins.....you have it so clearly in your mind, you forget that it isn't as simple as it may appear once you try to explain!

Basically, two opponents meet in an arena. The meeting is set up ahead, through challenge. Each player has a number of boxes.......which they place out IN the arena.

Each players boxes will delete themselves if a particular word is spoken by the opponent..

The players take it in turns to speak....(it's a role play setting).......

The winner is the one who deletes his opponents items first.

The objects can be anything containing the script......and the number OF objects is dependent on how well the player has performed. ie if he wins 3 contests, he gains the right to add an additional object. So Player A, more experienced, may have out 5 boxes.....whilst Player B, less experienced, may have out only 3.

In effect it's a variation on Battleships.......but using words within sentences to win, by destroying opponets defences (boxes)

There are only two players.

And the *delete* command doesn't have to be colours...I was simply using that as an example. It can be any word I put into the script as it's *delete* command.

It's the question of how to script so as to be able to delete an opponents boxes, as opposed to one's own.

Fingers crossed that this now makes sense..:)

Link to comment
Share on other sites

I think I got it - the battleship comparison made the bells ring - I hope ;)

 

  • two player meet in an arena to 'fight'
  • they put out their (let's call them) boxes
  • they start to talk in turns - if they happen to use one of the 'killer' words of one of the opponent's boxes, it vanishes

So, technically, as soon as the two opponents enter the arena, it's known who the person a box has to listen to is. There are many ways to do it.

Here is just one scenario:

  • the opponents put out their boxes in a certain area
  • when they have finished, they 'register' with 'the battle system' - this could be: they click on a box that's the controller.
  • the controller tells the boxes the keys of the avatars that have touched it - for a given box one is the owner - it remembers the other and listens to this one

I hope this helps you to point you in the right direction - as I said - there are many ways in which you could do it. Basically you need a situation in which the boxes learn who the opponent is, so they can listen to them.

Link to comment
Share on other sites

ah....that may be possible. So if Player A put Player B's avatar key......in the right place in the script, popped that into the box, and placed it out....then when Player B said the correct word, Player A's box would delete?

Hope that is right......and thanks for suggesting!

Link to comment
Share on other sites

Notes what Minotuar says.......

Right....so a *control box* script........that is definitely doable, and would add to the scenario in any case.

At this stage, I'll happily hold my hand up to lack of ability beyond cutting and pasting, and commission a system if I can find someone to do it! Grins

Big thanks

(and just re-read your post......succinctly put and absolutely spot on)

Link to comment
Share on other sites

my comment was aimed at making sure that you had scripted acces to the items being deleted =)

following on darkies example of a control box... have the individual users items listen to the control box, then there's no need for them to listen to specific users.

Link to comment
Share on other sites

I really need to spend some quality time over the summer learning the various commands. I can come up with scenarios, but the paths and logistics defeat me!

This forum and the willingness of the more expert people, is an absolute godsend!

Do you mean in effect, that using the delete script from before....ie...:

 

default
{
    state_entry()
    {
        llListen(0,"",llGetOwner(),"");
    }

    listen(integer channel, string name, key id, string m)
    {
        if (m=="delete")llDie();
    }
}

 I would need to add a line that would tell it to listen to an avatar's key from a centrally placed control box, and that the control box itself would then have a script which has recorded the opponents key (on touch) and is *waiting* to tell that key to the *box* if and when the correct word is used by the opponent?

Sorry to be think here......it's a little like algebra..once it sinks in, you have a EUREKA moment!!!

 

Link to comment
Share on other sites

have it listen instead to the control box....

llListen( some_channel_number, "Control Box", "", "" );

then have the control box listen for ALL the commands, form anyone, or just from the last two people to touch it or something similar, and repeat them on some_channel_number

Link to comment
Share on other sites

let's keep it very sipmle. First we have te controller box. one opponent clicks it - it tells the boxes the key - second opponent, it tells the other boxes the key. all the very simple controller box needs is:

 

default{	touch_end(integer total_number)	{		llWhisper(-7545676, (string)llDetectedKey(0));	}}

For the boxes, the code could look something like this:

 

key opponent;default{    state_entry()    {        llListen(-7545676,"","","");    }    listen(integer channel, string name, key id, string m)    {		if (channel == -7545676) {			if ((key)m != llGetOwner()) {				opponent = (key)m;				llListen(0,"",opponent,""); 			}		} else if (channel == 0) {			if (m=="delete")llDie();		}   }}

 

I got it right - the approach is a bit different than that of Void - but there are many ways to skin a cat - even though Void's cats are much more cleanely and very much more efficiently skinned.

 

 

 

 

Link to comment
Share on other sites

Ok.....popped the control script into a box......then the delete script into another. Edited delete script to use *blue* as a code word in the:l     lListen(0,"",opponent,"");    section.

Dragged a friend over and had them click the control box, then say *the sky is blue" in chat. Nothing happened.

re-edited the script and placed the *blue* in the if (m=="")llDie(); section....and still nothing. 

I'll keep playing around with it and see if I can make it happen and keep you updated as I go.......many thanks again for taking the time and effort to help.

 

Link to comment
Share on other sites

Just had to pop back and say that amidst all the dramas etc that so often punctuate our SL experiences, things happen that simply serve to remind you that there are so many really GOOD things and people about this place.

I'm inworld, playing with the scripts trying to get em to work.....get a tp offer from Darkie, and he has not only played with the code, but gives a demonstration of how to do it...and a copy of the working scripts.

Won't take any recompense.....simply points out that HE was helped when he started here.

I'll do the same the first time someone comes to ME looking for help.

Once again Darkie.....BIG thanks.......and Void too for your input.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4822 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...