Перейти к содержанию

Smokingbird

Граждане
  • Постов

    7
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные Smokingbird

  1. господи, зачем так все усложнять? вот пробуйте, переписал. фреймворк у вас корявенький был

     

    Begin _XYZ
    
    short State
    short SDay
    
    if ( MenuMode == 1 )
    Return
    Endif
    
    if ( OnActivate == 1 )
     if ( State == 0 )
    set state to 1
     endif
    endif
    
    if ( State == 1 )
     if ( sday != day )
    set sday to day
    Cast "SpellID" player
     else
    MessageBox "Вы уже использовали сегодня. Чачача!(с)"
     endif
     set State to 0
    endif
    
    End _XYZ

  2. begin KO_Bath_Tub_Scripts
    
    Short controlvar
    Short button
    Short activate_menu
    Short increments
    Short angle_increments
    Short lockit
    float currxangle
    float curryangle
    float currzangle
    float   currxpos
    float currypos
    float startxangle
    float startyangle
    float startzangle
    float currzpos
    float startxpos
    float startypos
    float startzpos
    short counter
    short EG_tag
    short bathuse_var
    
    ;########################################################
    ; If we're outside, there's no need for this script at all; commented for outside furniture
    ;########################################################
    ;If (GetInterior == 0)
    ; return
    ;endif
    ;########################################################
    ; This code makes sure that the object acts like a regular item
    ; that you can pick up and place in your inventory while
    ; in menu mode
    ;########################################################
    
    if ( menumode == 1 )
    if (OnActivate == 1)
    Activate
    set lockit to 0
    endif
    return
    endif
    
    
    ;########################################################
    ; If controlvar = -1 means the player selected the "Take" option
    ; in the menu and lets you pick up the item
    ;########################################################
    if (controlvar == -1)
    Activate
    set controlvar to 0
    set lockit to 0
    return
    endif
    
    ;#######################################################
    ;Locks the painting position back in place
    ;Fixes a problem with the positioned object going back to where
    ;you dropped it after you load a savegame
    ;There's no way to know when the game is loaded that I know.
    ;I set the variable "lockit" to 1 whenever the painting is positioned
    ;When it is set to 1 this piece of code checks
    ;to see if the object is out of place and puts it back where it's
    ;supposed to be.
    ;#######################################################
    
    if (lockit == 1)
    if ( GetPos, z != currzpos)
    SetPos, x, currxpos
    SetPos, y, currypos
    SetPos, z, currzpos
    return
    elseif ( GetPos, y != currypos)
    SetPos, x, currxpos
    SetPos, y, currypos
    SetPos, z, currzpos
    return
    elseif ( GetPos, x != currxpos)
    SetPos, x, currxpos
    SetPos, y, currypos
    SetPos, z, currzpos
    return
    endif
    endif
    ;################################################################
    ; End of Lock check
    ;################################################################
    
    
    ;######################### Starting Menu ############################
    
    if ( OnActivate == 1 )
    ;if (GetInterior == 0)
    ; Activate
    ; set lockit to 0
    ; return
    ;endif
    set increments to 1
    set angle_increments to 1
    set activate_menu to 1
    set controlvar to 1
    set startxpos to GetPos, x
    set startypos to GetPos, y
    set startzpos to GetPos, z
    set startxangle to GetAngle, x
    set startyangle to GetAngle, y
    set startzangle to GetAngle, z
    set currxpos to GetPos, x
    set currypos to GetPos, y
    set currzpos to GetPos, z
    elseif (controlvar ==0)
    return
    set lockit to 0
    endif
    
    if (activate_menu == 1)
    MessageBox "Выберите действие:", "Взять", "Вращать", "Двигать", "Купаться", "Готово"
    set activate_menu to 0
    set lockit to 0
    endif
    
    if (controlvar ==1)
    set button to GetButtonPressed
    if ( button == -1 )
    return
    elseif ( button == 0)
    set controlvar to -1
    set activate_menu to 0
    return
    elseif ( button == 1)
    set controlvar to 2
    set activate_menu to 2
    elseif ( button == 2)
    set controlvar to 3
    set activate_menu to 3
    elseif ( button == 3 )
    if ( bathuse_var == 0 )
      set bathuse_var to 1
      MessageBox "Хотите помыться?" "Нет" "Использовать Бархатные ручки" "Использовать Звездный лед" "Использовать Луноцвет" "Использовать Морской бриз" "Использовать Божественное мыло" "Использовать Океанскую глубь" "Использовать Полуночный мускус" "Использовать Решимость"
    endif
    else
    set controlvar to 0
    set activate_menu to 0
    set lockit to 1
    return
    endif
    endif
    
    if ( bathuse_var==1 )
    set button to GetButtonPressed
    
    if (button==0)
    	Set bathuse_var to 0
    	Activate
    endif
    
    if (button==1)
    	Set EG_tag to 1
    endif
    
    if (button==2)
    	Set EG_tag to 2
    endif
    
    if (button==3)
    	Set EG_tag to 3
    endif
    
    if (button==4)
    	Set EG_tag to 4
    endif
    
    if (button==5)
    	Set EG_tag to 5
    endif
    
    if (button==6)
    	Set EG_tag to 6
    endif
    
    if (button==7)
    	Set EG_tag to 7
    endif
    
    if (button==8)
    	Set EG_tag to 8
    endif
    
    if (EG_tag==1)
    	if (  Player->GetItemCount, "_EG_soapinv_01" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_01" 1
    		player->AddSpell, "EG_soap_01"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  [b]Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1[/b]
    		return
    endif
    
    if (EG_tag==2)
    	if (  Player->GetItemCount, "_EG_soapinv_02" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_02" 1
    		player->AddSpell, "EG_soap_02"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1
    		return
    endif
    
    if(EG_tag==3)
    	if (  Player->GetItemCount, "_EG_soapinv_03" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_03" 1
    		player->AddSpell, "EG_soap_03"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1
    		return
    endif
    
    if(EG_tag==4)
    	if (  Player->GetItemCount, "_EG_soapinv_04" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_04" 1
    		player->AddSpell, "EG_soap_04"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1
    		return
    endif
    
    if(EG_tag==5)
    	if (  Player->GetItemCount, "_EG_soapinv_05" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_05" 1
    		player->AddSpell, "EG_soap_05"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1
    		return
    endif
    
    if(EG_tag==6)
    	if (  Player->GetItemCount, "_EG_soapinv_06" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_06" 1
    		player->AddSpell, "EG_soap_06"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1
    		return
    endif
    
    if(EG_tag==7)
    	if (  Player->GetItemCount, "_EG_soapinv_07" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_07" 1
    		player->AddSpell, "EG_soap_07"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1
    		return
    endif
    
    if(EG_tag==8)
    	if (  Player->GetItemCount, "_EG_soapinv_08" == 0 )
    		MessageBox "У вас нет этого мыла."
    		Set EG_tag to 0
    		set bathuse_var to 0
    		return
    	endif
    		StartScript Remove_Bath_Effects
    		Player->removeitem "_EG_soapinv_08" 1
    		player->AddSpell, "EG_soap_08"
    		MessageBox, "Вы окунаетесь в горячую воду и смываете с себя грязь. У вас ощущение, будто вы родились заново."
    		set bathuse_var to 0
    												  Cast "KO_Bathing_Spell" Player
    												  set controlvar to 0
    												  set lockit to 1
    		return
    endif
    
    endif
    
    ;######################## Rotation Menu ###################################
    if (activate_menu ==2)
    if (angle_increments == 1)
    MessageBox "Меню вращения", "Вращать на 1 градус", "Вращать по оси X", "Вращать по оси Y", "Вращать по оси Z",  "Сбросить на 0", "Отменить",  "Назад"
    elseif (angle_increments == 5)
    MessageBox "Меню вращения", "Вращать на 5 градусов", "Вращать по оси X", "Вращать по оси Y", "Вращать по оси Z",  "Сбросить на 0", "Отменить",  "Назад"
    elseif (angle_increments == 45)
    MessageBox "Меню вращения", "Вращать на 45 градусов", "Вращать по оси X", "Вращать по оси Y", "Вращать по оси Z",  "Сбросить на 0", "Отменить",  "Назад"
    else
    MessageBox "Меню вращения", "Вращать на 90 градусов", "Вращать по оси X", "Вращать по оси Y", "Вращать по оси Z",  "Сбросить на 0", "Отменить",  "Назад"
    endif
    set activate_menu to 0
    endif
    
    if (controlvar == 2)
    set currxangle to GetAngle, x
    set curryangle to GetAngle, y
    set currzangle to GetAngle, z
    
    set button to GetButtonPressed
    
    
    if (button == -1)
    return
    elseif (button == 0)
    if (angle_increments == 1)
     set angle_increments to 5
    elseif (angle_increments == 5)
     set angle_increments to 45
    elseif (angle_increments == 45)
     set angle_increments to 90
    else
     set angle_increments to 1
    endif
    set activate_menu to 2
    return
    elseif (button == 1)
    set currxangle to (currxangle + angle_increments)
    if (currxangle >= 360)
     set currxangle to (currxangle - 360)
    endif
    SetAngle, x, currxangle
    set activate_menu to 2
    return
    elseif (button == 2)
    set curryangle to (curryangle + angle_increments)
    if (curryangle >= 360)
     set curryangle to (curryangle - 360)
    endif
    SetAngle, y, curryangle
    set activate_menu to 2
    return
    elseif (button == 3)
    set currzangle to (currzangle + angle_increments)
    if (currzangle >= 360)
     set currzangle to (currzangle - 360)
    endif
    SetAngle, z, currzangle
    set activate_menu to 2
    return
    elseif (button == 4)
    SetAngle, x, 0
    SetAngle, y, 0
    SetAngle, z, 0
    set activate_menu to 2
    return
    elseif (button == 5)
    SetAngle, x, startxangle
    SetAngle, y, startyangle
    SetAngle, z, startzangle
    set activate_menu to 2
    return
    else
    set activate_menu to 1
    set controlvar to 1
    return
    endif
    
    
    endif
    
    if (lockit == 1)
      if ( counter < 20 )
       Set counter to ( counter + 1 )
      else
       Set counter to 0
       if ( GetPos, z == currzpos )
    	   if ( GetPos, y == currypos )
    		   if ( GetPos, x == currxpos )
    			  if ( GetAngle, z == currzangle )
    				 if ( GetAngle, y == curryangle )
    					if ( GetAngle, x == currxangle )
    						return
    					endif
    				 endif
    			  endif
    		   endif
    	   endif
       endif
       SetPos, x, currxpos
       SetPos, y, currypos
       SetPos, z, currzpos
       SetAngle, x, currxangle
       SetAngle, y, curryangle
       SetAngle, z, currzangle
      endif
    endif
    
    ;##################### Position Menu #######################
    if (activate_menu ==3)
    if (increments == 1)
    MessageBox "Меню движения", "Двигать на 1 пункт", "+X", "-X", "+Y", "-Y", "+Z", "-Z", "Отменить", "Назад"
    elseif (increments == 5)
    MessageBox "Меню движения", "Двигать на 5 пунктов", "+X", "-X", "+Y", "-Y", "+Z", "-Z", "Отменить", "Назад"
    else
    MessageBox "Меню движения", "Двигать на 10 пунктов", "+X", "-X", "+Y", "-Y", "+Z", "-Z", "Отменить", "Назад"
    endif
    set activate_menu to 0
    endif
    
    if (controlvar == 3)
    
    
    set button to GetButtonPressed
    
    
    if (button == -1)
    return
    elseif (button == 0)
    if (increments == 1)
     set increments to 5
    elseif (increments == 5)
     set increments to 10
    else
     set increments to 1
    endif
    set activate_menu to 3
    return
    elseif (button == 1)
    set currxpos to (currxpos + increments)
    SetPos, x, currxpos
    set activate_menu to 3
    return
    elseif (button == 2)
    set currxpos to (currxpos - increments)
    SetPos, x, currxpos
    set activate_menu to 3
    return
    elseif (button == 3)
    set currypos to (currypos + increments)
    SetPos, y, currypos
    set activate_menu to 3
    return
    elseif (button == 4)
    set currypos to (currypos - increments)
    SetPos, y, currypos
    set activate_menu to 3
    return
    elseif (button == 5)
    set currzpos to (currzpos + increments)
    SetPos, z, currzpos
    set activate_menu to 3
    return
    elseif (button == 6)
    set currzpos to (currzpos - increments)
    SetPos, z, currzpos
    set activate_menu to 3
    return
    elseif (button == 7)
    SetPos, x, startxpos
    SetPos, y, startypos
    SetPos, z, startzpos
    set currxpos to startxpos
    set currypos to startypos
    set currzpos to startzpos
    set activate_menu to 3
    return
    else
    set activate_menu to 1
    set controlvar to 1
    return
    endif
    
    endif
    
    End KO_Bath_Tub_Scripts

     

    попробуй

  3. Просто из интереса решил написать с нуля свой скрипт. Чуть не умер пока отлаживал, но все-таки добился эффекта. Вот. Проверено - работает как часы.

    Begin SmB_item_double
    
    short activated
    short button
    short action
    long x_item
    long x_count
    long x_ref
    short once
    short once_mess
    short my_day
    
    if ( menumode )
    return
    endif
    
    if ( OnActivate )
    if ( once_mess == 1 )
    	MessageBox "Сундук закрыт."
    	return
    endif
    if ( activated == 0 )
    	MessageBox "Что вы хотите?" "Добавить/взять вещи" "Удвоить кол-во"
    	Set activated to 1
    endif
    endif
    
    if ( activated == 1 )
    Set button to GetButtonPressed
    if ( button == -1 )
    	return
    elseif ( button == 0 )
    	Activate
    else
    	Set action to 1
    	Set my_day to Day
    endif
    Set activated to 0
    endif
    
    if ( action < 1 )
    return
    endif
    
    if ( my_day == Day )
    if ( once_mess == 0 )
    	MessageBox "Подождите до завтра." "Ok"
    	Set once_mess to 1
    endif
    return
    else
    Set my_day to 0
    endif
    
    ifx ( once )
    else
    setx x_item,x_count,x_ref to xInventory
    set once to 1
    endif
    
    ifx ( x_ref )   
    xAddItem x_item x_count
    setx x_item,x_count,x_ref to xNextStack x_ref
    return
    else
    xAddItem x_item x_count
    endif
    
    
    Set action to 0
    set once to 0
    Set once_mess to 0
    
    End

    зы. Да, к слову, я был неправ насчет menumode :)

  4. так... ну во-первых LDay будет short, как и Day, хоть это и несущественно. Во-вторых, менюмод здесь абсолютно не к месту, так как при активации мы все-таки попадаем в меню. в-третьих, а как это так вспыхнул свет и он сам закрылся? если игрок вручную не закрывает меню, он так и останется открытым. в общем не знаю, сейчас отредактирую пост выше и попробуй опять.

     

    Вот кстати нашел скрипт, забирающий все вещи у игрока. Может тебе оказаться полезен:

    begin take_player_items
    
    short trapdisabled
    long invitem   ; name of the item (i.e. gold_001, ingred_ruby_01, etc.)
    long invcount  ; amount of the item (i.e. 327 gold_001, etc.)
    long invref	; pointer to next item (unused in this script)
    long pcref
    
    if ( OnActivate == 0 )   ; Nothing to do until player tries to open it.
    return
    endif
    
    if ( trapdisabled == 1 ) ; This would be changed by some external script
    Activate			 ; to allow the player to retrieve the items.
    endif
    
    ; If we get here, the trap is active, take everything the player carries.
    setx pcref to xGetRef "player"
    
    setx invitem,invcount,invref to pcref->xInventory	 ; get first item
    whilex ( invcount )
    xAddItem invitem invcount						 ; add to container
    pcref->xRemoveItem invitem invcount			   ; take from player
    setx invitem,invcount,invref to pcref->xInventory ; get another item
    endwhile
    
    end

  5. The standard Morrowind script if and while commands do not work when the body of the block contains extended commands, instead use ifx and whilex. The ifx and whilex do not currently support a full syntax, I would just use a single value or function for now. The ifx/whilex will be performed if the value is not zero. You can use 'else' with 'ifx' but not 'elseif' and there isn't an 'elseifx'.

     

    то есть в блоках где есть команды из MWSE используется ifx вместо if.

    Попробуй так:

    Begin _NmLs_ChestOfCloningScript
    
    short sState
    long sItemName
    long sItemCount
    long sItemRef
    long sItemNext
    short LDay
    short sDoOnce
    short tmp
    
    if ( OnActivate == 1 )
    if ( sState != 0 )
    	MessageBox "Сундук закрыт"
    	Return
    else
    	Activate
    	Set sState to 1
    	set Lday to Day
    endif
    endif
    
    set tmp to ( sState - 1 )
    ifx ( tmp ); выполняется при != 0
    else; а это чтобы было при == 0
    setx sItemName,sItemCount,sItemRef to xInventory
    ifx ( sItemName )
    	Set sState to 2
    	MessageBox "Вокруг сундука вспыхнул магический свет, и сундук закрылся."
    else
    	Set sState to 0
    endif
    endif
    
    if ( sState == 2 )
    if ( LDay != Day )
    	set sState to 3
    	set tmp to ( sState - 3 )
    set LDay to Day
    endif
    endif
    
    ifx ( tmp )
    else
    ifx ( sDoOnce )  
    else
    	setx sItemName,sItemCount,sItemRef to xInventory
    	set sDoOnce to 1
    endif
    ifx ( sItemName )
    	xAddItem sItemName sItemCount
    	set sItemNext to sItemRef
    	setx sItemRef to xNextStack sItemNext  ;sItemName,sItemCount, закомментил
    else
    	set sState to 0
    	set sDoOnce to 0
    endif
    endif
    
    End _NmLs_ChestOfCloningScript

×
×
  • Создать...