乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: Cad64

[编程交流] Modify current routine-block a

[复制链接]

8

主题

1647

帖子

1647

银币

初来乍到

Rank: 1

铜币
36
发表于 2022-7-6 12:06:21 | 显示全部楼层
Thanks guys.
 
Alan yours worked fine.
 
Lee, I loaded yours and tried to run it but it failed, saying "the operation has been cancelled". Probably just missing a parentheses or something?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:09:44 | 显示全部楼层
All works fine for me Rod.
 
Bear in mind that mine and Alan's share a global that is of different data type in each case, so don't test one after the other.
 
Open a new drawing before testing mine/his.
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:12:56 | 显示全部楼层
 
 
Much nicer. However, I think you'll have problems if you hit enter at the getstring prompt since it will return "" instead of nil.
 
Maybe something like this...
  1.   (setq gStr (lambda (/ s)              (if (eq ""                      (setq s (getstring (strcat "\nSpecify Starting Number  : ")))                  ) ;_ eq                *start                s              ) ;_ if            ) ;_ lambda ) ;_ setq
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:15:50 | 显示全部楼层
 
 
Type: (setq *start nil) then test.
 
I wasn't thinking broad enough. Mine would only correct something like 6 to 06 but ignore something like 006.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:17:58 | 显示全部楼层
Good point about the getstring - that construct was a remnant of the getint prompt... - code updated.
回复

使用道具 举报

8

主题

1647

帖子

1647

银币

初来乍到

Rank: 1

铜币
36
发表于 2022-7-6 12:20:45 | 显示全部楼层
Ok, I tried it in a new drawing and discovered two problems.
 
As Alan stated, if you hit enter at the command prompt, nothing happens. It won't accept the default shown in brackets. And also, once you get to 09, if you click on the next block in succession, it won't change to 10, it just stops working.
回复

使用道具 举报

8

主题

1647

帖子

1647

银币

初来乍到

Rank: 1

铜币
36
发表于 2022-7-6 12:25:45 | 显示全部楼层
Ok, the updated code fixed the first problem of hitting enter at the command prompt, but the second problem still exists. You can't continue auto-numbering past 09. The routine just quits.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:29:28 | 显示全部楼层
Another silly mistake  - cheers Rod - I think I kinda rushed this one...
 
Code updated.
回复

使用道具 举报

8

主题

1647

帖子

1647

银币

初来乍到

Rank: 1

铜币
36
发表于 2022-7-6 12:31:40 | 显示全部楼层
Ok, it's working now. Thanks again for your help.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:35:35 | 显示全部楼层
 
Glad we got there in the end... can't believe the amount of mistakes in my first code... unbelieveable
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-6 02:27 , Processed in 0.450334 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表