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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Corleidum
Novice


Joined: 30 Apr 2003
Posts: 43
Location: Sweden

PostPosted: Tue Feb 17, 2004 4:03 pm   

Getting Crazy!!!
 
tell me something that is REALLY annoying me.

This is something I want to be triggerd:
Intelligence: 95

The trigger looks:
Intelligense (%d)
#VARIABLE @int %1
#IF (@int < 95) {#VARIABLE @intc 498} {#VARIABLE @intc 779}
#SUBSTITUTE {Intelligence: %1 (%eval(5 - %15)) * @intc}

first of all. the Variable "Int" isin't added. and it's empty. WHy?! Secondly the Eval thing doesn't work.. Any help? please..
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Tue Feb 17, 2004 5:03 pm   
 
I'm not sure what your tring to do, but i see a couple minor issues.

1. Your missing the : in your trigger
2. #var @int %1 is wrong, should be #var int {%1}
3. your division sign is incorrect, you have , where it should be /
4. Your %eval function looked wrong, i rewrote it.


When using variables, use the @ symbol in front when you want to access the value within the variable.

Try this

Pattern
Intelligense~: (%d)

Script
#VARIABLE int {%1}
#IF (@int < 95) {#VARIABLE intc 498} {#VARIABLE intc 779}
#SUBSTITUTE {Intelligence: %1 %eval((5 - %1/5) * @intc)}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Feb 17, 2004 5:35 pm   
 
Intelligence, not intelligense.
Intelligence: (%d) should be in the Pattern, not the Value, it's not clear which section you have it in.
is the correct symbol for modulo division. It should not be changed to /.
Based on experience, : can be used in the pattern without ~.

Pattern: Intelligence: (%d)
Value:
#VARIABLE int {%1}
#IF (@int < 95) {#VARIABLE intc 498} {#VARIABLE intc 779}
#SUBSTITUTE {Intelligence: %1 %eval((5 - %15) * @intc)}

To answer your question, the variable "Int" isn't added because the #VARIABLE command supports indirect variable-naming. When you put "int" as the name, the variable created is @int. When you put @int as the name, the name is whatever value is in @int. So, if @int is "smart", then #VARIABLE int 25 changes the value of @int to 25, but #VARIABLE @int 25 creates a new variable, @smart, with the value of 25.
Reply with quote
Corleidum
Novice


Joined: 30 Apr 2003
Posts: 43
Location: Sweden

PostPosted: Tue Feb 17, 2004 8:48 pm   
 
Working perfeclty, thanks.
Q1: Is it possible to add more IF's?
Q2: And is it possible to make that into a var?
The sum that I get after %eval((5 - %15) * @intc
to insert it into a variable called intsum?

ex:

#VARIABLE int {%1}
#IF (@int < 95) {#VARIABLE intc 498} {#VARIABLE intc 779}
#IF (@int < 80) {#VARIABLE intc 398} {#VARIABLE intc 579}
#SUBSTITUTE {Intelligence: %1 %eval((5 - %15) * @intc)}


Is that possible? I wanna do a IF
for every 5 stats.. starting from

20-100.. : 20|25|30|35 etc..

So if I have below 25 it will cost 24gp. If it is larger then 25 49gp. Less then 30 49gp and larger 69.. etc..
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Tue Feb 17, 2004 10:38 pm   
 
You can nest if statements.

If you want to put the final value in a varable you can do so by.


#var intsum {%eval((5 - %15) * @intc)}



for your if statements something like this should get you started.
There are many different ways to write that type of nested if, I perfer to seperate them like this instead of nesting them. Nesting can get very confusing.

#IF (@int > 95) {#noop}
#if ((@int < 95) and (@int >= 85)) {#noop}
#if ((@int < 85) and (@int >= 75)) {#noop}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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