CheckNameListPosition » 历史记录 » 版本 1
machenhe, 2022-04-28 15:03
| 1 | 1 | machenhe | _*%{color:green}checkNameListPosition%*_ |
|---|---|---|---|
| 2 | 检测角色名称在指定文件中的位置(排名),如未找到,则返回0 |
||
| 3 | |||
| 4 | |||
| 5 | 标签:命令定义|checkNameListPosition |
||
| 6 | |||
| 7 | *格式* |
||
| 8 | |命令名 |参数1 |参数2 |参数3 |参数4 | |
||
| 9 | |checkNameListPosition |文件路径|比较符 |比较值 |返回排名变量 | |
||
| 10 | |||
| 11 | *说明* |
||
| 12 | * 参数1: 检测字符串的文件路径 |
||
| 13 | 路径需要基于..\\Mir200\\Envir |
||
| 14 | %{color:lightGrey}举例 |
||
| 15 | 设定检测路径为 |
||
| 16 | \\testlist.txt |
||
| 17 | 完整检测路径 |
||
| 18 | ..\\Mir200\\Envir\\testlist.txt% |
||
| 19 | |||
| 20 | * 参数2: 比较符(<>=) |
||
| 21 | |||
| 22 | * 参数3: 比较值 |
||
| 23 | |||
| 24 | * 参数4: 自定义返回排名变量 |
||
| 25 | |||
| 26 | - |
||
| 27 | - |
||
| 28 | |||
| 29 | *%{color:deepskyblue}脚本示例:%* |
||
| 30 | |||
| 31 | |||
| 32 | bq. [<notextile>@</notextile>main] |
||
| 33 | #act |
||
| 34 | mov s$file \\数据文件\\测试非预制数据文件.txt |
||
| 35 | #say |
||
| 36 | <增加角色名/<notextile>@</notextile>添加>\\ \\ |
||
| 37 | <删除文件中角色名/<notextile>@</notextile>删除>\\ \\ |
||
| 38 | <清理角色名文件/<notextile>@</notextile>清理>\\ \\ |
||
| 39 | <检测角色名是否在文件中/<notextile>@</notextile>检测角色名>\\ \\ |
||
| 40 | <检测角色名位置/<notextile>@</notextile>检测角色名位置>\\ \\ |
||
| 41 | <检测文件存在/<notextile>@</notextile>存在>\\ \\ |
||
| 42 | |
||
| 43 | [<notextile>@</notextile>添加] |
||
| 44 | #act |
||
| 45 | addNameList <$str(s$file)> |
||
| 46 | readTxt <$str(s$file)> s0 |
||
| 47 | %{color:lightGrey};print命令在控制台输出文件内容% |
||
| 48 | print 文件内容-> s0 |
||
| 49 | |
||
| 50 | [<notextile>@</notextile>删除] |
||
| 51 | #if |
||
| 52 | #act |
||
| 53 | delNameList <$str(s$file)> |
||
| 54 | readTxt <$str(s$file)> s0 |
||
| 55 | print 文件内容-> s0 |
||
| 56 | |
||
| 57 | [<notextile>@</notextile>清理] |
||
| 58 | #act |
||
| 59 | clearNameList <$str(s$file)> |
||
| 60 | readTxt <$str(s$file)> s0 |
||
| 61 | print 文件内容-> s0 |
||
| 62 | |
||
| 63 | [<notextile>@</notextile>检测角色名] |
||
| 64 | #if |
||
| 65 | checkNameList <$str(s$file)> |
||
| 66 | #act |
||
| 67 | print 角色名存在 |
||
| 68 | #elseAct |
||
| 69 | print 角色名不存在 |
||
| 70 | |
||
| 71 | #if |
||
| 72 | #act |
||
| 73 | readTxt <$str(s$file)> s0 |
||
| 74 | print 文件内容-> s0 |
||
| 75 | |
||
| 76 | [<notextile>@</notextile>检测角色名位置] |
||
| 77 | #if |
||
| 78 | %{color:green}checkNameListPosition% <$str(s$file)> < 10 n0 |
||
| 79 | #act |
||
| 80 | print 角色当前在前10名 |
||
| 81 | print 名次 n0 |
||
| 82 | #elseAct |
||
| 83 | print 角色当前不在前10名 |
||
| 84 | print 名次 n0 |
||
| 85 | |
||
| 86 | [<notextile>@</notextile>存在] |
||
| 87 | #if |
||
| 88 | fileExist <$str(s$file)> |
||
| 89 | #act |
||
| 90 | print 文件存在 |
||
| 91 | #elseAct |
||
| 92 | print 文件不存在 |