Menus and Button choices in Scripts help

Post » Tue Jun 19, 2012 11:42 pm

Alright, so im stumped. I really ought to stop thinking "this will be a simple script", because ive not been right yet :P

I want the player to have a shipmodel item in his inventory, that when he uses/equips/activates (?) a messagebox pops up asking if he wishes to teleport to a ship.

If you press button 0,Yes, you get teleported to an Xmarker named Shipastral
If you press button 1,No, nothing happens

Ive created a messagemenu in the message section.
This is the script that is on the shipmodel item.

Scriptname ctShipmodel extends ObjectReference  Objectreference Property ctshipmodelitem autoObjectreference Property Shipastral auto		   ;xmarkerMessage Property ctShipmodelmenu	Function OnEquipped(Actor akActor)		   Debug.Trace ("Player tried to equip a boat")		  ctshipmodelmenu.show()EndFunction


This is the errors i get compiling so far
Spoiler
Compiling "ctShipmodel"...
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ctShipmodel.psc(10,0): script property ctShipmodelmenu can only contain get or set functions
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ctShipmodel.psc(0,-1): mismatched input '' expecting ENDPROPERTY
No output generated for ctShipmodel, compilation failed.


I thought i could remember a "getbuttonpressed = 1" command from Oblivion, but i dont see anything similar, other than ibutton=. Ive checked the ckwiki and searched the forums, but i just dont understand it. And i also dont understand it from looking at bethesdas scripts. :eek:


Whats wrong so far, and what do i add into the script for the button presses?
Im forgetting about the teleporting part, but i *think* ive got that.
User avatar
Jordyn Youngman
 
Posts: 3396
Joined: Thu Mar 01, 2007 7:54 am

Post » Tue Jun 19, 2012 11:14 pm

Scriptname ctShipmodel extends ObjectReferenceObjectreference Property ctshipmodelitem autoObjectreference Property Shipastral auto ;xmarkerMessage Property ctShipmodelmenuFunction OnEquipped(Actor akActor)Debug.Trace ("Player tried to equip a boat")int res     res = ctshipmodelmenu.show()if res == 0     Game.GetPlayer.MoveTo(Shipastral)elseif res == 1     ;it should close itselfendifEndFunction

Something like that should work.
User avatar
Ladymorphine
 
Posts: 3441
Joined: Wed Nov 08, 2006 2:22 pm

Post » Tue Jun 19, 2012 1:43 pm

Scriptname ctShipmodel extends ObjectReferenceObjectreference Property ctshipmodelitem autoObjectreference Property Shipastral auto ;xmarkerMessage Property ctShipmodelmenuFunction OnEquipped(Actor akActor)Debug.Trace ("Player tried to equip a boat")int res	 res = ctshipmodelmenu.show()if res == 0	 Game.GetPlayer.MoveTo(Shipastral)elseif res == 1	 ;it should close itselfendifEndFunction

Something like that should work.

Thanks for the response.

i still get these 2 errors when saving

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ctShipmodel.psc(7,0): script property ctShipmodelmenu can only contain get or set functions
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ctShipmodel.psc(0,-1): mismatched input '' expecting ENDPROPERTY

For the menu, i only have the message text, Menubuttons and itemtext for the buttons filled in. I have nothing in the item conditions as none of bethesda's seem to either.
Should i? is that the cause of the first error?

For the 2nd error, no idea. Any thoughts?

Also, What is Res short for, Response? I cant find anything on the wiki.

Thanks again, this has been putting me off finishing the mod for a week now :)
User avatar
Add Me
 
Posts: 3486
Joined: Thu Jul 05, 2007 8:21 am

Post » Tue Jun 19, 2012 8:30 pm

Try this:


Scriptname ctShipmodel extends ObjectReferenceObjectreference Property Shipastral auto ;xmarkerMessage Property ctShipmodelmenu autoFunction OnEquipped(Actor akActor)Debug.Trace ("Player tried to equip a boat")int res	 res = ctshipmodelmenu.show()if res == 0	 Game.GetPlayer.MoveTo(Shipastral)elseif res == 1	 ;it should close itselfendifEndFunction

And res is abitrary. The line "int res" declares an integer called res, and then "res = ctshipmodelmenu.show()" sets res to the response made in the menu.

So res is short for response, but would work with any other world.
User avatar
KU Fint
 
Posts: 3402
Joined: Mon Dec 04, 2006 4:00 pm

Post » Wed Jun 20, 2012 12:43 am

try to add "auto" after ctShipmodelmenu property
User avatar
Lexy Corpsey
 
Posts: 3448
Joined: Tue Jun 27, 2006 12:39 am

Post » Tue Jun 19, 2012 6:17 pm

Thank you again Ali, and mastro, Much appreciated.
Its working now. Though 2 missing brackets () after Moveto caused me some head scratching at what i was getting wrong :tongue:

Works perfectly fine for what i wanted, other than the fact i forgot about how the player gets back to where he was. :facepalm:
Will have a look at the mark and recall mod maybe to see how they managed it.
User avatar
Sam Parker
 
Posts: 3358
Joined: Sat May 12, 2007 3:10 am

Post » Tue Jun 19, 2012 2:43 pm

Thank you again Ali, and mastro, Much appreciated.
Its working now. Though 2 missing brackets () after Moveto caused me some head scratching at what i was getting wrong :tongue:

Works perfectly fine for what i wanted, other than the fact i forgot about how the player gets back to where he was. :facepalm:
Will have a look at the mark and recall mod maybe to see how they managed it.

Scriptname ctShipmodel extends ObjectReferenceObjectReference Property Shipastral auto ;xmarkerObjectReference Property marker auto ;marker where player is before he teleports.Message Property ctShipmodelmenu autoActor playerFunction OnEquipped(Actor akActor)Debug.Trace ("Player tried to equip a boat")player = Game.GetPlayer()int res	 res = ctshipmodelmenu.show()if res == 0     marker.MoveTo(player)     player.MoveTo(Shipastral)elseif res == 1	 ;it should close itselfendifEndFunction

Then another script for when you want to get back :D
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Tue Jun 19, 2012 5:40 pm

alright, so i gave it a shot myself after looking at your new script, Ali, and searching the forums.
Scriptname ctShipmodel extends ObjectReferenceInt Property SpawnPicker autoObjectreference Property Shipastral auto ;xmarkerObjectReference Property recallmarker auto ;xmarker for recallMessage Property ctShipmodelmenu autoActor PlayerInt SpawnPicker = 0Function OnEquipped(Actor akActor)Debug.Trace ("Player tried to equip a boat")player= game.getplayer()int res		 res = ctshipmodelmenu.show()if res == 0if spawnpicker==0	    recallmarker.moveto(player)		 Utility.Wait(2.0)		 Game.GetPlayer().MoveTo(Shipastral)    Spawnpicker= 1elseif res == 1		 ;it should close itselfif spawnpicker== 1		 Game.Getplayer().MoveTo(recallmarker)	    spawnpicker= 0	 	  endif   endifendifEndFunction

I still transport to the ship, but then using it does nothing.

What i wanted was spawnpicker to start at 0, then when you use the ship, it sets to 1.
When its at 1, the next time you use the boat, you get transported back to where you were (recallmarker) and spawnpicker sets to 0, so that the next use transports you back to the ship, and repeat.

I have a feeling that the If Res and If spawnpicker lines will be clashing. Gave it a good shot, but i need help again :P
User avatar
krystal sowten
 
Posts: 3367
Joined: Fri Mar 09, 2007 6:25 pm

Post » Tue Jun 19, 2012 10:36 pm

You need to move your if and endif statments around. Right now, your script is like this:

if res == 0	if spawnpicker == 0	elseif res == 1		if spawnpicker == 1		endif	endifendif

when it should be like this:

if res == 0	if spawnpicker == 0	endifelseif res == 1	if spawnpicker == 1	endifendif

EDIT: I guessed at what you wanted with the second part. This is assuming that you want the player to get teleported back to the recallmarker when you press "no".
User avatar
Sandeep Khatkar
 
Posts: 3364
Joined: Wed Jul 18, 2007 11:02 am

Post » Wed Jun 20, 2012 1:08 am

alright, so i gave it a shot myself after looking at your new script, Ali, and searching the forums.
Scriptname ctShipmodel extends ObjectReferenceInt Property SpawnPicker autoObjectreference Property Shipastral auto ;xmarkerObjectReference Property recallmarker auto ;xmarker for recallMessage Property ctShipmodelmenu autoGlobal Property spawnpicker autoActor PlayerFunction OnEquipped(Actor akActor)Debug.Trace ("Player tried to equip a boat")player= game.getplayer()int res		 res = ctshipmodelmenu.show()if res == 0if spawnpicker==0	    recallmarker.moveto(player)		 Utility.Wait(2.0)		 Game.GetPlayer().MoveTo(Shipastral)    Spawnpicker= 1endifelseif res == 1		 ;it should close itselfif spawnpicker== 1		 Game.Getplayer().MoveTo(recallmarker)	    spawnpicker= 0	 	  endifendifEndFunction

I still transport to the ship, but then using it does nothing.

What i wanted was spawnpicker to start at 0, then when you use the ship, it sets to 1.
When its at 1, the next time you use the boat, you get transported back to where you were (recallmarker) and spawnpicker sets to 0, so that the next use transports you back to the ship, and repeat.

I have a feeling that the If Res and If spawnpicker lines will be clashing. Gave it a good shot, but i need help again :P

Haven't looked at the syntax, but you might want to make spawnpicker a global, as when ever the script is run it will always be set to 0.

So you'd have "Global Property spawnpicker auto"

EDIT: edited the script so it should work.
User avatar
Heather beauchamp
 
Posts: 3456
Joined: Mon Aug 13, 2007 6:05 pm


Return to V - Skyrim