Author Topic: Text on wall or other inroom dummy item in custom language.  (Read 2089 times)

Offline Raudhrskal

  • BFF
  • ***
  • Posts: 214
  • The MUD community needs YOUR help!
    • View Profile
Text on wall or other inroom dummy item in custom language.
« on: September 21, 2008, 05:02:27 am »
For Aerlindir @ i3.
Code: [Select]
#include <lib.h>

inherit LIB_ROOM;

// This function is manually added. If you changed the name of orcish language, type it instead of Tangetto.
string TextInOrcish() {
  return translate("Your text here.",
     this_player() ? this_player()->GetLanguageLevel("Tangetto") : 100);
}

static void create() {
    room::create();
    SetClimate("indoors");
    SetAmbientLight(30);
    SetShort("copy of sample_room.c");
    SetLong("This is a room you can use as a template.");
    SetItems(([
       //added by 'modify here items', 'wall', 'walls', '.', text
       ({ "wall", "walls" }) : "There's something written on the south wall.",
       //added by 'modify here items', 'south wall', '.', text
       ({ "south wall" }) : "There's an inscription on it.",
]));
    SetRead(([
       //added by 'modify here read', 'south wall', '.', text, manually replaced text with (: functional :)
      ({ "south wall" }) : (: TextInOrcish :),
       ]));
    SetExits( ([
"north" : "/realms/raudhrskal/area/room/sample_room",
"east" : "/realms/raudhrskal/area/room/other_room.c",
]) );
    SetInventory(([
   ]));

}

void init(){
    ::init();
}

Works for me.
'Skal
« Last Edit: September 21, 2008, 05:10:35 am by Raudhrskal »
I think, therefore i may be wrong.
Please note that if you met a Raudhrskal in a place that's not related to muds, it wasn't me. *sigh*... back when I started there was zero hits on google for that name...

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Re: Text on wall or other inroom dummy item in custom language.
« Reply #1 on: September 21, 2008, 01:28:08 pm »
Cool!

Here's an idea for fun.  How about the TextInOrcish function actually becomes TranslatedText() and uses a variable/property from somewhere else to decide which language to use?  Why?

Well, because you could then implement war zones which could change possession as one faction or another gains control of them.  How you want to do that is an exercise for the reader, but if there were a "zone" variable that said which faction held the land, all the grafitti, signs, etc could change to the language of the victors.

Offline Raudhrskal

  • BFF
  • ***
  • Posts: 214
  • The MUD community needs YOUR help!
    • View Profile
Re: Text on wall or other inroom dummy item in custom language.
« Reply #2 on: September 21, 2008, 01:51:24 pm »
Sure thing but two points:
1. It is planned to add an easy-ish way to make translated in-room texts. This is a temporary hack. Fact is, this way is more extendable ;).
2. The DS translate() just randomly replaces words with others from constant database. But one of points on my todo list is implementing a more-customised lang system (with hard-coded phrases, but also alphabet etc.). Something like the one from AFKmud (maybe other smaugs have it too).

The function can return any text you want. Making it
Code: [Select]
return "This room is controlled by "+GetFaction()+".";
wouldn't be hard. Now creating this faction-related functionality... SMOP*.

Regards,
'Skal

*SMOP -> http://www.catb.org/jargon/html/S/SMOP.html
I think, therefore i may be wrong.
Please note that if you met a Raudhrskal in a place that's not related to muds, it wasn't me. *sigh*... back when I started there was zero hits on google for that name...