The first script works, but I can't get the second one to. I'm trying to get it to call the variables using a string (which is stored inside a variable) because I can't think of any other way.
First script (which already works):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
on:load{
	loop("objects"){
		$object=loop_id();
		$topid=$object;
		$yaw=getyaw ("object",$object);
		$pitch=getpitch ("object",$object);
		$roll=getroll ("object",$object);
		$x=getx("object",$object);
		$y=gety("object",$object);
		$z=getz("object",$object);
		$type=type("object",$object);
		$varstring="objectyaw$object";
		rename "yaw","$varstring";
		$varstring="objectpitch$object";
		rename "pitch","$varstring";
		$varstring="objectroll$object";
		rename "roll","$varstring";
		$varstring="objectx$object";
		rename "x","$varstring";
		$varstring="objecty$object";
		rename "y","$varstring";
		$varstring="objectz$object";
		rename "z","$varstring";
		$varstring="objecttype$object";
		rename "type","$varstring";
		$varstring="objectid$object";
		rename "object","$varstring";
	}
	savevars "maps/vars";
}
Second script (which doesn't work):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
on:start{
	loadvars "maps/vars";
	$object=1;
	loop("count",99999){
		if($object>=$topid){
			exit;
		}
		$varstring="objectid$object";
		if(varexists("$varstring")){
			$varstring="objectyaw$object";
			$objectyaw=$varstring;
			$varstring="objectroll$object";
			$objectroll=$varstring;
			$varstring="objectpitch$object";
			$objectpitch=$varstring;
			$varstring="objectx$object";
			$objectx=$varstring;
			$varstring="objecty$object";
			$objecty=$varstring;
			$varstring="objectz$object";
			$objectz=$varstring;
			$varstring="objecttype$object";
			$objecttype=$varstring;
			$varstring="objectid$object";
			$objectid=$varstring;
			create "object",$objecttype;
			debug "vars";
			//setrot "object",$newobject, $objectpitch, $objectyaw, $objectroll;
			//setpos "object",$newobject,$objectx,$objecty,$objectz;
		}
		$object++;
	}
}
My current problem has been: The more complex the codes get, the less people there are that know how to help me, so to simplify:
is it possible in s2 script to take this variable:
$varstring="objectpitch$object";
and use the string stored inside to call a different variable with the same name as the string stored inside?
edited 3×, last 07.06.22 12:56:46 am
map conversion script further progress
1 
Offline
ModJuicer
Respect
The other script had two bugs, one regarding ids (1 id too high) and one regarding loops.