Sharing script across characters

Post Reply
okkita
Posts: 8
Joined: Mon Feb 03, 2014 2:05 pm

Sharing script across characters

Post by okkita »

I play multiple characters and would like them all to share the same script, with certain small differences between them. I.e. they all use the same wield/unwield core functions, but are configured to use different weapons depending on the character.

When playing I often improve/modify the scripts and I would like these changes to propagate to all of my character profiles. I guess what I am after is some sort of shared library that can be updated on the fly by any of the profiles that use it. I don't play the different characters at the same time, so this doesn't need to happen in real time.

Is this possible? How would one go about achieving this?

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Sharing script across characters

Post by Jor'Mox »

I achieve the same sort of functionality by having only one profile, and having a table that I save with character related info.

okkita
Posts: 8
Joined: Mon Feb 03, 2014 2:05 pm

Re: Sharing script across characters

Post by okkita »

How do you know which character is in play?

Mind to share a small example of that table?

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Sharing script across characters

Post by Nyyrazzilyss »

I've got a script i've been writing for the mud I play. At this time it's about half done, with class specific triggers that run depending on what character is logged in.

Doing something like that is going to be very specific to the mud you intend to use it with. Example being: Does your mud have a command that will tell you who you are?

The first line of the score command in the mud i'm referring to returns 'Score information for Nyyrazzilyss'. I have a trigger that uses that information to determine what character is logged in. I have a local function 'whoami()' that would return 'Nyyrazzilyss' if that was the character that's logged in, from information that was previously populated by the trigger.

I also keep a local database of what character name = what class. When a trigger is called, it verifies what class the logged in character is, and decides whether to execute or not.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Sharing script across characters

Post by Jor'Mox »

So, I determine the character in play by using a trigger that fires off of the welcome message when I get logged in, and sends "whoami", which is a command in game that tells you the name of the current character. Before I was aware of that command, I had it check my score, and get the name from that.

As for sharing the table, I actually have it in place as a central script as part of a larger script package, which allows any data I want to be stored on a per character basis. So, I interface with it via getCharData(key) and setCharData(key, value) functions, and the script takes care of the legwork of saving things and such as needed. Among other things, I store name, class, race, level, all currently used equipment, and a wide range of character specific values to control the behavior of my other scripts. As such, I never actually SEE the table.

But, I have helped several people who use my script package to write custom aliases and such based on the currently logged in character, and you could easily even have custom triggers for each character, with something in place that detects a new login, and then creates some temp triggers and/or aliases specific to that character, and disables any that it is currently tracking (that don't belong with the character currently logged in). Obviously the actual syntax would be different, since you wouldn't be using my rather extensive set of scripts that are specific to the game I play, but I can definitely help you get things working in your own setup if you would like.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Sharing script across characters

Post by Vadi »

If you'd like to use multiple profiles for this, you can use Mudlet modules to share common code across profiles.

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Sharing script across characters

Post by SlySven »

It is an intention of mine to add lua functions to inform a script of the name entered into the "Character name" field by the user and whether a password is stored there (but NOT to actually return that password) for the profile in which it is run.

In conjunction with this I also want to add commands to send each of those to the MUD server (without echoing them on-screen or allowing them to be logged) and to providing a means to opt out of sending them automatically as the connection is made to the MUD Server. Overall this would provide a script with the option to have more control over the login process (and possibly re-login in after disconnection) as there are MUDs that provide interactive menus on connection before a character is "activated" - this is especially true on the first time log in to a MUD Server when you have not yet created the character name and password.

Actually, this would also allow a common profile to instead send one of several character name/passwords stored locally using perhaps sendRaw( "string", false ) though then it would be up to the script to keep track of the character that has been activated...

Post Reply