|
Santel Novice
Joined: 07 Feb 2003 Posts: 32
|
Posted: Fri Feb 21, 2003 4:13 pm
#var with () |
This is the output i want:
Dam:5-20(18) from my variable
This is what i try to do:
#var testing {&dam-&maxdam(&avgdam)}
it doesnt work.. result:
Dam:6-&MaxDam( &avgdam)
tried to put ~(&avgdam~)
Then i get this:
Dam:5-20~(18~)
any help would be much appriciated |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Fri Feb 21, 2003 4:36 pm |
One of the guru's probably has a better explanation, but i'm just going to say: this is odd behaviour. If you must have the output in a variable instead of using, say:
#show &dam-&maxdam~(&avgdam)
then i found that putting a space between the "m" and the "(" will work:
#var testing (&dam-&maxdam (&avgdam)}
--------
moon.icebound.net:9000 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Fri Feb 21, 2003 4:45 pm |
Try:
#VAR testing {&{dam}-&{maxdam}(&{avgdam})}
Kjata |
|
|
|
Santel Novice
Joined: 07 Feb 2003 Posts: 32
|
Posted: Fri Feb 21, 2003 5:03 pm |
quote:
Try:
#VAR testing {&{dam}-&{maxdam}(&{avgdam})}
Kjata
Yeah i thought about that one as well and here is the result
#if (&MinDam = 0) {} {#VAR testing {@testing &{dam}-&{maxdam}(&{avgdam})}
^ syntax error
The syntac error points to the { in &{dam}
|
|
|
|
Santel Novice
Joined: 07 Feb 2003 Posts: 32
|
Posted: Fri Feb 21, 2003 5:12 pm |
quote:
One of the guru's probably has a better explanation, but i'm just going to say: this is odd behaviour. If you must have the output in a variable instead of using, say:
#show &dam-&maxdam~(&avgdam)
then i found that putting a space between the "m" and the "(" will work:
#var testing (&dam-&maxdam (&avgdam)}
--------
moon.icebound.net:9000
I'm taking data from the DB. It is like 20 variables put into one varibale. In the end is say all the data i got from the db that i have now stored into one variable
Btw your solution didnt work |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 21, 2003 6:04 pm |
#var testing {&dam-&{maxdam}(&avgdam)}
This will also give you a syntax error, just like Kjata's did. Who cares? Just like Kjata's, it will work anyway. What do you want, something that works or something that the syntax editor will accept?
LightBulb
Advanced Member |
|
|
|
Virus Wanderer
Joined: 29 Jun 2002 Posts: 69 Location: USA
|
Posted: Fri Feb 21, 2003 6:30 pm |
Why dont you just use %eval()?
Richard Powell
Mux Alias: Virus
2796 Wizard Staff
64.89.10.1 port 2796
Rich@gigdev.com |
|
|
|
Santel Novice
Joined: 07 Feb 2003 Posts: 32
|
Posted: Fri Feb 21, 2003 6:37 pm |
quote:
#var testing {&dam-&{maxdam}(&avgdam)}
This will also give you a syntax error, just like Kjata's did. Who cares? Just like Kjata's, it will work anyway. What do you want, something that works or something that the syntax editor will accept?
LightBulb
Advanced Member
I always assumed that if you got an error it would not work. Thats why i never tested any of my own solutions cus i was sure they wouldnt work.. so that you can get an error but the script migth work anyway is new to me...
Now i implmented katja's and as you said it works.. so thanks a lot
Santel |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 22, 2003 12:37 am |
quote:
quote:
#var testing {&dam-&{maxdam}(&avgdam)}
This will also give you a syntax error, just like Kjata's did. Who cares? Just like Kjata's, it will work anyway. What do you want, something that works or something that the syntax editor will accept?
LightBulb
Advanced Member
I always assumed that if you got an error it would not work. Thats why i never tested any of my own solutions cus i was sure they wouldnt work.. so that you can get an error but the script migth work anyway is new to me...
Now i implmented katja's and as you said it works.. so thanks a lot
Santel
Unless there's no way to calm the syntax checker (and there usually is in most cases), I avoid using code that produces syntactical errors. Most of the time, execution resulted in AVs or some other error and always corrupted SOMETHING in my settings files or layout.
li'l shmoe of Dragon's Gate MUD |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Feb 22, 2003 1:29 am |
Matt,
When the syntax editor indicates an error, I take it seriously and check my work. But when I'm unable to find any error, and the setting works, I keep in mind that I'm smarter than the computer. You should be too.
If you can find any error in either Kjata's or my #VAR command, please point it out.
LightBulb
Advanced Member |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 22, 2003 3:50 am |
quote:
Matt,
When the syntax editor indicates an error, I take it seriously and check my work. But when I'm unable to find any error, and the setting works, I keep in mind that I'm smarter than the computer. You should be too.
If you can find any error in either Kjata's or my #VAR command, please point it out.
LightBulb
Advanced Member
I was replying more to Santel's reply towards your post, indicating that he didn't know you could sometimes get away with ignoring the syntax checker. However, my experience thus far has been 100% crash, boom, bang regarding syntax errors. Thus, if something I write (that I'm personally going to use) produces a syntax error I keep at it until I find it and fix it or I scrap what I had and try again from scratch. You happen to know/are comfortable with a lot more of ZMud's script language than I am, so I don't trust myself as completely.
li'l shmoe of Dragon's Gate MUD |
|
|
|
|
|