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
daemoan.vermillious
Apprentice


Joined: 28 Feb 2009
Posts: 135
Location: Chico, Ca

PostPosted: Fri Oct 16, 2009 7:51 pm   

2 question 1 math 1 trigger could use help
 
can c mud run equations and give resolve?? such as:
5 + 9 ( 39 / 3) - 4 =

does it recognize algebra ?

if so how would I do this?


also Iam trying to trigger this for an auto target but I have a problem with these: example [XXXX]?
Iam trying to only capture the XXXX

ATTACK!! [XXXX]?

#trig ATTACK!! [%1]?
#var target %1

when I try doing this its not working cause the brackets...
jsut dunt know what to do....


thanks


(EDIT) (ADD)
Also Is There A Way To Add Color To The Status WindoW>
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Oct 16, 2009 9:14 pm   
 
Your first question is a yes and no answer. If you're asking if it can solve for x, then that is something CMUD cannot do without extensive coding. I'd probably go more into that, but I'm on my phone right now.

Second, two problems. First, you shouldn't be using %1 in a trigger pattern. Second, [] are special characters and need to be quoted. if you aren't sure what the xxxxx is going to be, then you can do this:

#TRIGGER {ATTACK!! ~[(*)~]} {whatever %1}

If it's always one word, then change the * to %w.

Hope this helps.

Charneus


Last edited by charneus on Sat Oct 17, 2009 1:32 am; edited 1 time in total
Reply with quote
Jorville
Wanderer


Joined: 30 Apr 2006
Posts: 58
Location: Brookhaven, MS

PostPosted: Fri Oct 16, 2009 9:22 pm   
 
also, i think cmud evaluates the numbers from left to right so instead of 5 + 9 ( 39 / 3) - 4 =
you could try 39/3*9+5-4= that might help, depends on what your doing i guess
_________________
Jorville
Player on SWMUD
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Oct 16, 2009 11:48 pm   
 
Cmud will correctly evaluate your math problem using the standard order of operations. However you need to explicitly declare multiplication with * and not the short form of x(y). However as Charneus said it will not solve for an unknown variable on both sides without extensive code. Also Cmud math defaults to integer math so to get floating point returns at least one of the numbers hast to have a decimal point in it (.0 works)

5+9(39/3)-4=118 would need to read

5+9*(39/3)-4=118

floating point example
5+9*(40/3)-4=118 (40/3 will return 13 in integer math)
5+9*(40.0/3)-4=121 (40/3 will return 13.33333 in floating point)
_________________
Zmud Support Library
Zmud Knowledge Base
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