expressions string to expressions?
#1

Hi.. its possible to convert an expression like that

pawn Code:
new MyString[] = "-(atk + (1.6* atk + number(200,300) + dex*7 + str*7)*k)";
into

pawn Code:
new result = result -(atk + (1.6* atk + number(200,300) + dex*7 + str*7)*k);
Reply
#2

becouse i want like change espressions from database
Reply
#3

Wait, I have a working function I had wrote it long back in VC++(actually its in C)...I will search and convert it to PAWN and give.The function is big and not optimized.I must search in which program I have written it.

It doesn't support brackets if I am not wrong, you need to modify the code for it to work.It executed things which come first.
Reply
#4

Mmh so i have to create an expression parser..
Reply
#5

In PAWN how do I call/get a variable and perform action on it??
Reply
#6

What you mean?

pawn Code:
new var;
var = 1;
var = var + 1;

var is now 2
Reply
#7

-_- LOL I know that

I am talking if you have 'a' in your string suppose 'a +5'
How will you get the value of a??Or if the string says "a = 5" , how'd you do that??My code being an interpreter stores a structure of variables with its name and find out and set the variable by loop but this is not the case here.My code is difficult to convert so I am writing a new one.
Reply
#8

you can't convert a string like "a = 5" to a = 5.. you need a expression parser..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)