DrMobiusJr Posted November 13, 2013 Share Posted November 13, 2013 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 More sharing options...
bjornl Posted November 13, 2013 Share Posted November 13, 2013 b != B short buttonif Button == 1 Link to comment Share on other sites More sharing options...
DrMobiusJr Posted November 13, 2013 Author Share Posted November 13, 2013 b != B short buttonif Button == 1sooo i change short button to short Button? Link to comment Share on other sites More sharing options...
bjornl Posted November 13, 2013 Share Posted November 13, 2013 you declare one variable and test for another. How you resolve it is up to you but they need to match. Link to comment Share on other sites More sharing options...
DrMobiusJr Posted November 13, 2013 Author Share Posted November 13, 2013 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 00TeliporterGunScriptshort ButtonBegin OnFireshowmessage 00teliporttestnoteendshort Buttonbegin gamemodeif Button == 1player.MoveTo 00test1REFelseif Button == 2player.MoveTo 00test2REFelseif Button == 3player.MoveTo 00test3REFelseif Button == 4player.MoveTo 00test4REFendifend Link to comment Share on other sites More sharing options...
bjornl Posted November 13, 2013 Share Posted November 13, 2013 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 More sharing options...
jazzisparis Posted November 13, 2013 Share Posted November 13, 2013 b != B short buttonif Button == 1Variable 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 More sharing options...
rickerhk Posted November 13, 2013 Share Posted November 13, 2013 Also, even when you get the button selection sorted, the script is likely to have problems because you prefixed the REFs with numbers. Link to comment Share on other sites More sharing options...
DrMobiusJr Posted November 13, 2013 Author Share Posted November 13, 2013 b != B short buttonif Button == 1Variable 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 More sharing options...
bjornl Posted November 13, 2013 Share Posted November 13, 2013 b != BVariable 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 More sharing options...
Recommended Posts