OK論壇

 找回密碼
 註冊
查看: 827|回復: 1

數據變量問題

[複製鏈接]
  • TA的每日心情
    慵懶
    2020-1-3 10:45 PM
  • 簽到天數: 963 天

    連續簽到: 1 天

    [LV.10]以壇為家III

    發表於 2016-2-11 00:49:50 | 顯示全部樓層 |閱讀模式
    本帖最後由 美美美美美 於 2016-2-11 09:49 AM 編輯

    腳本:
    http://okayro.com/forum.php?mod= ... hlight=%B3%A8%B3%BD

    設定:
    1.                 // 釣竿的釣魚經驗加成 ( +n )
    2.                 setarray $FishingEquipExp[0], 0, 0, 1 ;
    複製代碼
    問題部分:
    1. function        script        Fishing_Exp        {

    2.        set FishingNowExp, FishingNowExp + 1 + $FishingEquipExp[ FishingEquip - 1 ] ;
    3.         if ( FishingNowExp >= $FishingExpMax[ FishingLevel ] ) {
    4.                 set FishingLevel, FishingLevel + 1 ;
    5.                 set FishingNowExp, 0 ;
    6.                 dispbottom "釣魚等級提升至 " + FishingLevel + "。" ;
    7.                 specialeffect2 410 ;
    8.         } // if

    9.         return ;

    10. }
    複製代碼
    開始後出現:
    [警告]: script:getelementofarray: 編號超過範圍 (-1)
    [調試]: 數據: 變量名='$FishingEquipExp' index=0

    無法增加EXP後腳本就沒有反應

    請問如何解決?

    ========
    2F 後面的值+1 就能解決
    回復

    使用道具 舉報

  • TA的每日心情
    開心
    2020-10-27 09:10 PM
  • 簽到天數: 2555 天

    連續簽到: 1 天

    [LV.Master]伴壇終老

    發表於 2016-2-11 07:35:56 | 顯示全部樓層
    很明顯你的 FishingEquip 原本的值應該是0,而你去減1,當然就會變成-1而超出索引範圍。
    回復 支持 反對

    使用道具 舉報

    您需要登錄後才可以回帖 登錄 | 註冊

    本版積分規則

    Archiver|手機版|小黑屋|OK討論區

    GMT+8, 2024-4-26 12:47 AM , Processed in 0.044457 second(s), 19 queries , Gzip On.

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回復 返回頂部 返回列表