Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
cosine_omerta
Wanderer


Joined: 14 Oct 2007
Posts: 50

PostPosted: Thu Dec 04, 2008 5:35 pm   

Simple variables and aliases
 
Recently moved to Cmud, been using zMud for over 10 years. I had set up a very simple set of variables, triggers and aliases to cast spells that had worn off on command. Such as:

Trigger-
You are no longer protected.
#va protected 1

Then when I would hit my alias to cast, which looked like:

#if (@protected = 1) {cast 'armor' self}

It would cast the spell and the message would set the variable back to 0.
This doesn't work in Cmud, and I have been searching through the changes and new features etc helps and I can't see my problem.
The triggers on the messages that sets the variable to 0 and 1 both work, I see the value change back and forth. But for some reason when I use the alias that checks to see if the variable is 1, it automatically goes to 1 and always casts.

If anybody could give me some advice or point out my obvious issue I would be very appreciative.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Dec 04, 2008 5:45 pm   
 
Well there's nothing inherent in CMUD that would cause this to fail. I just tested in a blank session and it worked fine. If you select all the relevant triggers, aliases and variables; Right click and choose copy you'll have the XML for those settings. Paste into the the forums and we should be able to give you more assistance.
_________________
Asati di tempari!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Dec 04, 2008 5:47 pm   
 
Code:

<class name="protection" id="105">
  <trigger priority="1010" id="101">
    <pattern>^You feel someone protecting you.$</pattern>
    <value>#var protect 1</value>
  </trigger>
  <trigger priority="1020" id="102">
    <pattern>^You feel less armored.$</pattern>
    <value>protect=0</value>
  </trigger>
  <alias name="armor" id="103">
    <value>#if (@protect)
{
 #say You are already protected!
}
{
 c armor
}</value>
  </alias>
  <var name="protect" id="104">1</var>
</class>


That's how I did it, same as yours for the most part and that worked.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
cosine_omerta
Wanderer


Joined: 14 Oct 2007
Posts: 50

PostPosted: Thu Dec 04, 2008 5:51 pm   
 
Ok, this is my alias that casts, cut and paste. thanks.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="scorchbuff" autoappend="true" copy="yes">
<value><![CDATA[#if ((@protected = 0) && (@blurred = 0) && (@fireshield = 0) && (@telekin = 0) && (@magprot = 0) && (@displaced = 0) && (@shroud = 0) && (@scry = 0) && (@ginvisible = 0) && (@truesee = 0) && (@prizsphere = 0) && (@shell = 0) && (@manashield = 0) && (@refra = 0) && (@latthard = 0) && (@repulse = 0) && (@vacshroud = 0) && (@chemstab = 0) && (@elecfield = 0) && (@weapattract = 0) && (@armorrepulse = 0)) {#ECHO You are fully buffed.}
#if (@manashield = 1) {mshield}
#if (@protected = 1) {armor}
#if (@blurred = 1) {blur}
#if (@fireshield = 1) {firesh}
#if (@telekin = 1) {telek}
#if (@magprot = 1) {magprot}
#if (@shroud = 1) {shroud}
#if (@scry = 1) {scry}
#if (@truesee = 1) {truesee}
#if (@ginvisible = 1) {ginvis}
#if (@displaced = 1) {displace}
#if (@prizsphere = 1) {sphere}
#if (@shell = 1) {shell}
#if (@elecfield = 1) {field}
#if (@chemstab = 1) {stable}
#if (@repulse = 1) {repulse}
#if (@latthard = 1) {hard}
#if (@vacshroud = 1) {vacshroud}
#if (@refra = 1) {refra}
#if (@weapattract = 1) {attweap}
#if (@armorrepulse = 1) {repulsearmor}]]></value>
</alias>
</cmud>
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Dec 04, 2008 5:55 pm   
 
That's correct code, so something else is the problem. Check that you don't have more than one variable named "manashield" or whatever - if the one variable is set to 1, and the trigger's updating the other variable, then it'll always come out 1. You can click the variable name in the Package Editor to see the variable the script is using.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
cosine_omerta
Wanderer


Joined: 14 Oct 2007
Posts: 50

PostPosted: Thu Dec 04, 2008 5:59 pm   
 
Thats it! The simplest solution always evades me :) For some reason when it imported it slapped an extra set of variables into a different class so it was double toggling it. Thank you for your help!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net