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,590 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
Help! Fogotten functions #365194
03/24/11 10:49
03/24/11 10:49
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
Hello, How do you convert a negative number to positive and positive to negative i think there was function i don't remember.
And how do you know that player has been stuck and doesn't move when using c_move? An example please.
Thank You.

Re: Help! Fogotten functions [Re: romin2011] #365207
03/24/11 14:53
03/24/11 14:53
Joined: Jan 2011
Posts: 797
Da wo du nicht bist! Muhahaha!
xxxxxxx Offline
User
xxxxxxx  Offline
User

Joined: Jan 2011
Posts: 797
Da wo du nicht bist! Muhahaha!
Just use * -1 if you only want the against number!
if you dont know that your number is positv/negativ and you only want a positiv(or negativ) value use abs()(*-1 for negativ wink );

to check that you dosent move!
Code:
if(c_move <= 0)


xxxxxxx


Es ist immer wieder erstaunlich, dass Leute die riesen Scripte schreiben die einfachsten sachen nicht können zb. mich mit SIEBEN x zu schreiben! tongue
Re: Help! Fogotten functions [Re: xxxxxxx] #365209
03/24/11 15:09
03/24/11 15:09
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
The function "converting negative numbers to positive numbers and vice versa" is called negation. In order to use it you have to put a minus sign in front of the variable or constant.

Code:
var x = 3;
var y;
y = -x; // This makes the magic happen...




Always learn from history, to be sure you make the same mistakes again...
Re: Help! Fogotten functions [Re: Uhrwerk] #365214
03/24/11 15:51
03/24/11 15:51
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
or you can simply multiply the number with -1.


3333333333
Re: Help! Fogotten functions [Re: Uhrwerk] #365215
03/24/11 16:02
03/24/11 16:02
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Code:
n = -n;



Re: Help! Fogotten functions [Re: MrGuest] #365217
03/24/11 16:16
03/24/11 16:16
Joined: Dec 2010
Posts: 87
R
romin2011 Offline OP
Junior Member
romin2011  Offline OP
Junior Member
R

Joined: Dec 2010
Posts: 87
Hey thanx guys very much. One more question, can goto go to inside a while loop? I mean can it enter a conditional while loop.

Re: Help! Fogotten functions [Re: romin2011] #365223
03/24/11 16:43
03/24/11 16:43
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i would never use goto! your code will be much clearer without!


Visit my site: www.masterq32.de
Re: Help! Fogotten functions [Re: MasterQ32] #365239
03/24/11 17:53
03/24/11 17:53
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Richi007
i would never use goto! your code will be much clearer without!

That might be true for many cases but not for all. As you know assembly, you should also know that there are some pretty good reasons to use goto instead of blowing up your code base and thus making it harder to maintain.

Anyway, to answer the question, yes, you can use goto to jump into any kind of loop (they are made by using goto anyway), but you aren't allowed to jump over variable declarations.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Help! Fogotten functions [Re: WretchedSid] #365392
03/26/11 10:36
03/26/11 10:36
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Unless you really use assembler, which I suspect you don't, simply think of goto as if it was non existent. Don't use it.

An example of a very old version of WDL to show what happens with GOTO and similar...

Code:
IF_EQUAL no_new_item,1;
		GOTO no_new_item;
	IF_EQUAL free_item,free_item.MAX;
		END;
	IF_NEQUAL free_item,1;
		SKIP 1;
	RULE i_item1=cur_item+new_amount;
	IF_NEQUAL free_item,2;
		SKIP 1;
	RULE i_item2=cur_item+new_amount;
	IF_NEQUAL free_item,3;
		SKIP 1;
...
no_new_item:
	SET no_new_item,0;
	IF (tot_amount>20) {SET newstring,1;SET info_str,no_setitem_str;GOTO update_inv;}
	SET MY.INVISIBLE,1;
	PLAY_SOUND collect_snd,0.3;
	RULE weight=weight+new_amount*new_weight;
update_inv:
	IF_EQUAL LAYERS.3,inventory_ovr;
	CALL update_inv;




Moderated by  HeelX, rvL_eXile 

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