createpath + getid + getpos together
Re: createpath + getid + getpos together
It looks like I wont be including the reward item ids as there is no way to get them. Also I think I'll put the rewards in a comment on the next line, otherwise the line will get too long.
I'm having an issue with the getKeyText function. Remember I said I filtered the search when used with creatpath to "SC_" to "SP" to make it quick. Well the first time I used createpath after integrating that function, I selected the option "Leave conversation" and it didn't find it. It turns out that texts key string does not start with "SC_" or "SO" so there are obviously exceptions to that rule. So I've had to have it do the full search. Normally this shouldn't be a problem as long as it finds the text but if it doesn't, it will take about 7s which could confuse the user.
I think I might have to omit all the key strings that start with "Sys". They are all for ids anyway so we can use GetIdName for those. Seeing as most of the keystrings start with "Sys" that should bring the speed back up again. In that case I think I'll get rid of the range arguments all together.
I'm having an issue with the getKeyText function. Remember I said I filtered the search when used with creatpath to "SC_" to "SP" to make it quick. Well the first time I used createpath after integrating that function, I selected the option "Leave conversation" and it didn't find it. It turns out that texts key string does not start with "SC_" or "SO" so there are obviously exceptions to that rule. So I've had to have it do the full search. Normally this shouldn't be a problem as long as it finds the text but if it doesn't, it will take about 7s which could confuse the user.
I think I might have to omit all the key strings that start with "Sys". They are all for ids anyway so we can use GetIdName for those. Seeing as most of the keystrings start with "Sys" that should bring the speed back up again. In that case I think I'll get rid of the range arguments all together.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: createpath + getid + getpos together
Ok. That's everything. I think this is ready to commit. There are some other changes in functions.lua. Hopefully they wont cause you any troubles.
- Attachments
-
- createpath.lua
- (30.37 KiB) Downloaded 177 times
-
- functions.lua
- (82.92 KiB) Downloaded 178 times
-
- english.lua
- (17.34 KiB) Downloaded 158 times
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
I'm not sure what needs to be done to fix this, but the new code for ByName is creating problems with the waypoint files.
This code:
Results in this when executed:
Edit: ChoiceOptionByName(RoMScript("TEXT(\"SC_425068_0\")")) seems to work.
This code:
Code: Select all
player:target_NPC(120234) -- Saul Leighton
AcceptQuestByName(425068) -- Invitation From Zurhidon
player:target_NPC(120234) -- Saul Leighton
ChoiceOptionByName("SC_425068_0") -- 'Join the Silvershadow Adventurers' Guild?'
yrest(1000)
ChoiceOptionByName("SC_425068_2") -- 'Zurhidon?'
yrest(1000)
RoMScript("ChoiceOption(1)") -- 'I refuse, because I am a subject of the Great Asomanson.'
Code: Select all
Moving to waypoint #27, (-2472, 2105)
We try to find NPC 120234:
We successfully target NPC Saul Leighton and try to open the dialog window.
Quest accepted: Invitation From Zurhidon
We try to find NPC 120234:
We successfully target NPC Saul Leighton and try to open the dialog window.
Option "SC_425068_0" not found.
Option "SC_425068_2" not found.
Clearing target.
Re: createpath + getid + getpos together
I think line 347
should be
Code: Select all
tmptext = sprintf("(\"%s\") -- \'%s\'", v.keystring, v.text)
Code: Select all
tmptext = sprintf("(getTEXT(\"%s\")) -- \'%s\'", v.keystring, v.text)
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: createpath + getid + getpos together
I updated the post above. http://www.solarstrike.net/phpBB3/viewt ... 414#p53414
It's good you picked up on that before I committed it.
It's good you picked up on that before I committed it.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
Found another strange occurance while rebuilding my Yrvandis Hollows waypoints. I was trying to accept the quest "Hate Bugs" and the ByName command didn't pick up on the quest information properly, and didn't auto accept the quest because of it.
This is what it saved into the waypoint:
I don't think that using the waypoint in that condition would actually work properly. 
This is what it saved into the waypoint:
Code: Select all
AcceptQuestByName("Accept Quest: Hate Bugs")

Re: createpath + getid + getpos together
I think what happened is it's one of those npcs that goes straight into the quest instead of showing you the list of quests, hence the "Accept Quest:" prefix. Then it failed to get the id so it added the original text into the AcceptQuestByName function. Normally it should have worked but it may have just been a timing issue. I could increase the time a bit. It's currently set to 500ms.
But that still leaves the problem of the "Accept Quest:" prefix when it fails to get the id. I'll probably add some code to remove it if it exists.
Ok done. Was a bit tricky because the closest text match was SYS_ACCEPT_QUEST but I'm not sure it uses that. In at least one language I tried the caps were different. So I had to compare lowered caps with lowered caps. Anyway I'll update the post http://www.solarstrike.net/phpBB3/viewt ... 414#p53414.
But that still leaves the problem of the "Accept Quest:" prefix when it fails to get the id. I'll probably add some code to remove it if it exists.
Ok done. Was a bit tricky because the closest text match was SYS_ACCEPT_QUEST but I'm not sure it uses that. In at least one language I tried the caps were different. So I had to compare lowered caps with lowered caps. Anyway I'll update the post http://www.solarstrike.net/phpBB3/viewt ... 414#p53414.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
I've been building up another zone series for Sascilia Steppes (It is going to be HUGE) and noticed that any time the BYNAME key is used to select a conversation option it adds it to the waypoint correctly, but there is no code for createpath to actually select the option, so I'm having to manually click the option after entering it into the waypoint buffer. There is no problem if the option is accepting or completing a quest, as there are RoMScript() commands to click those options in-game.
Starting at line 745:
Starting at line 745:
Code: Select all
else
tmp.wp_type = "COBYNAME"
tmp.text = name
hf_type = sprintf("ChoiceOptionByName \'%s\'",name)
message(prefix..sprintf(language[516], "\'"..name.."\'" ) ); -- ChoiceOptionByName
tmp.keystring = getKeyStrings(name, true)--, "SC_", "SP")
end
Re: createpath + getid + getpos together
The thinking used to be that the user might not want to actually select the quests or options when they are running createpath but now with the quests it was necessary. But I guess to keep it similar I can add the automatic choiceoption too. All it takes is to add a ChoiceOption command.
Wow. Haven't committed in a while. I should do a commit soon.- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
I've been thinking about another idea for a small addition to this utility. I haven't needed it too many times yet, but I still think it may be useful to people who are creating waypoint files inside instances they plan to run solo. What I'm thinking is having a key to insert a "teleport(x,z,y)" at the players current position at the current waypoint. So far I've only had to use it two times in my released full zone packages. Once for the "Jump Training" on the Elven Island, and once to get the cup off the tent in the Dwarven starting zone. Would there be any interest or need to add this, or is it just better to manually enter the command via the Numpad-0 option?
Re: createpath + getid + getpos together
I think that's too specific a need and would just confuse people and you could probably use fly in the same situations.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
Okay, how about fixing this problem in getTEXT? Here is a possible work-around for strings like this:
getTEXT("SC_422150_0") returns
The problem comes when you try to use this in a waypoint with the command and it will not recognize the string in the dialog due to the [$PLAYERNAME] portion.
So in functions.lua at line 2392 I've added:
Code: Select all
SC_422156_0 = "Hello, Master [112850]. I am [$PLAYERNAME]."
getTEXT("SC_422150_0") returns
Code: Select all
"Hello, Master Belintan. I am [$PLAYERNAME]."
Code: Select all
ChoiceOptionByName(getTEXT("SC_422150_0"))
So in functions.lua at line 2392 I've added:
Code: Select all
if subKeyString == "$PLAYERNAME" then
translatedSubTEXT = player.Name
end
Re: createpath + getid + getpos together
There are a LOT of strings that have variables like that. We can't know what those variables hold. It's possible in this case that all $PLAYERNAMEs are in fact the players name so it might be worth adding. We would also have to add $playername, as there are quite a few instances of that too.
Actually looks like there are quite a lot of them so it's definitely worth adding.
Edit: Just noticed the pattern matching excludes subkeystrings that start with $ so they would have to be included for it to match $PLAYERNAME.
Actually looks like there are quite a lot of them so it's definitely worth adding.
Edit: Just noticed the pattern matching excludes subkeystrings that start with $ so they would have to be included for it to match $PLAYERNAME.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: createpath + getid + getpos together
I made that section look like this
Code: Select all
for subKeyString in string.gmatch(resultTEXT,"%[(.-)%]") do
local translatedSubTEXT
if subKeyString:sub(1,1) == "$" then -- variable. See if it's player.
if subKeyString == "$PLAYERNAME" or subKeyString == "$playername" then
translatedSubTEXT = player.Name
end
elseif tonumber(subKeyString) then -- Must be id
translatedSubTEXT = GetIdName(tonumber(subKeyString))
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
Works like a charm. Much more elegant than my attempted solutions.
That's all I can do tonight, the US servers just went down for weekly maintenance.
That's all I can do tonight, the US servers just went down for weekly maintenance.
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
Okay, here's the next one to try and filter in getTEXT()
SC_422335_3 = "Do you know what the effects of [<S>204623] are?"
I think the <S> means to make the object 204623 plural in the dialog.
Edit: Nevermind, this will be extremely language specific. Adding "s" or "es" in English would be easy enough, but that doesn't help if the player's language setting in the game is something else. I think I'll just use a sendMacro("ChoiceOption(#)") command for these.
SC_422335_3 = "Do you know what the effects of [<S>204623] are?"
I think the <S> means to make the object 204623 plural in the dialog.
Edit: Nevermind, this will be extremely language specific. Adding "s" or "es" in English would be easy enough, but that doesn't help if the player's language setting in the game is something else. I think I'll just use a sendMacro("ChoiceOption(#)") command for these.
Re: createpath + getid + getpos together
We could change the id to "Sys204623_name_plural" to get the plural of the name.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
I'll play around with that idea when I get home from work. Learned something new again today. 

Re: createpath + getid + getpos together
Actually I could probably make GetIdName return the plural, or even more information such as the id type and shortnote, but I have to decide how I'm going to make it work. Here are some of the options I can think of.
I'm leaning to either the first or third. I think we should stick to what we need right now.
I just noticed GetIdName doesn't return names for cards and recipes like the item class does. I wonder if I should add it.
Code: Select all
GetIdName(123456,true) -- returns the plural but doesn't allow for getting other info. Maybe this function should only return 'name' related info.
GetIdName(123456, "plural/type/shortnot") -- returns what is specified in the string
GetIdNamePlural(123456) -- A separate function
I just noticed GetIdName doesn't return names for cards and recipes like the item class does. I wonder if I should add it.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
- Bill D Cat
- Posts: 555
- Joined: Sat Aug 10, 2013 8:13 pm
- Location: Deep in the Heart of Texas
Re: createpath + getid + getpos together
I was thinking something along the lines of using the code the way RoM has it in the key string. This would just move the parsing step from getTEXT() to GetIdName() to see if a singular or plural form of the data is required.
Code: Select all
GetIdName(123456) -- Returns the singular name.
GetIdName(<S>123456) -- Returns the plural form of the name.
Who is online
Users browsing this forum: No registered users and 2 guests