Help - Search - Members - Calendar
Full Version: script problem
The Nexus Forums > Specific Games > Oblivion > Oblivion Modifications > Mod Troubleshooting
Sonck
hello.
this is a script ive been working on. when u activate a teleportation stone it asks you to which floor you want to go.
the problem is that no matter which option you choose, it always teleports you to the first option. please tell me what is wrong

CODE
scn JKCPTeleportStonesScript

short button
short buttonPressed
short getbuttonpressed

Begin OnActivate
       if IsActionRef player == 1
              set buttonPressed to 1
              set button to -1
              messagebox "teleport to?", "level 1", "level 2", "level 3"

       endif
end

begin gamemode
if buttonPressed == 1
    set button to getbuttonpressed

    if button > -1
        if button == 0
          set buttonPressed to 0
          set button to -1
                 player.movetomarker JKCPXMarkerRoom01
        elseif button == 1
          set buttonPressed to 0
          set button to -1
                  player.movetomarker JKCPXMarkerRoom00
        elseif button == 2
          set buttonPressed to 0
          set button to -1
                  player.movetomarker JKCPXMarkerRoomM1
        endif

    endif
elseif buttonPressed == 0
      set button to -1
  endif
end
Aoikani
QUOTE(Sonck @ May 16 2008, 08:58 PM) *
hello.
this is a script ive been working on. when u activate a teleportation stone it asks you to which floor you want to go.
the problem is that no matter which option you choose, it always teleports you to the first option. please tell me what is wrong

CODE
scn JKCPTeleportStonesScript

short button
short buttonPressed
short getbuttonpressed

Begin OnActivate
       if IsActionRef player == 1
              set buttonPressed to 1
              set button to -1
              messagebox "teleport to?", "level 1", "level 2", "level 3"

       endif
end

begin gamemode
if buttonPressed == 1
    set button to getbuttonpressed

    if button > -1
        if button == 0
          set buttonPressed to 0
          set button to -1
                 player.movetomarker JKCPXMarkerRoom00
        elseif button == 1
          set buttonPressed to 0
          set button to -1
                  player.movetomarker JKCPXMarkerRoom01
        elseif button == 2
          set buttonPressed to 0
          set button to -1
                  player.movetomarker JKCPXMarkerRoomM1
        endif

    endif
elseif buttonPressed == 0
      set button to -1
  endif


um, yeah it's kind of messed up. that happens ^^ I'm not the greatest scriptor but I can see some things there that is incorrect. I had to learn by looking at existing ingame scripts and reading the wiki then running tests to see how things worked. I suggest that you check the wiki out TES Contruction Set Wiki

But just to point out, do you notice you don't have an 'end' for your 'begingamemode'? and not really sure, but you may have one too many 'elseif'. you actually got this to run that all the way through?

I'll test it out for you but you'll have to wait till the weekend before I can get to it. Lot's of stuff to do ^^


Sonck
ok i didnt copy the scrpt correctly, ill edit the above script. just forgot an "end" i think
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.