Signs

Posted by Stratus on Fri 06 Sep 2002 01:23 AM — 8 posts, 26,402 views.

#0
Ok, I wanted to make a script for my 'guild' so that when a player moved into a certain object they were whispered a message by my bot. Here is the script as of now, I know it's wrong because I found a script for it but it was for PerlScript so I just tried changing as best I could:

function SignActivated (thename, theoutput, thewildcardsVB)
{
var SignXY
var Name
SignXY = world.GetTriggerInfo (thename, 102)
Name = world.GetTriggerInfo (thename, 101)
world.EnableTrigger ("SignOutput","false")
world.SetVariable ("SignXY","$signXY")
world.send ("\"l " + Name)
world.EnableTrigger ("SignOutput","true")
} //end of SignActivated

function SignOutput (thename, theoutput, thewildcardsVB)
{
var Name
var signXY
world.EnableTrigger ("SignActivated","false")
Name = world.GetTriggerInfo (thename, 101)
signXY = world.GetVariable (SignXY)
if ("signxy" eq " & 9")
world.send ("wh " + Name + " Hello, and welcome to the Island of Fincayra! This is the newest sparring guild to come to Furcadia. (Note: This guild is still under -major- construction.")
world.EnableTrigger ("SignOutput","false")
world.EnableTrigger ("SignActivated","true")
} //end of SignOutput

Any idea of how I could make this script work? If so, be sure to reply!
Australia Forum Administrator #1
Not sure what you are trying to do here, but here are a few comments:

  • I wouldn't quote "true" and "false", it should read like this:

    world.EnableTrigger ("SignOutput", false)
  • Using dollar signs for variable contents is a Perl thing, try this instead:

    world.SetVariable ("SignXY", signXY)
  • There is not much point in disabling a trigger and re-enabling it, the trigger won't be processed while the script is running anyway.

    world.EnableTrigger ("SignOutput", false)
    ...
    world.EnableTrigger ("SignOutput", true)
  • What is this line trying to do?

    world.send ("\"l " + Name)
#2
I don't know actually. I just found the script but it was for Perlscript so I just put in everything and transfered it to Jscript as best I could. =/
#3
Ok, maybe this will help. Here's the whole script for Perl

sub SignActivated
{
my ($thename, $theoutput, $wildcards) = @_;
$world->enabletrigger ("SignOutput","false");
$signxy = $world->gettriggerinfo ($thename, 102);
$furrexy = $world->gettriggerinfo ($thename, 101);
$world->setvariable ("SignXY","$signxy");
$world->send ("l $furrexy");
$world->enabletrigger ("SignOutput","true");
}


sub SignOutput
{
my ($thename, $theoutput, $wildcards) = @_;
$world->enabletrigger ("SignActivated","false");
$name = $world->gettriggerinfo ($thename, 101);
$signxy = $world->getvariable ("SignXY");
if ("$signxy" eq " & 9")
{
$world->send ("wh $name Hello $name and welcome to the Island of Fincayra.");
}
$world->enabletrigger ("SignOutput","false");
$world->enabletrigger ("SignActivated","true");
}
Any idea of how I would translate it to JScript?

*Note: This script is called when a player moves into a 'sign'

Trigger: ^7 (.*?) 6 \+ 5 3 (.*?) 6$
Send:
Regular Expression: Checked
Label: Sign1
Script: SignActivated
Amended on Sat 07 Sep 2002 03:01 AM by Stratus
Australia Forum Administrator #4
You could keep it as Perlscript and make it a plugin.

You can have plugins in different languages, which are not necessarily your "preferred" language for the main scripting configuration.
#5
I know but I'm just learning JScript right now, so I wanted to see how to do this in JScript so I could do it for all of my 'signs'. I was trying to decide between VBscript and Jscript for my 'bots', I decided on Jscript so I'm trying to learn it real fast and I just thought that by learning all of this script and how it works would help a little I guess. So, I would much appreciate it (not like you have to) show it in Jscript.
Amended on Sat 07 Sep 2002 03:54 AM by Stratus
Australia Forum Administrator #6
To help me understand this a bit better, can you give me the two other triggers? The script refers to enabling the triggers "SignOutput" and "SignActivated", so what do they do?
#7
Trigger: ^7 9\!\! \:\! \!\+ 9\!\!$ (It's something like that, I don't actually have the trigger on me right now.)
Send:
Enabled: Checked
Regular Expression: Checked
Label SignnActivated
Script: SignActivated

SignActivated is to begin when the character bumps the sign, then it calls the script SignActivated.
Trigger: ((You see *.)
Send:
Enabled: Unchecked
Label: SignOutput
Script: SignOutput

SignOutput is suppossed to be called after it is enabled by SignActivated and after the bot looks at the character. (l Name). So then it's possible to get the name of the character instead of just their position, then with the script it does all this and whispers them back whatever. :)

I did a little testing with a friend of mine and we got the script to work up until the world.send, here it is:

function SignActivated (thename, theoutput, thewildcardsVB)
{
var name
var signxy
world.EnableTrigger ("SignOutput", false);
name = world.GetTriggerInfo (thename, 101);
signxy = world.GetTriggerInfo (thename, 102);
world.SetVariable ("SignXY", signxy);
world.send ("\"look " + name);
world.EnableTrigger ("SignOutput", true);
}

This works perfectly except instead of sending "Look Name
to the world it send Look * or another character, it's suppossed to retrieve the character's position and look at the person there, then call the next script. But instead it keeps taking a letter or number out of the trigger.