SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/05/2013, 11:49 AM   #1
iJumbo
High-roller
 
iJumbo's Avatar
 
Join Date: Sep 2009
Location: HEX 69 74 61 6C 79
Posts: 2,175
Reputation: 136
Default expressions string to expressions?

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);
__________________

Need a VPS? Get it here!
Website designer & developer php, html, css, html5, javascript
iJumbo is offline   Reply With Quote
Old 04/05/2013, 01:28 PM   #2
iJumbo
High-roller
 
iJumbo's Avatar
 
Join Date: Sep 2009
Location: HEX 69 74 61 6C 79
Posts: 2,175
Reputation: 136
Default Re: expressions string to expressions?

becouse i want like change espressions from database
__________________

Need a VPS? Get it here!
Website designer & developer php, html, css, html5, javascript
iJumbo is offline   Reply With Quote
Old 04/05/2013, 01:34 PM   #3
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 882
Reputation: 313
Default Re: expressions string to expressions?

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.
Yashas is offline   Reply With Quote
Old 04/05/2013, 01:43 PM   #4
iJumbo
High-roller
 
iJumbo's Avatar
 
Join Date: Sep 2009
Location: HEX 69 74 61 6C 79
Posts: 2,175
Reputation: 136
Default Re: expressions string to expressions?

Mmh so i have to create an expression parser..
__________________

Need a VPS? Get it here!
Website designer & developer php, html, css, html5, javascript
iJumbo is offline   Reply With Quote
Old 04/05/2013, 01:49 PM   #5
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 882
Reputation: 313
Default Re: expressions string to expressions?

In PAWN how do I call/get a variable and perform action on it??
Yashas is offline   Reply With Quote
Old 04/05/2013, 01:53 PM   #6
iJumbo
High-roller
 
iJumbo's Avatar
 
Join Date: Sep 2009
Location: HEX 69 74 61 6C 79
Posts: 2,175
Reputation: 136
Default Re: expressions string to expressions?

What you mean?

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

var is now 2
__________________

Need a VPS? Get it here!
Website designer & developer php, html, css, html5, javascript
iJumbo is offline   Reply With Quote
Old 04/05/2013, 02:22 PM   #7
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 882
Reputation: 313
Default Re: expressions string to expressions?

-_- 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.
Yashas is offline   Reply With Quote
Old 04/05/2013, 02:33 PM   #8
iJumbo
High-roller
 
iJumbo's Avatar
 
Join Date: Sep 2009
Location: HEX 69 74 61 6C 79
Posts: 2,175
Reputation: 136
Default Re: expressions string to expressions?

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

Need a VPS? Get it here!
Website designer & developer php, html, css, html5, javascript
iJumbo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
string too small. but i dont wanna make the string like 9999.. niels44 Scripting Help 2 23/10/2012 05:36 PM
Can someone explain to me these expressions? CJoao Help Archive 4 08/08/2011 12:40 AM
input line too long (after substitutions) - invalid string (possibly non-terminated string) MahmutBey Help Archive 6 10/03/2011 01:39 PM
Invalid expressions cre8ticity Help Archive 5 28/10/2010 12:15 PM
Expressions not found and Expected tocken dillo1000 Help Archive 0 14/10/2010 04:51 PM


All times are GMT. The time now is 05:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.