Using Command Link to trigger 'use' function

OurJud
I've now learned how to use the command link to create a hyperlink in the room description, but only to do simple things like move a player. But how would I use it to trigger the use of an object?

Let's say I have a password system on a computer. The player types '>use computer' and they get the message:

Logging in. Please wait...

Enter password
>


The player enters the correct password and it triggers whatever. But if they enter an incorrect one, I print the message:

Incorrect password entered | Try again
>


Where Try again is a hyperlink. I want that hyperlink to trigger the same action as typing 'use computer' does.

How would I do that?

OurJud
I did try this, but to no avail. I opened up the Library Elements, found 'use', then clicked on the code icon so I could see the script, copied all the code to my clipboard, then went back to the 'try again' command that I'd created and pasted the 'use' script into it.

I tested this, but get the error:

Error running script: Error compiling expression 'HasScript(object, "try again")': Unknown object or variable 'object'

So I tried changing all instances of 'use' in the code to 'try again' but I still get errors.

OurJud
Holy cowpats, I did it again!!

CommandLink("use epad", "Try again") :D

I've only been working on that since midnight :roll:

Just one tiny thing. In that the above is an expression, could I add any text on the same line that isn't the link?

I want an incorrect password to give:

Incorrect password entered | Try again

How would I put the 'Incorrect password entered |' on the same line as the link?

jaynabonne
As always, the text processor is your friend. :)

msg("Incorrect password entered | {command:use computer:Try again}")

No need for script, etc. This will show "Try again" but execute "use computer" when clicked. Text markup is da bomb. lol

OurJud
Cheers.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums