Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Variables

Variables

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Val   (27 posts)  Bio
Date Sat 12 Mar 2011 01:10 PM (UTC)
Message
Hi

Two things I am trying to do though I'm not sure if its possible.

I want a miniwindow to show my target or whatever variable I like instead of the status line, though I'm unsure how to do this.

Also can the keypad be adjusted to send a variable, so if I press 0 it will 'cast @thespelliwant on @target'?

It may of been mentioned in the past and I have searched, but can't find it, if you can point me in the right direction it would be appreciated.

Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 13 Mar 2011 12:11 AM (UTC)
Message
Val said:

I want a miniwindow to show my target or whatever variable I like instead of the status line, though I'm unsure how to do this.


Template:function=SetStatus SetStatus

The documentation for the SetStatus script function is available online. It is also in the MUSHclient help file.




Val said:

Also can the keypad be adjusted to send a variable, so if I press 0 it will 'cast @thespelliwant on @target'?


I think the simplest way to do this is to make an alias, like this:


<aliases>
  <alias
   match="keypad_0"
   enabled="y"
   expand_variables="y"
   sequence="100"
  >
  <send>cast @thespelliwant on @target</send>
  </alias>
</aliases>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Now set keypad 0 to send "keypad_0".

The alias catches that, and sends the spell you want.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Val   (27 posts)  Bio
Date Reply #2 on Sun 13 Mar 2011 12:22 AM (UTC)
Message
Thank you for the keypad_0, works well.

I already use the status line, and wanted to see if I could place that information on a miniwindow instead, just a little more noticeable for me

Also if you use the statue line for something else, the last piece of information on it goes, so if I want to have a few things on it, I would have to make the statue line quite long -

Target : attacker / Spell Magic missile / Exits north southwest,,

you get the idea, I know you can make the exits go on a miniwindow, just would of been nice to see the target and spell on it and make it a little bigger and brighter.

It's no biggie though

Thanks for the above, appreciated


Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 13 Mar 2011 01:32 AM (UTC)
Message
This video shows how to do that:

http://www.gammon.com.au/forum/?id=9626

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Val   (27 posts)  Bio
Date Reply #4 on Sat 19 Mar 2011 02:05 PM (UTC)

Amended on Sat 19 Mar 2011 02:29 PM (UTC) by Val

Message
Hi

I have two variables, target and spellname.

The code for target works well enough, I managed to make a small window where the target is displayed (though I have not mastered moving it yet).

My problem is some spells are cast on the character, though I have managed to alter the variables in the spell to do this, I cannot get the miniwindow to refresh to show the new variable (me).

this is what I have to target -

SetVariable ("target", "%1")


local spellname1 = GetVariable("spellname1")
local target = GetVariable("target")

ColourNote ("white", "blue", "Spell is still: " .. spellname1)
ColourNote ("white", "blue", "Target is now: " .. target)

SetStatus ("Target: " .. target, " / Spell: " .. spellname1)

win = GetPluginID ( ) .. ":targetwindow"

font = "f"

WindowCreate ( win, 0, 0, 1, 1, 9, 0, 0)

WindowFont ( win, font, "Couier", 10)

height = WindowFontInfo ( win, font, 1) + 10

width = WindowTextWidth ( win, font, "Target is: " .. target) + 10

WindowCreate ( win, 0, 0, width, height, 9, 0, ColourNameToRGB ( "salmon"))

WindowText ( win, font, "Target is: " .. target, 5, 5, 0, 0, ColourNameToRGB ( "yellow"))

WindowShow ( win, true)

Typing in t attacker will set that target and ill appear in the miniwindow

And this is for my spells so typing arm gives-

SetVariable ("spellname1", "armor")

SetVariable ("target", "me")

local spellname1 = GetVariable("spellname1")
local target = GetVariable("target")
SetStatus ("Target: " .. target," / Spell: " .. spellname1)

ColourNote ("white", "blue", "Spell is now: " .. spellname1)
ColourNote ("white", "blue", "Target is still: " .. target)

world.Execute ("t " .. target (just added after I first made this post)

Though the spell and targets are correct and it works when I cast the spell, I cant get the targetwindow to refresh.
I've tried WindowShow ("targetwindow", true) which does not come up with an eror, but it does not refresh the target window.


Any advise on where I'm going wrong?


For the moment I'm using - "world.Execute ("t " .. target) at the end of the spellname alias (just discovered it after writing this) I would like to know if there is a better method

Thanks
Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #5 on Sun 20 Mar 2011 01:29 AM (UTC)
Message
To save me trying to put all that together to test it, can you please copy the two aliases like this? ...

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Val   (27 posts)  Bio
Date Reply #6 on Sun 20 Mar 2011 11:00 AM (UTC)

Amended on Sun 20 Mar 2011 11:04 AM (UTC) by Val

Message
Hi

Hopefully as below

This is my target


<aliases>
  <alias
   match="t *"
   enabled="y"
   expand_variables="y"
   group="Target"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable ("target2", "%1")


local spellname1 = GetVariable("spellname1")
local target2 = GetVariable("target2")

ColourNote ("white", "blue", "Spell is still: " .. spellname1)
ColourNote ("white", "blue", "Target is now: " .. target2)

SetStatus ("Target: " .. target2, " /  Spell: " .. spellname1)

win = GetPluginID ( ) .. ":targetwindow"

font = "f"

WindowCreate ( win, 0, 0, 1, 1, 9, 0, 0)



WindowFont ( win, font, "Couier", 10)
  
height = WindowFontInfo ( win, font, 1) + 10

width = WindowTextWidth ( win, font,  "Target is: " .. target2) + 10



WindowCreate ( win, 0, 0, width, height, 9, 0, ColourNameToRGB ( "salmon"))

WindowText ( win, font, "Target is: " .. target2, 5, 5, 0, 0, ColourNameToRGB ( "yellow"))

WindowShow ( win, true)

</send>
  </alias>
</aliases>


This is one I use to cast on a me



<aliases>
  <alias
   match="arm"
   enabled="y"
   expand_variables="y"
   group="mage"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable ("spellname1", "armor")


SetVariable ("targetme", "me")

local spellname1 = GetVariable("spellname1")
local target = GetVariable("targetme")
SetStatus ("Target: " .. targetme," /  Spell: " .. spellname1)

ColourNote ("white", "blue", "Spell is now: " .. spellname1)
ColourNote ("white", "blue", "Target is : " .. targetme)
</send>
  </alias>
</aliases>


and this is one for a mob


<aliases>
  <alias
   match="aa"
   enabled="y"
   expand_variables="y"
   group="mage"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable ("spellname1", "acid arrow")



SetVariable ("targetme", "not me")

local spellname1 = GetVariable("spellname1")
local target2 = GetVariable("target2")
SetStatus ("Target: " .. target2," /  Spell: " .. spellname1)

ColourNote ("white", "blue", "Spell is now: " .. spellname1)
ColourNote ("white", "blue", "Target is still: " .. target2)

world.Execute ("t " .. target2)</send>
  </alias>
</aliases>


This is to let me use one alias to cast spells where it knows the difference between spells I cast on me and mobs with an option of casting a spell normally for me (a heal) to a friend, hence the if post I made


<aliases>
  <alias
   match="keypad_0"
   enabled="y"
   expand_variables="y"
   group="cast"
   send_to="12"
   sequence="100"
  >
  <send>

local x = GetVariable("targetme")

local spellname = GetVariable("spellname1")
local targetme = GetVariable("targetme")

local target2 = GetVariable ("target2")

if x == "me" then Send ("cast "  .. spellname, " on " .. targetme)

else
Send ("cast "  .. spellname, " on " .. target2)
end
</send>
  </alias>
</aliases>


With this done I will have to figure out how to move the target box in the 't *' and then see if I can master the inventory problem I have with the line.

Thank you for your help
val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #7 on Sun 20 Mar 2011 08:39 PM (UTC)
Message
It changed for me. What I suspect is happening is that you have two miniwindows, one on top of the other, and the one underneath is changing. Try closing the world completely (to get rid of the windows) and try again. I moved the target to the top right corner by changing the position parameter:


<aliases>
  <alias
   match="t *"
   enabled="y"
   expand_variables="y"
   group="Target"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable ("target2", "%1")


local spellname1 = GetVariable("spellname1")
local target2 = GetVariable("target2")

ColourNote ("white", "blue", "Spell is still: " .. spellname1)
ColourNote ("white", "blue", "Target is now: " .. target2)

SetStatus ("Target: " .. target2, " /  Spell: " .. spellname1)

win = GetPluginID ( ) .. ":targetwindow"

font = "f"

WindowCreate ( win, 0, 0, 1, 1, 9, 0, 0)



WindowFont ( win, font, "Couier", 10)
  
height = WindowFontInfo ( win, font, 1) + 10

width = WindowTextWidth ( win, font,  "Target is: " .. target2) + 10



WindowCreate ( win, 0, 0, width, height, miniwin.pos_top_right, 0, ColourNameToRGB ( "salmon"))

WindowText ( win, font, "Target is: " .. target2, 5, 5, 0, 0, ColourNameToRGB ( "yellow"))

WindowShow ( win, true)

</send>
  </alias>
</aliases>



Oh, and you misspelt "Courier" as "Couier". That won't give you Courier.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Val   (27 posts)  Bio
Date Reply #8 on Sun 20 Mar 2011 11:41 PM (UTC)
Message
Hi

The aa alias will change it because of the world.Execute ("t " .. target2) but the arm alias won't change it, and if I try world.Execute ("t " .. targetme) then it changes the variable target2 as well.

So by going 't attacker' target2 changes to attacker, when I go arm, I get -targetme me- but if I add the world.Execute as above and use arm alias then target2 also becomes me

I was thinking if it was a WindowShow or some kind of refresh command it might help

And thanks the Courier, never noticed, too busy looking at the program itself

Val
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #9 on Mon 21 Mar 2011 01:05 AM (UTC)
Message
Val said:

... but the arm alias won't change it ...


The arm alias doesn't change the miniwindow at all.

I think you are getting into a bit of a muddle here. You really want a function (or an alias maybe) that simply updates the miniwindow. Then call that from various spots.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Val   (27 posts)  Bio
Date Reply #10 on Tue 22 Mar 2011 11:43 AM (UTC)
Message
Hi Nick

Yes thats what I want, a means of refreshing the window, though I dont know how to go about it, any chance of pointer please?

Thank you
Val
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


33,897 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.