User Tools

Site Tools


sharedvalue_example

Set Shared Value

Misc.SetSharedValue("Key", "Some value set for key")

Get that Shared Value

test = Misc.ReadSharedValue("Key")
# test should now contain "Some value set for key"

Example Usage

In practice I use this to dynamically affect script behavior.

For instance I have a fight script that I want to sometimes use whirlwind and sometimes use momentum based on the fighting situation. I don't want to stop mid fight and change the script, and I don't want to copy the whole script just to get this ability to change behavior.

In my fight script I have:

if Misc.CheckSharedValue("UseMomentum"):
    use_momentum = Misc.ReadSharedValue("UseMomentum")
else:    
    use_momentum = True
if use_momentum and (not Player.SpellIsEnabled('Momentum Strike')):    
    Spells.CastBushido('Momentum Strike')
    Misc.Pause(500)
else:
    Use_weapon_special(weapon)

Then, in another script attached to a hot key:

if Misc.CheckSharedValue("UseMomentum"):
    Misc.SetSharedValue("UseMomentum", not(Misc.ReadSharedValue("UseMomentum")))
else:    
    Misc.SetSharedValue("UseMomentum", False)

Mobiles.Message(Player.Serial, 5, "Use Momentum: {}".format(Misc.ReadSharedValue("UseMomentum")))
sharedvalue_example.txt · Last modified: 2025/02/25 22:20 by 127.0.0.1

Exception: Git command failed to perform periodic pull: hint: Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch this message by running one of the following hint: commands sometime before your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. Warning: Permanently added 'github.com,140.82.113.3' (ECDSA) to the list of known hosts. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0670 for '/var/www/html/dokuwiki/data/dokuwiki' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "/var/www/html/dokuwiki/data/dokuwiki": bad permissions git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

Exception: Git command failed to perform periodic pull: hint: Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch this message by running one of the following hint: commands sometime before your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. Warning: Permanently added 'github.com,140.82.113.3' (ECDSA) to the list of known hosts. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0670 for '/var/www/html/dokuwiki/data/dokuwiki' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "/var/www/html/dokuwiki/data/dokuwiki": bad permissions git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the gitbacked plugin.

More info has been written to the DokuWiki error log.