Skip to content

Instantly share code, notes, and snippets.

@scottyob
Created May 15, 2022 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottyob/81de951fe43d0ee2ff47e00b5888f707 to your computer and use it in GitHub Desktop.
Save scottyob/81de951fe43d0ee2ff47e00b5888f707 to your computer and use it in GitHub Desktop.
[scott@node02 cogg]$ cat map.tin
#VAR {previousRoom} {""};
#VAR {currentRoom} {""};
#NOP ---
#NOP - Either creates or go-to's the room ID seenEither creates or go-to's the room ID seenEither creates or go-to's the room ID seenEither creates or go-to's the room ID seen
#NOP --
#action {::ROOM-ID-%1::} {
#VAR {previousRoom} {$currentRoom};
#VAR {currentRoom} {%1};
findroomid {$currentRoom};
#if {$vnum} {
#MAP goto {$vnum};
};
#else {
#map get {roomid} {currentRoomId};
#if {"$currentRoomId" == ""} {
#echo {Setting blank room with ID};
#map set roomid {%1};
#map write map.map;
#script {curl -X POST http://localhost:3002/map};
};
#else {
#echo {MAP ERROR. NEW ROOM ID FOUND BUT ID ALREADY SET};
};
};
#NOP Now that the local map has been updated, we might as well let our handy dandy script know;
notifyAtRoom {$currentRoom};
}
#alias {notifyAtRoom} {
#script {curl -X POST -d '{"scott": "%1"}' -H 'Content-Type: application/json' http://localhost:3002/user};
}
#alias {findroomid} {
#var vnum 0;
#map at {{roomid}{%1}} #map get roomvnum vnum;
}
#alias {linkback} {
findroomid {$previousRoom};
#if {$vnum} {
# map link {%1} {$vnum}
}
}
#NOP ---
#NOP - Undos a room creation once we can not go one way
#NOP --
#ACTION {You can't go that way} {
#map undo;
#showme {Undid map}
}
#NOP ---
#NOP - Updates the current room name from what we've seen from the server
#NOP --
#action {~^\e[0m\e[1;36m[%1]\e[0m\e[0m (} {
#map set roomname %1;
}
#action {~^\e[0m\e[36m[%1]\e[0m\e[0m (} {
#map set roomname %1;
}
[scott@node02 cogg]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment