Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old July 12, 2015, 01:02   #11
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
I think we want to avoid constructing strings in the code (thinking about potential future translations here too). And including bare format strings in the edit files is a security hole and potential crash bug waiting to happen. So I'd do something like use {{name}} or similar to signify where the monster name should go and we can make the code process that. And include a failure line as well, so that the code doesn't have to add "but misses":

Code:
message:{{name}} gazes at you with psionic energy. 
message-miss:{{name}} gazes at you with psionic energy, but misses.
message-save:You shake off a pounding headache. 
message-invis:Something invades your mind.
lore:cause mind blasting
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old July 12, 2015, 09:28   #12
Elsairon
Adept
 
Join Date: Apr 2007
Posts: 117
Elsairon is on a distinguished road
Thanks guys. I will continue ahead with these suggestions, one more thought though.

Do we need message-invis-miss: ?? I'm thinking not since the player wouldn't know about it, and the messages are all about filling in the characters experience for things that are not obvious on screen but are perceived.

How about the lore: entries?

Those are listed here but are built in a different part of the code. As of now the entries for breath include only the name of the element, and not the prefix 'breathes'. This is part of monster memory view if I recall correctly.

Last edited by Elsairon; July 12, 2015 at 09:59.
Elsairon is offline   Reply With Quote
Old July 14, 2015, 06:48   #13
Elsairon
Adept
 
Join Date: Apr 2007
Posts: 117
Elsairon is on a distinguished road
I'm looking at which spells need message-miss:
I'm guessing the entries with RST_BOLT and RST_ATTACK.

I think the relevant code is here.. in mon-spell.c (correct me if I'm wrong)
Code:
	/* See if it hits */
	if (spell->hit == 100)
		hits = TRUE;
	else if (spell->hit == 0)
		hits = FALSE;
	else
		hits = check_hit(player, spell->hit, rlev);
However I don't know where spell->hit is reading from so I can't tell for sure which spells need it and which don't.

I think I'm almost done after adding these miss messages. I'll do another once over to look for typos, etc.
Elsairon is offline   Reply With Quote
Old July 14, 2015, 10:14   #14
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,835
Donated: $60
Nick will become famous soon enough
Quote:
Originally Posted by Elsairon View Post
However I don't know where spell->hit is reading from so I can't tell for sure which spells need it and which don't.
spell->hit is just coming from the hit: line in monster_spell.txt - so basically they're all perfect hits except arrows and boulders.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old July 14, 2015, 21:51   #15
Elsairon
Adept
 
Join Date: Apr 2007
Posts: 117
Elsairon is on a distinguished road
I'm calling this first iteration done. All of the requested messages as far as I can tell are added to the monster_spell.txt file.

I took several ideas from Nick's FA monattk.c and used those, trying to maintain theme.

The ARROW_1 - 4 messages might need another look to match the lore: entries as I wasn't sure how those are used or if they could be changed.
Some messages retain 'Something mumbles.' for message-invis: such as the ball and bolt spells.

More iteration can improve these issues later,but it should be enough to test with.

Completed file attached here, as it is within the size requirement (hopefully it works) or if not shoot me a pm and I can email you.
Attached Files
File Type: txt added_messages_monster_spell.txt (15.9 KB, 97 views)

Last edited by Elsairon; July 14, 2015 at 21:57.
Elsairon is offline   Reply With Quote
Old July 14, 2015, 22:54   #16
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,835
Donated: $60
Nick will become famous soon enough
Those look excellent. I'll get them incorporated, and let you know of any problems.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old July 15, 2015, 08:47   #17
fph
Knight
 
Join Date: Apr 2009
Location: Berlin / Italy
Posts: 783
fph is on a distinguished road
Quote:
Originally Posted by takkaria View Post
I think we want to avoid constructing strings in the code (thinking about potential future translations here too).
Angband looks like a hell to translate. Lots of strings are like "The {{name}} hits you", where {{name}} can be hundreds of different things.
They are very tricky to translate because in many languages there is nontrivial grammatical interaction between the sentence and the name you plug in it. For instance, in Italian you would need different variants according to the grammatical gender of {{name}} and its first consonant group. Some languages have different plurals for 2 and 3+ objects.

It looks challenging to code without extra logic in the source and a big lookup table. As far as I know handling gender is an unsolved issue even for things like gettext (see e.g. http://stackoverflow.com/q/6143547).
__________________
Dive fast, die young, leave a high-CHA corpse.
--
You read a scroll labeled 'lol gtfo' of Teleport Level.
fph is offline   Reply With Quote
Old July 15, 2015, 13:09   #18
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,367
AnonymousHero is on a distinguished road
Quote:
Originally Posted by fph View Post
Angband looks like a hell to translate. Lots of strings are like "The {{name}} hits you", where {{name}} can be hundreds of different things.
They are very tricky to translate because in many languages there is nontrivial grammatical interaction between the sentence and the name you plug in it. For instance, in Italian you would need different variants according to the grammatical gender of {{name}} and its first consonant group. Some languages have different plurals for 2 and 3+ objects.

It looks challenging to code without extra logic in the source and a big lookup table. As far as I know handling gender is an unsolved issue even for things like gettext (see e.g. http://stackoverflow.com/q/6143547).
Yeah, the only real way to do translation is to use a Turing Complete language (or something very close to it) for generating text. That does not mean that you can separate it from game logic (and it should be!). You "just" have separate per-language functions which you can call with whatever numbers (etc.) need to be there for generating the message.

In C it could either be done by linking different per-language .o files (if you can live with a compile-time language choice), or using pseudo-OOP using a struct of functions which would have different per-language instances (if you want run-time language choice).

Of course, as you say, this is still very hard for something like Angband where there's so much "substitute-monster-name-in-plural-here" stuff going on. However, I think it would be only viable way.

(If you look into the Hengband/Entroband source you'll see another variation based on #ifdef JP for handing different languages. This approach does not scale to large numbers of languages and is completely untenable for maintenance.)
AnonymousHero is offline   Reply With Quote
Old July 18, 2015, 05:49   #19
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,835
Donated: $60
Nick will become famous soon enough
Quote:
Originally Posted by Elsairon View Post
I'm calling this first iteration done. All of the requested messages as far as I can tell are added to the monster_spell.txt file.
OK, I have this incorporated in development now - here is what it looks like if you want to make any changes.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old July 19, 2015, 02:40   #20
Elsairon
Adept
 
Join Date: Apr 2007
Posts: 117
Elsairon is on a distinguished road
As far as I can see, add one line to explain {pronoun} in the header would do it.
Elsairon is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug in Monster/Mon-timed.c mixer Vanilla 2 December 17, 2011 11:25
list experience value in Monster List view fbas Vanilla 1 November 24, 2010 20:51
Spell list in windows? Swede2378 Vanilla 0 June 13, 2010 01:04
Basic Questions: Ball Spell + List Items kicker Vanilla 4 November 16, 2008 21:35
monster list info DaviddesJ Vanilla 1 March 31, 2008 04:10


All times are GMT +1. The time now is 20:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.