Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Report command?

Exile Loudon
Aspiring Scripter
Join date: 10 Dec 2005
Posts: 122
03-31-2006 09:31
I'm trying to make a report command for my gadget I'm making, and I can't figure out why this one won't work I wrote. I'm trying to have it work like this:

Step 1) They find a bug. They want to report it.
Step 2) They say "/2 report". It tells them "Say the bug in channel 2. Example = (/2 [YOUR BUG REPORT HERE])"
Step 3) They say "/2 [bug report data blah blah blah]"
Step 4) I get an IM of what their bug report.

Here it is:
CODE

key detectkey;
string cusmessage;
integer listen1;
default
{
state_entry()
{
listen1 = llListen(2,"",llGetOwner(),"");
llListen(2,"",llGetOwner(),"");

}
listen(integer channel, string name, key id, string message)
{
cusmessage = (string)message;
if (message == "report")

llOwnerSay("Say the bug in channel 2. Example = (/2 [YOUR BUG REPORT HERE])");
llListenRemove(listen1);
llListen(2,"",llGetOwner(),"");
}


listen(integer channel, string name, key id, string message)
{
if (message == cusmessage)
llInstantMessage(llGetCreator(),cusmessage);
}
}
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
03-31-2006 11:09
cant have 2 like events in the same state
Adman Drake
Registered User
Join date: 9 Feb 2006
Posts: 96
03-31-2006 11:21
From: Exile Loudon
I'm trying to make a report command for my gadget I'm making, and I can't figure out why this one won't work I wrote. I'm trying to have it work like this:

Step 1) They find a bug. They want to report it.
Step 2) They say "/2 report". It tells them "Say the bug in channel 2. Example = (/2 [YOUR BUG REPORT HERE])"
Step 3) They say "/2 [bug report data blah blah blah]"
Step 4) I get an IM of what their bug report.


Whever you told them to type "/2 report" to report a bug, instead tell them "To report a bug, type /2 [your bug here!]"

In other words, typing "/2 report" seems useless. Remove that functionality. Just tell him in a notecard in the object how to report bugs.

It goes without saying that you should test your objects as much as possible before releasing them to catch as many bugs as possible, but that's neither here nor there. :)

Adman
Exile Loudon
Aspiring Scripter
Join date: 10 Dec 2005
Posts: 122
03-31-2006 11:28
well, as I said earlier, I'm making a gadget. The gadget has many other commands, and channel 2 is being used for those commands. I can't use "/2 [your bug here]" for it, because whenever they try to rez a shield, for example, I'll get an IM telling me "shield".
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
03-31-2006 11:38
Well then, how will you know that it's a bug report and not a command? And like Osgeld said, you'll have to handle everything in a single listen handler, you can't have multiple handlers for the same event in the same state. So either you need to switch to a new state and then listen for just the bug report, and of course remember to switch back to the main state once you're done, or you'll have to have more if/else checks inside your listen handler, and figure out some way of determining if it's a command or a bug report or whatever else that handler needs to handle.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
03-31-2006 11:51
i personally dont like states when users are involved hehe i would do it as ziggy secondly suggested it maby like

CODE


else if (llGetSubString(message,0,0) == "!")
{
string = llGetSubString(message,1,-1);
llFile_Reprt(stuff);
}


then it would be /2!product works great

or you could use another llListen on a different channel temporarly and use the channel filter on the event

if (channel == 5) //Report channel
else llDoNormalStuff();