Jump to content

why isnt this teliport script working?


DrMobiusJr

Recommended Posts

this is the script that i need help on and its been annoying me so much, the menu comes up when i fire the detonator but when i click on and option it just closes the menu, this should work correct? thanks for any help, i would love anything anyone can tell me.


scn 00TeliporterGunScript

short button

Begin OnFire

showmessage 00teliporttestnote

end

short button

begin gamemode

if Button == 1

player.MoveTo 00test1REF

elseif Button == 2

player.MoveTo 00test2REF

elseif Button == 3

player.MoveTo 00test3REF

elseif Button == 4

player.MoveTo 00test4REF

endif

end

Link to comment
Share on other sites

you declare one variable and test for another. How you resolve it is up to you but they need to match.

 

the reason im asking is because thats what i did and it still does not work

 

new code

 

scn 00TeliporterGunScript
short Button
Begin OnFire
showmessage 00teliporttestnote
end
short Button
begin gamemode
if Button == 1
player.MoveTo 00test1REF
elseif Button == 2
player.MoveTo 00test2REF
elseif Button == 3
player.MoveTo 00test3REF
elseif Button == 4
player.MoveTo 00test4REF
endif
end
Link to comment
Share on other sites

Where is you script failing then. Does it display the message? Do you not capture the button press?

 

Is this a weapon? if so:

Script Type: Object
For weapons, you'll have to use an Object Script. "Weapon" type Object Effects are applied to that weapon's target, and are therefore unsuitable for applying effects to the wielder
Link to comment
Share on other sites

b != B

 

short button

if Button == 1

Variable names in scripts are not case-sensitive. Matter of fact, nothing in the game appears to be case-sensitive.

 

As for the OP's question:

Your script doesn't include any means to detect which option the player selected from the menu (GetButtonPressed is used for that).

scn 00TeliporterGunScript

short MenuUp
short Button

begin OnFire

	if MenuUp == 0
		set MenuUp to 1
		ShowMessage 00teliporttestnote
	endif

end

begin GameMode

	if MenuUp
		set Button to GetButtonPressed
		if Button >= 0
			set MenuUp to 0
			if Button == 0
				player.MoveTo 00test1REF
			elseif Button == 1
				player.MoveTo 00test2REF
			elseif Button == 2
				player.MoveTo 00test3REF
			elseif Button == 3
				player.MoveTo 00test4REF
			endif
		endif
	endif

end
Link to comment
Share on other sites

 

b != B

 

short button

if Button == 1

Variable names in scripts are not case-sensitive. Matter of fact, nothing in the game appears to be case-sensitive.

 

As for the OP's question:

Your script doesn't include any means to detect which option the player selected from the menu (GetButtonPressed is used for that).

scn 00TeliporterGunScript

short MenuUp
short Button

begin OnFire

	if MenuUp == 0
		set MenuUp to 1
		ShowMessage 00teliporttestnote
	endif

end

begin GameMode

	if MenuUp
		set Button to GetButtonPressed
		if Button >= 0
			set MenuUp to 0
			if Button == 0
				player.MoveTo 00test1REF
			elseif Button == 1
				player.MoveTo 00test2REF
			elseif Button == 2
				player.MoveTo 00test3REF
			elseif Button == 3
				player.MoveTo 00test4REF
			endif
		endif
	endif

end

thanks a ton for the explanation to all of you guys, it was a ton of help and i was able to fix some other code problems also. so thanks to all of you :}

 

thanks for providing a fixed code, i only had to change two small things and it worked perfect, had to add 1 to the values because 0 was set to the never mind option

Link to comment
Share on other sites

 

b != B

Variable names in scripts are not case-sensitive. Matter of fact, nothing in the game appears to be case-sensitive.

Thanks. I keep thinking in 'programming' as opposed to the special version used here I guess. I knew about game defined variables and function calls being case-insensitive but somehow I assumed that they were doing case-insensitive checks for the game engines own but would require conventional checks on ours. Stupid assumption since the easiest thing to do would be not to trap for their variables but have a quick parser for every script which turns everything lower (or upper) case and then handle the script.... makes perfect sense if I'd only stopped to think about it instead of assume stuff.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...