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 (TipmyPip, AndrewAMD, NewbieZorro), 16,055 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
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 | 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