Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
rotate map on keypress #209440
06/03/08 02:22
06/03/08 02:22
Joined: May 2008
Posts: 27
x10d3 Offline OP
Newbie
x10d3  Offline OP
Newbie

Joined: May 2008
Posts: 27
I will have around 3 maps and I want them to rotate in order. I have figured out how to assign keys to the different maps. What would the function be like so that when it's called it goes to the next map.

Re: rotate map on keypress [Re: x10d3] #209489
06/03/08 12:37
06/03/08 12:37
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
lvl_num = 0;

function abc()
{
if(lvl_num == 1)
{
level_load("nextmap.wmb");
}
if(lvl_num == 2)
{
level_load("nextmap.wmb");
}
lvl_num += 1;
}


function main()
{
on_q = abc;
...

i didnt realy get what you want but maby this is wat you want else try to explain some more ore wait for other comments


"empty"
Re: rotate map on keypress [Re: flits] #209492
06/03/08 12:58
06/03/08 12:58
Joined: May 2008
Posts: 27
x10d3 Offline OP
Newbie
x10d3  Offline OP
Newbie

Joined: May 2008
Posts: 27
Just a simple rotation function to load the next map in a continuous cycle.

Re: rotate map on keypress [Re: x10d3] #210108
06/08/08 00:28
06/08/08 00:28
Joined: May 2008
Posts: 27
x10d3 Offline OP
Newbie
x10d3  Offline OP
Newbie

Joined: May 2008
Posts: 27
If I understand you right I should get the result I want with this....

Code:
string level_str1 = <lvl1.WMB>;
string level_str2 = <lvl2.WMB>;
string level_str3 = <lvl3.WMB>;

var lvl_num = "0";

fucntion lvlChng(lvl_num)
{
	if(lvl_num == "1")
	{
		lvl_num = "2";
		level_load(level_str2);
	}
	else if(lvl_num == "2")
	{
		lvl_num = "3";
		level_load(level_str3);
	}
	else if(lvl_num == "3")
	{
		lvl_num = "1";
		level_load(level_str1);
	}
	else
	{
		lvl_num = "1";
		level_load(level_str1);
	}
	return(lvl_num);
}


I keep getting an error stating

"Parameter Unknown lvl_num bad keyword in {}"



Last edited by x10d3; 06/08/08 00:53.
Re: rotate map on keypress [Re: x10d3] #210163
06/08/08 14:09
06/08/08 14:09
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
function abc()
{
if(lvl_num == 1)
{
level_load(level_str2);
}
if(lvl_num == 2)
{
level_load(level_str3);
}
lvl_num += 1;
lvl_num &= 3;// if lvl_num is 3 lvl_num = 0
}


function main()
{
on_q = abc;
...

if you are using vars dont use lvl_num = "1"; but lvl_num = 1;
same white if
same white var
var lvl_num = 0;

"" are for strings
STRING* lvl_num = "0"
str_cpy(lvl_num,"1");
if(str_cmpni(lvl_num,"1");


"empty"
Re: rotate map on keypress [Re: flits] #210169
06/08/08 16:04
06/08/08 16:04
Joined: May 2008
Posts: 27
x10d3 Offline OP
Newbie
x10d3  Offline OP
Newbie

Joined: May 2008
Posts: 27
Every time I use str_cpy(lvl_num,"1"); it give me "Keyword unknown str_cpy" and I get a crash.

Re: rotate map on keypress [Re: x10d3] #210170
06/08/08 16:10
06/08/08 16:10
Joined: May 2008
Posts: 27
x10d3 Offline OP
Newbie
x10d3  Offline OP
Newbie

Joined: May 2008
Posts: 27
BTW when I use
lvl_num += 1;
lvl_num &= 3;

it gives me a readonly error on lvl_num

Re: rotate map on keypress [Re: x10d3] #210176
06/08/08 17:51
06/08/08 17:51
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
have you included:

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

?


"empty"
Re: rotate map on keypress [Re: flits] #210193
06/08/08 21:59
06/08/08 21:59
Joined: May 2008
Posts: 27
x10d3 Offline OP
Newbie
x10d3  Offline OP
Newbie

Joined: May 2008
Posts: 27
I added that and it still gives me the same errors

Re: rotate map on keypress [Re: x10d3] #210195
06/08/08 22:08
06/08/08 22:08
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
@ flits: i guess he is using. C-script he dont need to include that files? (he defines strings this way:string level_str1 = <lvl1.WMB>; its c-script)

@x10d3:

everytime you call the function it will oad the next level, make sure you dont change level_num in other parts of the code:
Code:
string level_str1 = <lvl1.WMB>;
string level_str2 = <lvl2.WMB>;
string level_str3 = <lvl3.WMB>;

var lvl_num = 1;

fucntion lvlChng()
{
	if(lvl_num == 1)//if level_num=1 load level1
	{
		level_load(level_str1);
		level_num=2;
	}
	else if(lvl_num == 2)
	{
		level_load(level_str2);
		lvl_num = 3;
	}
	else if(lvl_num == 3)
	{
		level_load(level_str3);
		lvl_num = 1;
	}
}



3333333333
Page 1 of 2 1 2

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