查看: 2812|回复: 4

[已经解决] 想问下变量数值输入的上限要如何改呢

[复制链接]
梦石
0
星屑
651
在线时间
26 小时
注册时间
2020-6-22
回帖
25

极短22参与

发表于 2022-8-11 03:02:44 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
就是一个道具我希望使用它的时候直接可以输入密码,可是上限是8,我设置的密码是十位,鼓捣了半天也不会,希望有大佬帮忙!
美术/剧本/工程修炼中
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2022-8-11 09:48:26 | 显示全部楼层
本帖最后由 alexncf125 于 2022-8-11 09:51 编辑

使用方法

在输入数字事件命令之后,创建注释并写入

   <num input digits: x>
  
其中 `x` 是您想要的位数

例子:
<num input digits: 10>

  1. =begin
  2. #===============================================================================
  3. Title: More Input Digits
  4. Author: Hime
  5. Date: Jan 29, 2015
  6. URL: http://himeworks.com/2015/01/more-input-digits/
  7. --------------------------------------------------------------------------------
  8. ** Change log
  9. Jan 29, 2015
  10.    - Initial release
  11. --------------------------------------------------------------------------------   
  12. ** Terms of Use
  13. * Free to use in non-commercial projects
  14. * Contact me for commercial use
  15. * No real support. The script is provided as-is
  16. * Will do bug fixes, but no compatibility patches
  17. * Features may be requested but no guarantees, especially if it is non-trivial
  18. * Credits to Hime Works in your project
  19. * Preserve this header
  20. --------------------------------------------------------------------------------
  21. ** Description

  22. This script allows you to set more digits for your number input event command.
  23. By default, the event editor only supports up to 8 digits.

  24. --------------------------------------------------------------------------------
  25. ** Installation

  26. In the script editor, place this script below Materials and above Main

  27. --------------------------------------------------------------------------------
  28. ** Usage

  29. Right after an input number event command, create a comment and write

  30.    <num input digits: x>
  31.   
  32. Where `x` is the number of digits you would like
  33. #===============================================================================
  34. =end
  35. $imported = {} if $imported.nil?
  36. $imported[:TH_MoreInputDigits] = true
  37. #===============================================================================
  38. # ** Configuration
  39. #===============================================================================
  40. module TH
  41.   module More_Input_Digits
  42.     Regex = /<num[-_ ]input[-_ ]digits:\s*(\d+)\s*>/i
  43.   end
  44. end
  45. #===============================================================================
  46. # ** Rest of script
  47. #===============================================================================
  48. module RPG
  49.   class Event::Page
  50.     alias :th_more_input_digits_list :list
  51.     def list
  52.       parse_more_input_digits unless @more_input_digits_parsed
  53.       th_more_input_digits_list
  54.     end
  55.    
  56.     def parse_more_input_digits
  57.       @more_input_digits_parsed = true
  58.       i = 0
  59.       while i < @list.size
  60.         cmd = @list[i]
  61.         
  62.         # Number Input command
  63.         if cmd.code == 103         
  64.                     
  65.           # Collect all comments under it
  66.           next_cmd = @list[i+1]
  67.           comment = ""
  68.           while next_cmd.code == 108 || next_cmd.code == 408
  69.             i += 1
  70.             comment << "\n" << next_cmd.parameters[0]
  71.             next_cmd = @list[i+1]            
  72.           end
  73.          
  74.           # Check if there's something special
  75.           if comment =~ TH::More_Input_Digits::Regex
  76.             num = $1.to_i         
  77.             cmd.parameters[1] = num            
  78.           end
  79.         end
  80.         i += 1
  81.       end      
  82.     end
  83.   end
  84. end
复制代码
回复

使用道具 举报

梦石
0
星屑
651
在线时间
26 小时
注册时间
2020-6-22
回帖
25

极短22参与

 楼主| 发表于 2022-8-11 19:37:50 | 显示全部楼层
alexncf125 发表于 2022-8-11 09:48
使用方法

在输入数字事件命令之后,创建注释并写入

谢谢您!但是这个脚本貌似公共事件不行,因为我是在公共事件里写的再插入到道具使用里,是还要加点别的嘛
美术/剧本/工程修炼中
回复

使用道具 举报

梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2022-8-11 20:01:50 | 显示全部楼层
55行的class Event::Page改成class CommonEvent吧?
回复

使用道具 举报

梦石
1
星屑
23236
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 2022-8-12 00:47:29 | 显示全部楼层
插入这个脚本
https://script.miaowm5.com/post/27

然后在数值输入处理指令前插入一个执行脚本指令执行以下代码
  1. m520150501_change({2=>10})
复制代码


Snipaste_2022-08-12_00-47-06.png

评分

参与人数 1赞 +1 收起 理由
alexncf125 + 1 塞糖

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部