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
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Wed Jun 18, 2008 12:03 am   

Cmud 2.27 - %1-%99 temporarly variables
 
Hello,

I'm writing here, because I've got problems with scripting under Cmud. My problem is based on change in Z/Cmud language, where %1-%99 variables was excluded. Everything would be fine, but i don't know what to use instead of it. It isn't right, that syntax was uncomfortable. Being honest I miss it. Most of my scripts was based on that variables in patterns.

Now i would like to make a simple script like:

Trig {You are @condition} {
#stw %db(@condition, %1)
}

and I can't.

By the way, something wrong is with #STW command. Under Zmud, data were refreshing in status window, under Cmud aren't.
Data are creating log with given Trig, duplicating entries of Status Bar in config, every time the Trig is called by me, or system.
I know, that problem can be funy, but i bought Cmud thinking it will be faster, greater and so on. Of course it is, but the cost of it is less comfortable scripting.
And 1 more bug report.
Cmud has got problems with importing data from Zmud(ver. 7.21) configuration file. For example, places of buttons are diffrent than in original. And Cmud got few files in main directory responsible for configuration of Cmud. Witch one should be treated as the most important? with *.pkg extension? Or *.mud? Behaviour of tehm are so much different. Both are configuration files.
Sincerely

D. Jaszewski

[edit]
The way of scripting under Zmud was in my opinion more comfortable too because of...its view. In Zmud I could see all of script I wrote. In Cmud I see just parts of it.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 18, 2008 12:42 am   
 
What do you mean by "seeing parts of it"? It's not like anything's hidden in CMUD, and you actually have more space to see the script run by an alias or trigger than you did in zMUD. So what exactly do you mean?

Placement of buttons has changed because the system that controls windows (and thus the button toolbars attached to them) in CMUD is totally different to the one in zMUD. It doesn't take a lot of effort to put them back in their places.

Also, for clarification, .mud files are used by zMUD, and .pkg files are used by CMUD. If you open a .mud file in CMUD, it's automatically converted into a .pkg.

The behaviour of #stwin has changed slightly. Now, a new item is created when you run it unless the ID of the new definition matches an old one. So, to get your status items overwritten, you do

#stwin string "" UniqueID

where UniqueID is some unique string that identifies that one status window definition. Every time you want to update that particular status window definition, you use the same ID.

However, if you're using variables in the status window (including %db(@var,key)), you don't need to update the status window every time a variable changes. The window will automatically be updated to reflect the new value of the variable.

Finally, your original question, which is a simple matter of incorrect syntax. You mean {@condition} in your trigger pattern, not @condition on its own.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Wed Jun 18, 2008 1:13 am   
 
"seeing parts of it" means I don't see all class with built in Triggers, Variables, Aliases etc. . Maybe that view you are talking about should be enabled somewhere, but I tried to find option which could change the look of all Class and I didn't find it. In Cmud i see the tree of all built components.If i want to check it, I have to highlight it. In Zmud if you highlighted the class, you saw the code. And I miss that view.

About buttons. It isn't so simple tu put buttons in correct places when you've got creating itself buttons. The way you can order buttons in Cmud is more chaotic, more difficult to understand, to forecast the final effect.

#stwin,
Maybe I'll explain what I was talking about with details.
On my mud, to check the condition, I have to write: condition. I've got it under macro.
After pressing of that, values of conditions in variables are changing. So I have to use the Trigger every time, during pressing the macro. When you are fighting with NPCs, the frequency of pressing is more than often. And each pressing of macro is duplicating the entry of STWIN in Cmud config. But I'll try to check that uniqueID, maybe it will solve my problems - didn't check it.

I use %db function, because I use Table Variable(matrix) with two columns.
The Trigger catch the right(source) value, then I want to change it to ASCII signs and put it into STWIN:

You are in GREAT condition -> catching GREAT -> comparing with Variable -> getting the symbol from Variable
Code:

GREAT|####

using %db(@var,%1)

So, the problem isn't refreshing data from variables, but data from MUD. To refresh data in STWIN I have to use Trigger once again by pressing the macro. And each pression of macro is equal to duplicate STW entry in config.
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Wed Jun 18, 2008 1:43 am   
 
I'm having a hard time seeing what should be replacing %1 in this? You are catching your condition in the @condition variable, then doing what exactly with it? Just displaying the condition in the status window? Is there some value associated with the condition (such as that #### syntax you just used)?
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Jun 18, 2008 4:48 am   
 
Nayuko wrote:
"seeing parts of it" means I don't see all class with built in Triggers, Variables, Aliases etc. . Maybe that view you are talking about should be enabled somewhere, but I tried to find option which could change the look of all Class and I didn't find it. In Cmud i see the tree of all built components.If i want to check it, I have to highlight it. In Zmud if you highlighted the class, you saw the code. And I miss that view.

Not exactly what are you want, but you can use xml view in the editor. It shows all settings for highlighted item in the tree. If you highlight a class, you will see all settings of that class in one piece. You may highlight windows and root package entry in the tree as well.
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Wed Jun 18, 2008 7:30 am   
 
Dumas wrote:
I'm having a hard time seeing what should be replacing %1 in this? You are catching your condition in the @condition variable, then doing what exactly with it? Just displaying the condition in the status window? Is there some value associated with the condition (such as that #### syntax you just used)?


I used %1 to connect with coresponding value in variable. In Trigger I use as a pattern Variable @ condition, that is a table Variable:
Code:

GREAT|####

I catch in a Trig GREAT and replace it with #### in status window.

Arde wrote:

Not exactly what are you want, but you can use xml view in the editor. It shows all settings for highlighted item in the tree. If you highlight a class, you will see all settings of that class in one piece. You may highlight windows and root package entry in the tree as well.


The xml editor isn't comfortable as the view of script's editor. The tags do a mess. So I regret it is impossible to switch the view to Zmud's like.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 18, 2008 9:20 am   
 
That's because some of CMUD's setting options aren't very well-geared towards the old TINTIN-like syntax. Script languages, for example, and new options like appending and parsing params for aliases haven't been added. It's just different, and takes some getting used to, but it's very readable. Unlike #button.

I understand what you're after with your status window now and yes, using the ID field is that way to do it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Wed Jun 18, 2008 10:41 am   
 
It would be great, if you could give me an example of usage that new #STWIN syntax, because I can find instructions of it nowhere.
My case looks:

on mud(after pressing condition):
You are in GREAT condition.
Big fat man in GREAT condition.
Small fat man in GREAT condition.

Pattern:
@varCondition

@varCondition table
GREAT|####

How to make a proper syntax with #STWIN now? With that uniqueID? How to use it in that case? Don't laugh, I'm really lost in that brand new(for me) things Embarassed
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 18, 2008 11:10 am   
 
I assume you want separate items on the status window and that you want more than one of them. Perhaps one for your hp, one for your mana, and one for the current status of your opponent. So you do something like:

#stwin {Current HP: @hp} "" "CurrentHPstw"
#stwin {Current Mana: @mana} "" "CurrentManastw"
#stwin {Condition: @condition} "" "Conditionstw"

Now any time you want to update a specific item in the status window (say, your HP, to add "LOW!" or something) you can do:

#if (@hp<20) {#stwin {Current HP: LOW! @hp} "" "CurrentHPstw"}

However, note that you do not need to update the status window manually every time you get a new hp value because the window's automatically updated when a variable it's displaying changes. So, you can use some tricks to mean you never have to redefine the status window:

#stwin {HP: %if(@hp<20,"LOW! ")@hp} "" "CurrentHPstw"

And this way, when @hp changes, the %if will be evaluated again and the "LOW!" will be added with no further intervention from you. You can do something similar to control your status window, depending on exactly what you're displaying. Assuming that it's between one and four hashes, depending on the status of the mob, you can do something like:

Code:
#trig {({great|good|okay|poor})} {#switch %1
  ("great") {condition=4}
  ("good") {condition=3}
  ("okay") {condition=2}
  ("poor") {condition=1}}


And now you can do something like this in the status window:

#stwin {Condition: %repeat("#",@condition)} "" "Conditionstw"

and it needs no further intervention from you. If need be, you could change condition=1 etc above to condition="whatever string you want to display in the status window" and have the status window be Condition: @condition which, again, needs no further changes to the status window to update properly.

If you didn't understand any of the functions or commands I used, the online help files are a good place to start.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Wed Jun 18, 2008 8:48 pm   
 
I tried to use that trig, but I think, we misunderstood ourselves. I wanted to catch all conditions of all NPCs and PCs in the same status window, not only mine. With no borders, one below one. Quantity is dynamic and depends on NPCs and PCs in the location. With %1 usage, it was simply to do. All of indicators was made automaticly. With that SWITCH and Variable, I couldn't do the same in one Status window. Maybe i did something wrong.

Anyway, thank you for your help.

If you have any more suggestion, I will follow them.

Sincerely

Nayuko
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jun 19, 2008 12:22 pm   
 
%1 still works fine. The problem is that you haven't specified in your trigger what part should be captured into %1. Your original trigger should be:
Code:
You are ({@condition})

Your original trigger would not have worked under zmud either. It's not because anything has changed in cmud, you just had the wrong syntax.
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Thu Jun 19, 2008 3:26 pm   
 
Not exactly.

The problem is, I can't use syntax like:
Variable = %1
because the Trig will fire, but will not compile.

I used the %1 temp var as a part of pattern, then I changed the %1 into real Variable. The function of @condition was to catch the correct value of sentence.
In cmud it is impossible unfortunately, to use that given %1.
And now, I don't know, how tu make new signs in STWIN window depending on quantity of enemies and friends durind checking condition NPCs and PCs existing on given location.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jun 19, 2008 4:35 pm   
 
Quote:

The problem is, I can't use syntax like:
Variable = %1
because the Trig will fire, but will not compile.

That is completely different from what you said initially. And that syntax works just fine. Type the following at the command line:
Code:
#trigger {This is (a test)} {newvariable = %1;#show newvariable is: @newvariable}
#say This is a test

newvariable = %1 works just fine. If your script isn't compiling, it's because of something else in your script. Why don't you show us the code that isn't compiling so we can figure out what is wrong?
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Thu Jun 19, 2008 8:46 pm   
 
Try to do that trig in config. I did it, and received:
fired, but did not compile

:)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Jun 19, 2008 9:16 pm   
 
Either you have changed one of the preferences or special characters, or there is something else corrupted in your session. I just tried Rahab's example here in a blank session and it worked fine.

Are you testing this in a blank session, or are you still trying to use your other normal session?
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Fri Jun 20, 2008 1:14 am   
 
Imported one from Zmud(ver 7.21, all works)
Most of scripts, based on Var = %1 stopped to work after importing to Cmud. I thought that usage of %1 is disallowed. But before I checked it out, I tried to use that syntax, until it made me crazy.
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