Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,359 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Change value of a variable depending on user input #141596
07/17/07 11:28
07/17/07 11:28
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
Hi!

I want to set a variable depending on the user input.

Example:

The user says that the variable test should be 2*2 (=4).
He types: "test = 2*2"

(Of course no one would just write 2*2 but perhaps "test = maxv(100,sqrt(223))")

code:
"
#include <acknex.h>
#include <default.c>


var test = 0;

function main()
{

level_load("");
wait(1);

sky_color.red = 1;

var_for_name("test = 2*2");

}



PANEL* Debug_Pan =
{
layer = 200;
flags = VISIBLE;
digits = 100,120,5.2,*,1,test;
}
"

This should set the variable "test" to 4 (2*2). But that doesn't work....the variable is 2 after the execution of the function...

Is there any function that can do this?

Re: Change value of a variable depending on user i [Re: dennis] #141597
07/17/07 15:41
07/17/07 15:41
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
No. You need to program an arithmetics interpreter for such a function.

Re: Change value of a variable depending on user i [Re: jcl] #141598
07/17/07 18:37
07/17/07 18:37
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline OP
Member
dennis  Offline OP
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
Well.....that sounds quite difficult.

Where do I get one that works in lite-c?
(Or do I have to write one myself?)

Could the A6 "execute" function do that?

Last edited by dennis; 07/17/07 19:19.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1