Skip to content

iLua/IMTS coding and scripting megathread

JuranJuran Ohio
edited October 2012 in Scripting
This will probably be the most boring thread on the forum, because I'm relatively certain that I'm the only one still using this architecture.

However, on the chance that I'm wrong I'm happy to help with iLua related coding. It's also likely that Lua related questions could be answered here by the Mudlet guys that might actually be better at the language than me.
«1

Comments

  • edited October 2012
    I tried to use iMapper with IMTS, but I got some weird code garbage every time I moved in a direction, and all the instances of direction words ("northeast", "up", etc) were highlighted in yellow and red color.

    This was with stock IMTS from the sourceforge page and happened no matter the client.
  • JuranJuran Ohio
    edited October 2012

    Whyte released a module for IMTS called iLua that lets someone code Lua straight into the client, setting up their own triggers and aliases by hand. It's a very basic architecture, akin to building a house out of wood planks rather than pre-fabricated wall sections. In the end, the house looks exactly like you want it to - but it takes much longer to build.

    Edit: This can be used as a general IMTS support thread if people want to use it like that, but I know absolutely nothing about fixing IMTS.

  • @Juran: Did you ever get GMCP working?
    Someone powerful says, "Its broken. No more pulling the guillotine."
  • Juran said:

    It's a very basic architecture, akin to building a house out of wood planks rather than pre-fabricated wall sections. In the end, the house looks exactly like you want it to - but it takes much longer to build.

    image
  • edited October 2012
    Going to leave this here, more or less the only useful thing I have left in ilua. Yes, parsing it out with gsubs is about as ugly as it gets, but I wrote it in a hurry and never bothered to make the old ilua version cleaner.
     
    EDIT: Apparently code tags aren't a thing/are broken.
     
    require("curl")

    function alias_handler( input )
    if string.match(input, "^truehonors %w+$") then
    local buffer = {}
    local c = curl.easy_init()
    c:setopt(curl.OPT_CONNECTTIMEOUT,'5')
    c:setopt(curl.OPT_WRITEFUNCTION,
    function (s, len) table.insert(buffer,s) return len end)
    res = c:perform()
    local pat = "Information about %w+ from Imperian.*Pk level: %d+"
    local stuffIwant = ""
    for i,v in ipairs(buffer) do if(string.match(v,pat)) then stuffIwant = string.match(v,pat) end end
    stuffIwant = string.gsub(stuffIwant,"</h3>","")
    stuffIwant = string.gsub(stuffIwant,"<[/]?div>","")
    stuffIwant = string.gsub(stuffIwant,"Imperian","Imperian\n")
    stuffIwant = string.gsub(stuffIwant,"Full name","\nFull name")
    stuffIwant = string.gsub(stuffIwant,"City","\nCity")
    stuffIwant = string.gsub(stuffIwant,"Guild","\nGuild")
    stuffIwant = string.gsub(stuffIwant,"Towne","\nTowne")
    stuffIwant = string.gsub(stuffIwant,"Level","\nLevel")
    stuffIwant = string.gsub(stuffIwant,"Bashing","\nBashing")
    stuffIwant = string.gsub(stuffIwant,"Questing","\nQuesting")
    stuffIwant = string.gsub(stuffIwant,"Pk","\nPk")
    echo(stuffIwant)
    return(true)
    end
    end
    mb.client_aliases = alias_handler
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • Apparently there's a length limit on posts, so sample output will have to go in a separate post, making me guilty of the dreaded double post.

    <700/700h 277/310m 2887e 1309w 24x <eb> <bd> <0> truehonors Lionas

    Information about Lionas from Imperian
    Name: Lionas
    Full name: Lionas Sol'Anlumaire, Redwood Blight
    City: Khandava
    Guild: (none)
    Towne: Kaln
    Level: 106
    Bashing level: 108
    Questing level: 89
    Pk level: 84
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • Is there a version of Andrea's iLua basher around? Don't need it for bashing, rather I'm hoping to start transitioning as much stuff as I can from CMUD to iLua and I tend to learn better when I have examples to take apart. I'm also looking for any scripts that modify lines coming in and any that gag lines(and/or the prompt). Any links that anyone would be so kind as to provide would be very much appreciated.

    If it matters, I'm using Mudbot v2.6 with
     - IMapper    v1.5.
     - IScript    v0.7.
     - ILua       v0.8.
    image
  • edited May 2013
    Some old utility aliases (the only one I still use is truehonors), but the frame for ilua files is also there for you to decipher:

    http://pastebin.com/PrJMY8VA

    EDIT Yes, yes, it uses sloppy lua patterns to parse things, which is A Bad Thing(tm). I never got around to cleaning it up.
    I thought I had the basher lying around somewhere, but I can't find it :(
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • Ever so slightly off topic, but I don't want to revive another dead thread if it's not necessary. I get a lovely little segmentation fault error whenever trying to reboot IMTS. Specifically, I think it's breaking down on "map unload", seeing as I can't use that without having the same lovely crash. Makes mapping a very frustrating process when instead of saving after every room and reloading to clear mistakes, you have to manually remove and relink everything. Have any idea of what specifically is causing it? I'm assuming the problem has come up before for others, so I'd like to avoid digging through code that I only marginally understand just to find an error I'm likely to miss.
    image
  • edited May 2013
    Edit: Hang on. What do you mean exactly with 'reboot IMTS'?

    IMTS generates a 'crash.log' file if possible whenever it crashes. Operative word(s) 'if possible',  It lists in order the last function it entered before the crash.

    If that isn't enough information, you might need to do it the old way and send debug messages to the console or client of the type 'i'm at line __LINE__ and all is well' until you locate it.
  • Labil said:
    If that isn't enough information, you might need to do it the old way and send debug messages to the console or client of the type 'i'm at line __LINE__ and all is well' until you locate it.
    Or attach a debugger.
    I am the righteous one... 
    the claims are stated - it's the world I've created 
  • I honestly never learned how to use a debugger effectively.
  • Y'all wanna see it? I've had this same error since I first compiled the source I found on sourceforge. As stated above, Mudbot 2.6, IMapper 1.5. The only change I would have made, if any, would have been having IMapper dash in cases where there is only one room to move and no other rooms beyond it in line. Don't know if I've changed that in this one or not, but I doubt it matters either way.

    [MB]
    Section - Processing client data.
    [MOD]
    Section - Processing client aliases.
    Module - IMapper.
    [DESC]
    Section - Reading from...
    Descriptor - Client.
    [Buffer:]
    [History:]
     (0) destroy_map
     (1) get_string
     (2) i_mapper_process_client_aliases
     (3) strip_unprint
     (4) module_process_client_aliases
     (5) process_client

    image
  • Yeah, that's some old bug that only happens for Windows. I vaguely recall Juran and I figuring out what it was, but it's completely left me at this point. You'll definitely have to modify the source to do anything about it. If you want to be lazy about it, you could just remove/comment out destroy_map() from i_mapper_module_unload() and that might be enough.
  • Wouldn't that lead to map load not working? I'm trying to regain that lost functionality. And it would really help me if it was telling me what kind of actual error it was having. I guess I'll give destroy_map() a once-over when I get home and see if anything pops out to me. If not, I'll just live with it until such a time as someone remembers what the problem is.

    Wish I wasn't such a C newb. =/
    image
  • Been awhile since I've messed with mudbot but I remember coding a Lua function to handle any file saves and subsequent re-uploads. Though since you are messing with the mapper this method might not work.

  • edited May 2013
    Well, this is curious. Destroy_map always dies destroying a specific room in the Shaahri.

    Meanwhile, what I do instead of loading the map is unloading/loading the MODULE. Would this work for you, Dicene?

    Edit: Ignore the module unload/load part. This version breaks doing that too. Which is interesting, and it is going to make me compare the whole module cvs with my (modified) working one that must be nearly 7 years old.
  • I could try checking on that room in my maps file and seeing if anything is up with it. Room name or vnum?
    image
  • Don't think it will be relevant. I changed the debug message to execute in a different position of the FOR loop and it crashed in a different room.

    For whatever it is worth, free(room) doesn't likes (numbers are the vnums in the default IMap included)

    In the desert. (4781).
    Red-hued desert. (4793)
  • edited May 2013
    So, after comparing the mapper module, I just plainly don't see what is wrong. Technically, the cvs version is freeing less information per room that my current version, yet dies without a clear reason.

    If you are still interested in the mapper module, I can see if my old one is compatible with this version of IMTS and release it.

    I'm interested on some of the changes that Whyte did to the module, and may backport (so to speak) a couple. Maybe along the way I will find what is causing the crash.
  • edited June 2013
    Anyone have a colored log showing the affliction tracker in IMTS? Wanna grab take at look at how it's formatted.
    image
  • Any ideas for compiling IMTS in windows 7/8? It gives this obscure error when I run Dev-CPP:

    Making 'main.o' from 'main.c header.h module.h'...
    Making 'winmain.o' from 'winmain.c header.h module.h winres.h'...
    Making 'winres.res' from 'winres.rc winres.h'...
    Making 'mb-core.exe' from 'main.o winmain.o winres.res'...
    gcc.exe: Internal error: Aborted (program collect2)
    Please submit a full bug report.
    See <URL:http://www.mingw.org/bugs.shtml&gt; for instructions.
    make: *** [mb-core.exe] Error 1
    Press any key to continue . . .
    Which is perhaps less than informative.
  • Downloading and compiling in the most updated MinGW instead of Dev-CPP avoided that error, but caused the code to error in other interesting ways!

    Thanks, at least I have something less enigmatic to work with now.
  • Hmm, will take a look at this. The supposed to be my computer runs Win7 and I haven't tried yet to compile in there, still on XP
  • Making 'i_script.o' from 'i_script.c header.h module.h deps/pcre.h'...
    In file included from i_script.c:36:0:
    module.h:85:7: error: 'gettimeofday' redeclared as different kind of symbol
    In file included from i_script.c:29:0:
    c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/sys/time.h:39:29: note
    : previous declaration of 'gettimeofday' was here
    i_script.c: In function 'instr_doall':
    i_script.c:4268:67: warning: operation on 'i' may be undefined [-Wsequence-point
    ]
    Makefile.win:51: recipe for target 'i_script.o' failed
    mingw32-make.exe: *** [i_script.o] Error 1
    Press any key to continue . . .
    I have no idea what this might even begin to mean, it was compiling just fine before!
  • Could use some help getting Mudbot to accept a new prompt i would like to use, help would be really nice for this :)

    Prompt i would like to use = <*h/*Hh *m/*Mm *B <*b*l> <*i> <Kai: *k | Devotion: *d | Fanatism: *f> XP: *x >

    Prompt from Options file i don't know.

    P "^x<^1%h^x/^g%H^xh ^2%m^x/^g%M^xm ^3%e^xe ^4%w^xw ^g%x^xx ?k{^5%k^xk }<?e{^ge^x}!{-}?b{^gb^x}!{-}?l{^gp^x}!{-}?r{^gp^x}!{-}>?A{ <^r}?H{h}?S{s}?P{p}?C{c}?T{t}?F{f}?U{b}?W{w}?A{^x>}?a{ <^Y}?p{p}?f{f}?B{b}?d{d}?s{s}?t{^b%t^Y}?L{^Gl^Y}?M{^Rl^Y}?a{^x>}?D{ <^r%D^x>}>^x "

    But i need the prompt i want to be used in the options file instead of that one.
  • Have you looked at HELP CUSTOM PROMPT at all? Your desired prompt would be trivial to make with the in-game prompt setup.

    "On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."

  • i did make that custom prompt in-game, but i need mudbot to "approve" of the prompt as well, that's what I'm asking help with.
  • Super old thread revival!

    Does anyone know how to make or have a source for an IMTS with only the mapper? I've used it since... probably 2 months after I started playing, but I've never had the need to mess with anything inside it.
    image
Sign In or Register to comment.