Page 1 of 1

tabs and mudlet

Posted: Mon Jan 21, 2019 9:22 pm
by quentinnuk
I see this has come up before but what I read suggests its resolved but doesn't seem to be the case for me.

The MUD i am playing outputs a score with tabs in it; eg as shown on a plain telnet client:

Code: Select all

*score
Score to date: 41019
Level of experience: necromancer
Strength: 100	Stamina: 96	Dexterity: 100	Sex: male
Maximum stamina: 100
Weight carried: 0g (max. weight: 100000g)
Objects carried: 0 (max. number: 12)
Games played to date: 45
*
The gaps between Strength, Stamina, Dexterity and Sex are separated by tabs. On Mudlet these display like this:

Code: Select all

sc
Score to date: 41019
Level of experience: necromancer
Strength: 100                Stamina: 91                                                       Dexterity: 100                       
Maximum stamina: 100
Weight carried: 0g (max. weight: 100000g)
Objects carried: 0 (max. number: 12)
Games played to date: 44
*
Sex is lost off the edge of the window and the tab spacing is all wrong. Does anyone know how to fix this? Im on mudlet 3.16.1 on MacOS

THanks

Re: tabs and mudlet

Posted: Tue Jan 22, 2019 3:18 am
by SlySven
IIRC you should be able to fire trigger off of the tab character - sounds like you need something to replace each one with just a space or two...

Re: tabs and mudlet

Posted: Tue Jan 22, 2019 6:07 am
by Vadi

Re: tabs and mudlet

Posted: Tue Jan 22, 2019 3:17 pm
by quentinnuk
Thanks Vadi, It does a job, but is not perfect as it is replacing tab characters with 8 spaces whereas it should really be moving to the next mod 8 column.

Re: tabs and mudlet

Posted: Tue Jan 22, 2019 3:22 pm
by Vadi
That's kind of harder to do. Ideally the game just sends spaces instead and does the formatting itself...

Re: tabs and mudlet

Posted: Tue Jan 22, 2019 3:26 pm
by quentinnuk
I found another solution in the forums which works perfectly:

Code: Select all

local pos = selectString("\t",1)
while pos ~= -1 do
   replace(string.rep(" ",8 - math.fmod(pos,8)))
   pos = selectString("\t",1)
end