Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AemStones, AndrewAMD, gamers, Kingware), 1,679 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 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: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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 | chip programmers | 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