expressions string to expressions? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: expressions string to expressions? (
/showthread.php?tid=434830)
expressions string to expressions? -
iJumbo - 04.05.2013
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);
Re: expressions string to expressions? -
iJumbo - 04.05.2013
becouse i want like change espressions from database
Re: expressions string to expressions? -
Yashas - 04.05.2013
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.
Re: expressions string to expressions? -
iJumbo - 04.05.2013
Mmh so i have to create an expression parser..
Re: expressions string to expressions? -
Yashas - 04.05.2013
In PAWN how do I call/get a variable and perform action on it??
Re: expressions string to expressions? -
iJumbo - 04.05.2013
What you mean?
pawn Code:
new var;
var = 1;
var = var + 1;
var is now 2
Re: expressions string to expressions? -
Yashas - 04.05.2013
-_- 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.
Re: expressions string to expressions? -
iJumbo - 04.05.2013
you can't convert a string like "a = 5" to a = 5.. you need a expression parser..