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
albo
Apprentice


Joined: 27 Mar 2008
Posts: 106

PostPosted: Mon May 04, 2009 7:12 pm   

not sure what happened
 
Code:

#Alarm "alarmid" {+2} {
  #if (variable=0) {
    variable=@variable
    #exec %pop( variable)
    }
  #exec %pop( variable)
  } class name here



This does not work anymore. I have tried it in both zMUD and cMUD. cMUD deletes the trigger before actually inputing any commands..and I think zMUD was deleting if after inputing the second set of commands.
It worked just fine before I installed cMUD.


cMUD is confusing me with how to enable and disable a class.

#class class name here 0 like this?

#class {class name here} 0 like that? or how? have tried quite a few it still just creates its own folders and deletes my old one with all the things i'd not like to have deleted.

I found out what I was doing wrong with enabling and disabling classes: in cmud the correct syntax to enable or disable a class is:
Code:

#class classname value

which is of course simple. however it does not say that there can be no spaces in your class folder names if you plan on enabling/disabling them. simply taking out all the spaces in the names of your class folders makes it very easy to enable/disable them.

Another issue I am having:
Code:

trigger type="Alarm" priority="6420" id="642">
  <pattern>Exits:</pattern>
  <value>#ALARM Alarmid {+2} {#exec %pop(variable)} classname</value>
</trigger>


Is that this is supposed to trigger of the pattern Exits:, any trigger I make like this is just deleting itself before it gets a chance to %pop anything. cMUD is pretty cool, but this is becoming a pain. I've had to rewrite nearly everything from old zMUD scripts and in doing so have somehow disabled anything from working in zMUD and it seems quite a bit of the stuff I wrote in cMUD is wrong. The creating/deleting of my class folders is the most annoying, and the deleting of my alarm/triggers is second most annoying.

I am also trying to do my alarm/triggers like this:
Code:

trigger name="alarmid" priority="15630" id="1563">
  <pattern>Exits:</pattern>
  <value>#ALARM "alarmid" {+2} {#switch (%class(classname)) {#execute %pop($localvariable)}</value>
</trigger>

Of course this will be quite larger, as there are around 30 different classes it is going to have to check and see which one is enabled before it knows which local variable to %pop.

With this loading the local variable, which will be in the same class folder as the above trigger:
Code:

trigger priority="8450" id="845">
  <pattern>a one line pattern to match from MUD</pattern>
  <value>#class {classname} 1
#class {classname} 1
#class {classname} 1
#class {classname} 1
$localvariable=@variablestringlist</value>
</trigger>
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Mon May 04, 2009 8:36 pm   
 
From: http://forums.zuggsoft.com/modules/mx_kb/kb.php?page=3&mode=doc&k=2433

Quote:
The #CLASS command can also be used to set the "default class". The default class is used whenever a setting is defined without specifying a class name. Normally the default class is <None>. To set the default class, use #CLASS with a single argument, which is the name of the class you want to set as the default. To return to the <None> default, use a classname of "0" (zero).


You can also use #t+ and #t- to enable/disable settings.

You might also want to be careful using spaces in class names, many people just use an underscore in place of spaces. On that note, I can't recall seeing a list of valid characters for setting id/names, but the examples only seem to use a-zA-Z.
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
albo
Apprentice


Joined: 27 Mar 2008
Posts: 106

PostPosted: Mon May 04, 2009 8:45 pm   
 
what about the usage of local variables? can I load a local variable with a string list from a permanent variable and then #exec %pop(of that local variable i just loaded) every time i see Exits:?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon May 04, 2009 9:01 pm   
 
Don't use spaces in class names.

As wrym says, the #t+ and #t- commands are the usual way to enable or disable classes or triggers.

In your code:
Code:
trigger type="Alarm" priority="6420" id="642">
  <pattern>Exits:</pattern>
  <value>#ALARM Alarmid {+2} {#exec %pop(variable)} classname</value>
</trigger>

You have this as 'type="Alarm"'. That is obviously not what you want, since you also have a trigger pattern. That is why this is not working.

In your code:
Code:

trigger name="alarmid" priority="15630" id="1563">
  <pattern>Exits:</pattern>
  <value>#ALARM "alarmid" {+2} {#switch (%class(classname)) {#execute %pop($localvariable)}</value>
</trigger>

You have the wrong syntax for the #switch command. You can't simply use (%class(classname)), you need to use something like (%class(classname) = 1). You are also usin a local variable, $localvariable, but you are not defining the variable. A local variable $localvariable only exists within the specific script in which it is defined, unlike the global variable @globalvariable.

You seem to be doing some very odd and complicated stuff. Perhaps it would help us if you told us what you are actually trying to do.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Mon May 04, 2009 9:04 pm   Re: not sure what happened
 
albo wrote:
Code:

#Alarm "alarmid" {+2} {
  #if (variable=0) {
    variable=@variable
    #exec %pop( variable)
    }
  #exec %pop( variable)
  } class name here



Your IF is wrong there. You need to have @ before variable name inside of If call.

albo wrote:

trigger type="Alarm" priority="6420" id="642">
<pattern>Exits:</pattern>
<value>#ALARM Alarmid {+2} {#exec %pop(variable)} classname</value>
</trigger>
[/code]


You can't have an Alarm like this. Maybe you wanted to choose Pattern option instead? Alarm can only have numerical value
and be either temporary (+time_amount) or the opposite (*time_amount).
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue May 05, 2009 6:55 pm   
 
Quote:
what about the usage of local variables? can I load a local variable with a string list from a permanent variable and then #exec %pop(of that local variable i just loaded) every time i see Exits:?

You can load a local variable with a string list from a permanent variable, and you can %pop it, but as soon as that trigger is finished executing, the local variable will disappear. It only exists while that trigger is executing.
Reply with quote
albo
Apprentice


Joined: 27 Mar 2008
Posts: 106

PostPosted: Wed May 06, 2009 2:03 am   
 
thanks everyone. the Exits: trigger was still giving me some problems even after changing it back to patter, and I finally got it working. I had to remove the classname off the end of it and it started working very well. The only problem I see now is that it will create a class folder that looks like this:
Code:

{mercenaryaringill}(0)

Not sure whats up with that.
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