Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,519 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
function "help" #392086
01/19/12 00:27
01/19/12 00:27
Joined: Nov 2009
Posts: 70
Siwler Offline OP
Junior Member
Siwler  Offline OP
Junior Member

Joined: Nov 2009
Posts: 70
hey guys its me again with the problem, I hope I don't offend anyone by my lack of knowledge in programing.

Function add_money()
// in next line of code I get syntax error
if (cash == 0) {cash_pan, visible = on;}

// so I tried it this way
if (cash == 0) {cash_pan = VISIBLE;}
// I still get syntax error, don't know any other way to fix this. Will anyone help me?

here is the full code:
Code:
var cash = 0;

function add_money();
function buy_me();


STRING* snipergun_mdl = "snipergun.mdl";
STRING* gotcash_snd = "gotcash.wav";
STRING* spentcash_snd = "spntcash.wav";
BMAP* cash_map = "cashpan.bmp";
/////////////////////////////////////////////
// collects cash from items etc.
FONT* arial_font = "Arial#20b";
PANEL* cash_pan =
{
        bmap = cash_map;
	digits (40, 22, 4, Arial#20b, 1, cash); 
	flags = transparent, overlay, refresh, d3d;;
}
action get_cash()
{
	set (my, ENABLE_IMPACT);
	my.event = add_money;
}
function add_money()
{
	wait (1);
	if (my.skill1 == 0) {my.skill1 = 20;} // default = 20 bucks 
	if (cash == 0) {cash_pan, visible = on;}
	cash += my.skill1;
	snd_play (gotcash_snd, 70, 0);
	ent_remove (me);
}
/////////////////////////////////////////////////
action buy_items()
{
	set (my, ENABLE_CLICK);
	my.event = buy_me;
}
function buy_me()
{
	wait (1);
	if (event_type != EVENT_CLICK || cash < my.skill1) {return;}
	cash -= my.skill1;
	snd_play (spentcash_snd, 70, 0);
	ent_remove (me);
}






Honesty will get you far, were dishonesty will get you only so far in life.

Re: function "help" [Re: Siwler] #392088
01/19/12 00:39
01/19/12 00:39
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
In what language are you coding in, lite-C (*.c) or C-Script (*.wdl)?

Code:
flags = transparent, overlay, refresh, d3d;;



There's a ";" too much. Those flags are obsolete, at least refresh and d3d. You combine flags with "|":

flags = TRANSLUCENT | OVERLAY;

Code:
set (my, ENABLE_IMPACT);


"set" is a macro for entity flags that is declared as follows:

#define set(obj,flag) obj.flags |= (flag)

ENABLE_IMPACT is an emask flag, not flags (see manual). That means you have to write your own macro or set the flag as follows:

my.emask |= ENABLE_CLICK;

Replace
Code:
if (cash == 0) {cash_pan, visible = on;}


with
Code:
if (cash == 0) { set(cash_pan,SHOW); }




"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: function "help" [Re: Superku] #392090
01/19/12 01:09
01/19/12 01:09
Joined: Nov 2009
Posts: 70
Siwler Offline OP
Junior Member
Siwler  Offline OP
Junior Member

Joined: Nov 2009
Posts: 70
Thank you for clearing all that out for me I no longer get syntax errors.

But code don't work for me, have to see why.


Honesty will get you far, were dishonesty will get you only so far in life.


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