Page 5 of 9
Re: createpath + getid + getpos together
Posted: Sat Oct 19, 2013 10:15 am
by rock5
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.
Re: createpath + getid + getpos together
Posted: Sun Oct 20, 2013 1:27 am
by rock5
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.
Re: createpath + getid + getpos together
Posted: Mon Oct 28, 2013 1:24 pm
by Bill D Cat
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:
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.'
Results in this when executed:
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.
Edit: ChoiceOptionByName(RoMScript("TEXT(\"SC_425068_0\")")) seems to work.
Re: createpath + getid + getpos together
Posted: Mon Oct 28, 2013 2:50 pm
by rock5
I think line 347
Code: Select all
tmptext = sprintf("(\"%s\") -- \'%s\'", v.keystring, v.text)
should be
Code: Select all
tmptext = sprintf("(getTEXT(\"%s\")) -- \'%s\'", v.keystring, v.text)
Re: createpath + getid + getpos together
Posted: Mon Oct 28, 2013 11:23 pm
by rock5
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.
Re: createpath + getid + getpos together
Posted: Tue Oct 29, 2013 10:51 am
by Bill D Cat
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:
Code: Select all
AcceptQuestByName("Accept Quest: Hate Bugs")
I don't think that using the waypoint in that condition would actually work properly.

Re: createpath + getid + getpos together
Posted: Tue Oct 29, 2013 12:49 pm
by rock5
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.
Re: createpath + getid + getpos together
Posted: Thu Nov 14, 2013 6:23 am
by Bill D Cat
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:
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
Posted: Thu Nov 14, 2013 7:52 am
by rock5
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.
Re: createpath + getid + getpos together
Posted: Mon Nov 18, 2013 11:59 pm
by Bill D Cat
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
Posted: Tue Nov 19, 2013 12:07 am
by rock5
I think that's too specific a need and would just confuse people and you could probably use fly in the same situations.
Re: createpath + getid + getpos together
Posted: Tue Nov 19, 2013 2:22 am
by Bill D Cat
Okay, how about fixing this problem in getTEXT? Here is a possible work-around for strings like this:
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]."
The problem comes when you try to use this in a waypoint with the command
Code: Select all
ChoiceOptionByName(getTEXT("SC_422150_0"))
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
if subKeyString == "$PLAYERNAME" then
translatedSubTEXT = player.Name
end
Re: createpath + getid + getpos together
Posted: Tue Nov 19, 2013 2:58 am
by rock5
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.
Re: createpath + getid + getpos together
Posted: Tue Nov 19, 2013 3:16 am
by rock5
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))
Re: createpath + getid + getpos together
Posted: Tue Nov 19, 2013 3:58 am
by Bill D Cat
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.
Re: createpath + getid + getpos together
Posted: Tue Nov 19, 2013 1:59 pm
by Bill D Cat
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.
Re: createpath + getid + getpos together
Posted: Tue Nov 19, 2013 10:53 pm
by rock5
We could change the id to "Sys204623_name_plural" to get the plural of the name.
Re: createpath + getid + getpos together
Posted: Wed Nov 20, 2013 12:03 am
by Bill D Cat
I'll play around with that idea when I get home from work. Learned something new again today.

Re: createpath + getid + getpos together
Posted: Wed Nov 20, 2013 1:28 am
by rock5
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.
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'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.
Re: createpath + getid + getpos together
Posted: Wed Nov 20, 2013 1:49 am
by Bill D Cat
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.