MF99K Posted March 28, 2016 Share Posted March 28, 2016 I'm making a mod that basically puts the slot machine from shipwrecked into don't starve together. The problem is, it won't accept payment and no hover option appears besides "examine." I believe this is because of an event in the slot machine's code that DST doesn't recognize called "acceptcurrency." does anyone else agree this is most likely the problem, and if so, how would I fix it? is there another code I would need to add somewhere or something? and if you don't think this is the problem, what else could be the issue? Link to comment Share on other sites More sharing options...
Soto8969 Posted March 28, 2016 Share Posted March 28, 2016 I don't know about modding, but i think you could use a code similar to the pig king(you give him meat/trinkets, he gives you an amount of gold) Link to comment Share on other sites More sharing options...
CarlZalph Posted March 28, 2016 Share Posted March 28, 2016 (edited) See trader component. As for the thread title's question, do a find string in all the lua files for: PushEvent(" Edited March 28, 2016 by CarlZalph Link to comment Share on other sites More sharing options...
MF99K Posted March 28, 2016 Author Share Posted March 28, 2016 4 hours ago, CarlZalph said: See trader component. As for the thread title's question, do a find string in all the lua files for: PushEvent(" That isn't the issue, the slot machine has its very own component, "payable" instead. how would I be able to search for a line of code like that in ALL the shipwrecked lua files? Link to comment Share on other sites More sharing options...
PanAzej Posted March 28, 2016 Share Posted March 28, 2016 3 minutes ago, mf99k said: That isn't the issue, the slot machine has its very own component, "payable" instead. how would I be able to search for a line of code like that in ALL the shipwrecked lua files? "PushEvent" is used mostly in components, so you could open components you want to check and if you're using Notepad++, use ctrl+f to find this line... Link to comment Share on other sites More sharing options...
CarlZalph Posted March 28, 2016 Share Posted March 28, 2016 (edited) 9 minutes ago, mf99k said: That isn't the issue, the slot machine has its very own component, "payable" instead. how would I be able to search for a line of code like that in ALL the shipwrecked lua files? If you're trying to do a 1:1 port of the item in specific without using any of the already made assets DST has to offer, such as the trader component, then look in the lua script folder the shipwrecked mod has and port over the components it's using. If I had to take a guess, then it's in a folderpath with DLC0002 as its name. However, I just looked at a video showcasing this slot machine and the trader component would suffice in generating the callbacks required for what you're wanting to do. As for doing a file search that really depends on your OS and envrionment. If under Windows and using N++ then you can do a recursive find in files via Search->Find in Files...->Find what & Directory & In all sub-folders & Filters: *.lua. Edited March 28, 2016 by CarlZalph Filters: *.lua Link to comment Share on other sites More sharing options...
MF99K Posted March 28, 2016 Author Share Posted March 28, 2016 Just now, CarlZalph said: If you're trying to do a 1:1 port of the item in specific without using any of the already made assets DST has to offer, such as the trader component, then look in the lua script folder the shipwrecked mod has and port over the components it's using. If I had to take a guess, then it's in a folderpath with DLC0002 as its name. However, I just looked at a video showcasing this slot machine and the trader component would suffice in generating the callbacks required for what you're wanting to do. As for doing a file search that really depends on your OS and envrionment. If under Windows and using N++ then you can do a recursive find in files via Search->Find in Files...->Find what & Directory & In all sub-folders. I already ported the components it's using. The issue is that the game doesn't seem to recognize that it's supposed to accept gold from the player and I'm pretty sure this is either because the slot machine's prefab isn't communicating with the payable component correctly or that the game doesn't understand the payable component. Link to comment Share on other sites More sharing options...
Muche Posted March 28, 2016 Share Posted March 28, 2016 acceptcurrency is being pushed in payable component. However I did not find any mention of ListenForEvent("acceptcurrency" anywhere, so the event itself looks like mod-friendly way to hook into it. Searching for components.payable, it is used in slotmachine prefab, GIVE action and currency component. I have no experience modding DS, thus I can only infer that DS's function Currency:CollectUseActions(doer, target, actions) if target.components.payable and target.components.payable.enabled then table.insert(actions, ACTIONS.GIVE) end end is not compatible with the way DST collects actions. Maybe something like this would be a step towards solution: AddComponentAction("USEITEM", "currency", function(inst, doer, target, actions, right) if target.components.payable and target.components.payable.enabled then table.insert(actions, ACTIONS.GIVE) end end) One has yet to solve the issue of components that are not existing on the client. Link to comment Share on other sites More sharing options...
MF99K Posted March 29, 2016 Author Share Posted March 29, 2016 21 hours ago, Muche said: acceptcurrency is being pushed in payable component. However I did not find any mention of ListenForEvent("acceptcurrency" anywhere, so the event itself looks like mod-friendly way to hook into it. Searching for components.payable, it is used in slotmachine prefab, GIVE action and currency component. I have no experience modding DS, thus I can only infer that DS's function Currency:CollectUseActions(doer, target, actions) if target.components.payable and target.components.payable.enabled then table.insert(actions, ACTIONS.GIVE) end end is not compatible with the way DST collects actions. Maybe something like this would be a step towards solution: AddComponentAction("USEITEM", "currency", function(inst, doer, target, actions, right) if target.components.payable and target.components.payable.enabled then table.insert(actions, ACTIONS.GIVE) end end) One has yet to solve the issue of components that are not existing on the client. I changed the code to currency as you said and now the game crashes when I approach the slot machine. Once again I'm having the nothing-in-the-error-logs problem. Link to comment Share on other sites More sharing options...
Muche Posted March 29, 2016 Share Posted March 29, 2016 I guess you haven't tried this way - SlotMachine-v1.4b.zip (based on v1.4), because with it it crashes with [string "../mods/653805554-Slot Machine/scripts/pref..."]:279: variable 'GetTreasureLootList' is not declared. Link to comment Share on other sites More sharing options...
Aquaterion Posted March 30, 2016 Share Posted March 30, 2016 17 hours ago, mf99k said: I changed the code to currency as you said and now the game crashes when I approach the slot machine. Once again I'm having the nothing-in-the-error-logs problem. you sure ur looking in clientlog and not log right? cuz its highly unlikely to crash without a single line of error.. Link to comment Share on other sites More sharing options...
MF99K Posted March 30, 2016 Author Share Posted March 30, 2016 4 hours ago, Aquaterion said: you sure ur looking in clientlog and not log right? cuz its highly unlikely to crash without a single line of error.. yes, I looked in log, AND client_log AND all the cluster logs. The only thing that's been updating in client_log is all the commands I've been putting in console, and then the log just abruptly stops when the crash happens with no information. and none of the other logs seem to be updating at all. This problem seems to have started around the time the game was last updated, so I feel it has something to do with that, but I have received errors for other crashes since then (but only on the crash warning screen) Link to comment Share on other sites More sharing options...
Muche Posted March 30, 2016 Share Posted March 30, 2016 Just wondering, are you testing this on hosted single-level world (i.e. only client_log is updated), or hosted multi-level / dedicated server (client_log and server_logs are updated)? Link to comment Share on other sites More sharing options...
MF99K Posted March 30, 2016 Author Share Posted March 30, 2016 (edited) 7 hours ago, Muche said: Just wondering, are you testing this on hosted single-level world (i.e. only client_log is updated), or hosted multi-level / dedicated server (client_log and server_logs are updated)? I'm pretty sure the one I'm using is single-level, since the client_log has been updating and there are no caves as a note, the keyboard on my modding computer is broken right now so I'm not gonna be able to test anything with the code until I get it fixed. Edited March 30, 2016 by mf99k Link to comment Share on other sites More sharing options...
MF99K Posted April 1, 2016 Author Share Posted April 1, 2016 at this point I have no idea what's wrong, anyone wanna take a look and see if it's something obvious? slot machine.zip Link to comment Share on other sites More sharing options...
DarkXero Posted April 1, 2016 Share Posted April 1, 2016 Changes: - added payable tags on payable component on "enabled" member change, for client interaction - moved AddComponentAction from currency.lua to modmain.lua, changed implementation to use tags -- target with payable component will have "payable" tag if (target.components.payable and target.components.payable.enabled) is true -- players make use of this check, so hosts and clients both need to be able to do it -- the tag propagates through the network, so everybody can work with it -- CollectUseActions and other action functions that fill up the playeractionpicker only work in single player, not DST -- extended the give action to introduce currency functionality -- the give function of the give action only takes care of the trader component, and not the currency one - added network functionality to the prefab -- lack of AddNetwork was likely the reason of the crashes without logs (RakNet missing replica error) - added currency component to goldnugget prefab -- the slot machine will accept the goldnugget, yes, but you can't give it to it, if it doesn't have the currency component -- because it's no currency, so the component action doesn't apply - commented out GetTreasureLootList for the SpawnReward function of the machine -- it isn't defined or implemented yet, so it causes a crash, go work on it slot machine.zip Link to comment Share on other sites More sharing options...
MF99K Posted April 1, 2016 Author Share Posted April 1, 2016 12 hours ago, DarkXero said: Changes: - added payable tags on payable component on "enabled" member change, for client interaction - moved AddComponentAction from currency.lua to modmain.lua, changed implementation to use tags -- target with payable component will have "payable" tag if (target.components.payable and target.components.payable.enabled) is true -- players make use of this check, so hosts and clients both need to be able to do it -- the tag propagates through the network, so everybody can work with it -- CollectUseActions and other action functions that fill up the playeractionpicker only work in single player, not DST -- extended the give action to introduce currency functionality -- the give function of the give action only takes care of the trader component, and not the currency one - added network functionality to the prefab -- lack of AddNetwork was likely the reason of the crashes without logs (RakNet missing replica error) - added currency component to goldnugget prefab -- the slot machine will accept the goldnugget, yes, but you can't give it to it, if it doesn't have the currency component -- because it's no currency, so the component action doesn't apply - commented out GetTreasureLootList for the SpawnReward function of the machine -- it isn't defined or implemented yet, so it causes a crash, go work on it slot machine.zip in other words everything except the treasure loot list works? Link to comment Share on other sites More sharing options...
Aquaterion Posted April 1, 2016 Share Posted April 1, 2016 6 minutes ago, mf99k said: in other words everything except the treasure loot list works? So wait you weren't the person who uploaded a slot machine mod like 2-3 hours ago? Link to comment Share on other sites More sharing options...
MF99K Posted April 1, 2016 Author Share Posted April 1, 2016 Just now, Aquaterion said: So wait you weren't the person who uploaded a slot machine mod like 2-3 hours ago? what? Link to comment Share on other sites More sharing options...
Aquaterion Posted April 1, 2016 Share Posted April 1, 2016 Just now, mf99k said: what? if you go to recent mods in DST, you'll find Slot Machine in the latest 5-20 depending on when you check Link to comment Share on other sites More sharing options...
MF99K Posted April 1, 2016 Author Share Posted April 1, 2016 1 minute ago, Aquaterion said: if you go to recent mods in DST, you'll find Slot Machine in the latest 5-20 depending on when you check If there's only one then yes it's mine Link to comment Share on other sites More sharing options...
DarkXero Posted April 1, 2016 Share Posted April 1, 2016 26 minutes ago, mf99k said: in other words everything except the treasure loot list works? The stategraph didn't seem to have anything that clashed with DST. The payable component didn't, either, in terms of functionality, as it is. I could insert gold nuggets into the slot machine both as host and as client. So that's a yes. Link to comment Share on other sites More sharing options...
MF99K Posted April 1, 2016 Author Share Posted April 1, 2016 Just now, DarkXero said: The stategraph didn't seem to have anything that clashed with DST. The payable component didn't, either, in terms of functionality, as it is. I could insert gold nuggets into the slot machine both as host and as client. So that's a yes. anything in particular with the treasure loot list seem to be a problem? I'm not sure where to start Link to comment Share on other sites More sharing options...
Muche Posted April 1, 2016 Share Posted April 1, 2016 I can see two slot machine mods - mf99k's, and @Maris's. Link to comment Share on other sites More sharing options...
DarkXero Posted April 1, 2016 Share Posted April 1, 2016 2 minutes ago, mf99k said: anything in particular with the treasure loot list seem to be a problem? I'm not sure where to start treasurehunt.lua in scripts/map/ wasn't required. Thus, GetTreasureLootList is nil. require("map/treasurehunt") and uncomment the line with GetTreasureLootList. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now