I'm working on what I'd like to call a smart spell translation script. This means that using the rom translation keys, i can translate all spells to readable words, even if they add new spells. I've got the full list of what rom uses to translate a spell into the arcane words. Such as Cure Light = Judicandus Dies. But I'm having some trouble getting this to work, I don't know where to start to get just the spell to translate, without translating the whole mud.

Do all your translations in a single trigger. This eliminates the problems of repeated translations. Next do all your translations as a single #SUBSTITUE, this would be accomplished by nesting %replaces inside a %subchar. The list you have for %subchar needs some work though:

Note the "a=a" and 15 or so lines down "a=o". You would have to first build the series of %replaces for the syllables and then coordinate them with your subchar list. Some syllables may even need to be mistranslated to work within the %subchar.

_________________The only good questions are the ones we have never answered before.
Search the Forums

could you please elaborate a little further? and the way i got that list was by taking what it becomes and reversing it, i never paid attention to the fact that the a and the o are both a's any idea how i can get around that?

but what i mean by translating it, without it being retranslated is when i've alreayd had dies translated into light, i don't have light retranslated later on when the single letters come into play.

As Viji says you have an issue, the code above provides the final output and of course it has no duplicates going from english to garble. You would however have to decide when going from garble to english what to do with the duplicates, it may well be that it was done on purpose in order to defeat automatic translation back to english or you may find that if you do the words first followed by any remaining letters there may be no issue.

But therein lies the issue...how? I've pretty much figured that part out, but I'm trying to go about figuring out how to do so without retranslating the words back into some extra garble. Is there maybe a way to move a word from one variable to another after it's translated?

I would translate by taking the string using a character at a time to build up a substring to see if it matches any known syllable when it does this can be knocked off your original string for building the substring and the translated match put in a new variable, carry on. If there are no matches then take the first character and do a character translation put this in a new variable and remove the character from your original string then follow through the whole process again with the remaing string. Eventually you end up with a translated string but nothing was ever worked on more than once. You see the issue of using %replace is that for simplicity you need to nest it relying on the fact this won't do repeated replaces or use a much more extended method of removing the substring that matched the first replace but keep its position in the original string in order that further replaces don't get added to your new string in the wrong place.

Personally I wouldn't bother, you say you've worked out the translation table yourself so in this case you more than likely already know just by looking at the strings what they really mean, won't that suffice it does for most people, do a net search and you'll find most people rely upon learning what they mean over time.

I'm onto something, but I may need some help. I'm thinking using deletes and inserts to remove and re-add the text into a new variable, but one question is this. how do i do this so that when the text is removed and it's position recorded, it won't mess up when inserted since insert follows this:

Syntax: %insert(p,s,i)

return the string s with string p inserted at position i.

if i could get this and a delete in conjunction with each other, i may have solved my problem cuz i've already ported from a datarecord variable into two arrays instead and can loop through the text to replace instances of the value of the first array with the value from the second.

also i bumped into %word, is there anything maybe that can be done with this?

i know that the for in zmud isn't all that intensive, but using the arrays this could probably be done, but i'm still wondering what the str_prefix is and how it's populated, and what it does. I have figured out that the skills are run through here by their skillnum, so I know where i can put the variable in, to get the string, but i need to figure out how to take the code above and turn that into what they're doing.

well this is what i'd come up with at work yesterday, much less intensive than vijilante's and it semi-works. if the spell is one word, it works like a charm. but if it has more than one word it gets all screwy.

when someone say utters the words yrl or gpuzre i get fly and shield, but when they cast a spell that has two or more words it only ends up showing the first word with as many spaces as the whole spell has ex: judicandus dies comes out cu re. any idea what may be causing this?

[edit] i've got it translating all the words, but for some reason now it turns out as cu re light. bah, something about this still isn't right, refresh ends up coming out rem. I'm getting close, but something still isn't quite right.

I know what's causing all my abnormalities, well except for the cu re light thing. Is there some way to break from a loop if you've met your condition? Or is there some way to set up a loop that will only go til %pos( %arrget( arcan, %i) =1) is met, then break from that and go back through until it finishes the until loop?

I just tried out vijilante's code too. After much tweaking I finally got it to run, but strangely enough it still doesn't solve the problem. No matter what spell i put through the ringer it errors out.

Oddly, I never put any sort of catch in for spaces in that code. Also as I say it is off the top of my head (hence no testing and likely errors), and as my first post to this topic mentioned there is at least one character that does not reverse properly. The function you are trying to reverse is not 1 to 1 and there will always be errors in translating if you create a general function.

I seriously have no interest in solving this problem, because I know the #SUBSTITUTE's will be a further problem. If you really want to #SUB the text make a series of triggers, if you want a #SHOW to follow with the translation work off what I posted.

_________________The only good questions are the ones we have never answered before.
Search the Forums

a substitution won't be any sort of problem, i'm just trying to generally get it working, and with yours even without spaces it doesn't work right, given yrl it should come out with fly but it just errors out :( I may end up having to give up on this one and go back to the dumb spell translator, but at least i can say i've learned quite a bit during this trip. I think with the current abilities of zScript it's not possible, but if zmudxp has some more of the standard loops, or maybe even add to the msscript to allow for c coding it could quite possibly be possible then.

that's pretty good and all, but most of that i've already commited to memory. that's why i wanted to make a smart spell translation tool, so that if they made a new spell not on anyones list i could already have means of translation for it.