Create another command "go to"

kaCHen
02 Dec 2014, 21:14
Hellow,
im new at this, and i wanted to do game, where you will need to hack to other computers.
When i need to "hack" on another computer i wont use "go (name)", so i thought about using "ssh (name)".
I tried to make command with simmiliar parameters like "go to" but it dont works.
So any ideas, how to do it?
Thanks for any help :)

jaynabonne
02 Dec 2014, 21:44
You're going to need to provide more information than that.

First, what exactly did you do? What was the pattern you used for the command? What script did you add for it to run?

And second, please explain what you mean when you say it doesn't work. Does it not recognize the command? Does it not run the script you thought it would? What exactly does the game say?

kaCHen
02 Dec 2014, 21:57
http://postimg.org/image/vgzp4qrpr/
I did the exactly thing like this, i've copied the pattern (and rewrited the South etc. to my rooms) and made same script like there, also i've rewrited "go to" and "go" to "ssh".
And yeah, the game says,"I don't understand the command."

jaynabonne
02 Dec 2014, 22:07
Can you show in the same way (or post your game) the command after you made changes? I'm surprised it says "I don't understand" instead of "You can't go there". One thing to keep in mind is that you can't just put the name of a room in there. It operates on exits. So you would need to create an exit to the room you want, and then click back on the exit and give it the alias you'd like them to type in "ssh (alias)".

kaCHen
02 Dec 2014, 22:18
http://prntscr.com/5clhmu
There you go, well im not suprised, because i think there is still somewhere mistake in pattern or script :(

Metamorforme42
02 Dec 2014, 22:22
And have you tried to just changing your template into the language library you are actually using:

<template templatetype="command" name="go"><![CDATA[^go to (?<exit>.*)$|^go (?<exit>.*)$|^(?exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$]]></template>


by

<template templatetype="command" name="go"><![CDATA[^go to (?<exit>.*)$|^go (?<exit>.*)$|^ssh (?<exit>.*)$|^(?exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$]]></template>

or

<template templatetype="command" name="go"><![CDATA[^ssh (?<exit>.*)$|^(?exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$]]></template>


I could be easier than create a new verb associated to a function who already exist ;)

PS: I am sorry if jaynabonne have already solved your problem when I post that, but I have a very bad internet access today (~50Mb/s) and I can't verify that now.

jaynabonne
02 Dec 2014, 22:27
The problem is that you're using a regular expression as a pattern. Either change it back to "regular expression" or set your command pattern to:

ssh #exit#

You don't need to explicitly put pc1 and pc2 in the pattern if you have created exits (as you have) with appropriate aliases.

jaynabonne
02 Dec 2014, 22:31
The other way to do it is to just have custom commands for each pc you want to ssh to. For example, one command pattern would be:

ssh pc1


and the other would be

ssh pc2

each with its own script. I'm only suggesting that because if you have normal exits in the room as well, then things are going to get confusing when people can also type "go pc1" or "ssh n".

kaCHen
02 Dec 2014, 22:54
Yeah, true, thanks for help, i made it, but i guess, im still bad in scripting.
http://prntscr.com/5clxog (i renamed the pc1,pc2 into real names)
http://prntscr.com/5cly0y i guess there is something bad with the exit names in script, but i dont know what to do.

jaynabonne
02 Dec 2014, 22:58
When you're replying, if you either click "Post Reply" below or "Full Editor & Preview", then you'll be taken to the full editor where you can attach a file. Then you can attach your game as is. (I don't feel like typing in all the text for your game!) It will be much easier if I can run your game and see what you're seeing.

When you change the pattern to "ssh zdena", there will no longer be an "exit" variable set, as there isn't one in the pattern. If you want the player to be moved to that room, then just have your script do a MoveObject script, with the player as the object and the desired room as the target.

kaCHen
02 Dec 2014, 23:03
There you go.

kaCHen
02 Dec 2014, 23:07
Oh my godness, that feeling, when you realize, that it was so easy :D
Thanks everyone for help and patience with me ;)