Forum

> > Stranded II > Scripts > Wagon Script Error
Forums overviewStranded II overview Scripts overviewLog in to reply

English Wagon Script Error

11 replies
To the start Previous 1 Next To the start

old Wagon Script Error

Corvallis5
User Off Offline

Quote
Well I have this script and I'm getting an error, it says 'missing semicolon' but I can't see where. Here's my code

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
script=start
		on:use {
		clear;
		add "You can drive this wagon or store stuff inside.";
		add "What do you want to do?";
		msgbox "Wagon";
		local $id;
		$id=current_id();
		add "exchange 2,$id;";
		button 0,"Store stuff",19;
		add "ride $id; closemenu; event "ridehorse";"; //error is coming on this line 
		button 1,"Drive the wagon",8;
		add "closemenu;";
		button 2,"Do nothing with this wagon",3;
		freevar $id;
	}
			
	on:ridehorse {
	maxhealth "unit",1,100;
	}
	on:kill {
		
		free "self";
	}
	on:getoff {
	maxhealth "unit",1,-100;
	}
script=end

old Re: Wagon Script Error

Hurri04
Super User Off Offline

Quote
I'm not sure about this, but have you tried to put the commands into 3 different add lines?

old Re: Wagon Script Error

Assassin moder
User Off Offline

Quote
Try that:
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
script=start
	on:use {
		clear;
		add "You can drive this wagon or store stuff inside.";
		add "What do you want to do?";
		msgbox "Wagon";
		local $id;
		$id=current_id();
		add "exchange 2,$id;";
		button 0,"Store stuff",19;
		add "ride $id; closemenu; event "ridehorse";";
		button 1,"Drive the wagon",8;
		add "closemenu;";
		button 2,"Do nothing with this wagon",3;
		freevar $id;
	}
                
	on:ridehorse {
		maxhealth "unit",1,100;
	}
	on:kill {
		free "self";
	}
	on:getoff {
		maxhealth "unit",1,-100;	//OMG whewn you get off you die?!
	}
script=end

old Re: Wagon Script Error

Hurri04
Super User Off Offline

Quote
try this line instead:
1
add "ride $id; closemenu;", "ridehorse";
no guaranty this will work though.

old Re: Wagon Script Error

Corvallis5
User Off Offline

Quote
@user Assassin moder:
no it didnt, thanks tho

@user Hurri04:
no it doesnt work here's my new script. WHAT IS WRONG?

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
script=start
		on:use {
		clear;
		add "You can drive this wagon or store stuff inside.";
		add "What do you want to do?";
		msgbox "Wagon";
		local $id;
		$id=current_id();
		add "exchange 2,$id;";
		button 0,"Store stuff",19;
		add "ride $id; closemenu;", "makemax";
		button 1,"Drive the wagon",8;
		add "closemenu;";
		button 2,"Do nothing with this wagon",3;
		freevar $id;
	}
	on:kill {
		
		free "self";
	}
	on:makemax {
	maxhealth "unit",1,100;
	}
	on:getoff {
	maxhealth "unit",1,-100;
	}
script=end
edited 1×, last 10.02.12 02:00:16 am

old Re: Wagon Script Error

Hurri04
Super User Off Offline

Quote
huh...
well, personally I think this way of creating a textbox (which you copied from the sailing raft, as I just checked) is pretty unstable.

I myself would rather use a different way:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
script=start
	on:use {
		dialogue "wagon", "sys\wagon_dialogue.s2s";
	}
	on:kill {
		free "self";
	}
	on:makemax {
		maxhealth "unit",1,100;
	}
	on:getoff {
		maxhealth "unit",1,-100;
	}
script=end
then create a file in the sys folder, call it "wagon_dialogue.s2s" and write this into it:
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
page=wagon
title=Wagon
text=start
You can drive this wagon or store stuff inside.
What do you want to do?
text=end
button=exchange, Store stuff
button=drive, Drive the wagon
button=nothing, Do nothing with this wagon

page=exchange
script=start
local $id;
$id=current_id();
exchange 2, $id;
script=end

page=drive
script=start
ride $id;
closemenu;
event "makemax";
script=end

page=nothing
script=start
closemenu;
script=end

I didnt test it, eventually you have to add another closemenu line before the exchange line on the second page.

old Re: Wagon Script Error

Corvallis5
User Off Offline

Quote
@user Assassin moder:
I dont think 'riding' is an event

@user Hurri04:
im yet to test

@user Hurri04:
NOOOOOOO! IT NO WOKZZIES!
only the do nothing works, the storage and the ride are messed up.

ps.
@user Hurri04:
there's nothing wrong with coping the sailraft script, saves a lot of typing and room for error
edited 1×, last 11.02.12 04:59:34 am

old Re: Wagon Script Error

Hurri04
Super User Off Offline

Quote
I never said that it's wrong to copy the sailraft script. it works so it should be fine. I think the error appears because you added the event but I dont know why that is.

how about these scripts then:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
script=start
	on:use {
		dialogue "wagon", "sys\wagon_dialogue.s2s";
	}
	on:kill {
		free "self";
	}
	on:exchange {
		$id=current_id();
		exchange 2, $id;
	}
	on:ride_wagon {
		maxhealth "unit",1,100;
		$id=currentid();
		ride $id;
		closemenu;
	}
	on:getoff {
		maxhealth "unit",1,-100;
	}
script=end
1
2
3
4
5
6
7
8
9
page=wagon
title=Wagon
text=start
You can drive this wagon or store stuff inside.
What do you want to do?
text=end
button=event:exchange, Store stuff
button=event:ride_wagon, Drive the wagon
button=action:close, Do nothing with this wagon
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview