Thread Rating:
- 0 Votes - 0 Average
- 1
- 2
- 3
- 4
- 5
Vendor Shop HELP
|
Author |
Message |
Skul
Master
Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9
|
RE: Vendor Shop HELP
tag.override.value would be great.
this is the best script I could 'muster' up, it sendpacket doesn't work at all, not sure why exactly, here it is:
Code:
[function testbuy]
sysmessage Buy from who?
targetf f_testbuy
[function testbuy]
if (<argo.ischar>)
if (<argo.npc>==brain_vendor)
if (<argo.findlayer.26.rescount>)
forcont <argo.findlayer.26>
if (<tag0.override.value>)
local.x += 1
local.id<dlocal.x>.value=<tag0.override.value>
local.id<dlocal.x>.name=<name>
elseif (<value>)
local.x += 1
local.id<dlocal.x>.value=<value>
local.id<dlocal.x>.name=<name>
endif
endfor
if (<local.x>)
for x 1 <local.x>
if (strmatch(<local.packet>,0))
local.packet=d<local.id<dlocal.x>.value> <eval strlen(<local.id<dlocal.x>.name>)> <char_to_asc <local.id<dlocal.x>.name>>
else
local.packet=<local.packet> d<local.id<dlocal.x>.value> <eval strlen(<local.id<dlocal.x>.name>)> <char_to_asc <local.id<dlocal.x>.name>>
endif
endfor
sendpacket 074 <totalargs 074 0 d<targ.uid> <local.x> <local.packet>> d<targ.uid> <local.x> <local.packet>
endif
else
argo.speak i have nothing to sell.
endif
endif
endif
[function char_to_asc]
if !(<isempty <args>>)
local.x=<eval strlen(<args>)>
local.args=<args>
while (<local.x>)
if (strmatch(<local.return>,0))
local.return=<asc <strsub 0 1 <local.args>>>
else
local.return=<local.return> <asc <strsub 0 1 <local.args>>>
endif
local.args=<strsub 1 0 <local.args>>
local.x -= 1
endwhile
endif
return <local.return>
[function totalargs]
if !(<isempty <args>>)
local.args=<args>
while !(strmatch(<local.args>,0))
local.x += 1
local.args=<streat <local.args>>
endwhile
endif
return <dlocal.x>
[eof]
"I ask a question to the answer I already know."
Marchadium :: http://www.marchadium.ca/ :: Join us!
|
|
09-24-2012 02:41 PM |
|
|
Extreme
Grandmaster Poster
Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20
SphereCommunity
|
|
09-24-2012 03:14 PM |
|
|
Skul
Master
Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9
|
RE: Vendor Shop HELP
ya i know lol, I'm still having problems with it... same errors too.
Well here's the amazing piece of code that doesn't crash or anything, the packet doesn't do anything, looks right to me, any guesses?
Code:
[function testbuy]
sysmessage Buy from who?
targetf f_testbuy
[function f_testbuy]
if (<argo.ischar>)
if (<argo.npc>==brain_vendor)
if (<argo.findlayer.26.rescount>)
forcont <argo.findlayer.26>
if (<tag0.override.value>) || (<value>)
local.x += 1
local.id<dlocal.x>.name=<name>
local.id<dlocal.x>.value=<qval <tag0.override.value> ?<tag0.override.value>:<value>>
endif
endfor
if (<local.x>)
for x 1 <local.x>
if (strmatch(<local.packet>,0))
local.packet=d<local.id<dlocal.x>.value> <eval strlen(<local.id<dlocal.x>.name>)> <asc <local.id<dlocal.x>.name>>
else
local.packet=<local.packet> d<local.id<dlocal.x>.value> <eval strlen(<local.id<dlocal.x>.name>)> <asc <local.id<dlocal.x>.name>>
endif
local.packetlength += <eval <eval strlen(<local.id<dlocal.x>.name>)> +5>
endfor
sendpacket 074 w<eval <local.packetlength> +10> d<argo.uid> <local.x> 0 <local.packet> 0
endif
else
argo.speak i have nothing to sell.
endif
endif
endif
"I ask a question to the answer I already know."
Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 09-24-2012 04:22 PM by Skul.)
|
|
09-24-2012 03:59 PM |
|
|
Skul
Master
Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9
|
RE: Vendor Shop HELP
Well this code sort of works, it's an item list? I don't know, maybe you can find it useful:
Code:
[function testbuy2]
sysmessage Buy from who?
targetf f_testbuy2
[function f_testbuy2]
if (<argo.ischar>)
if (<argo.npc>==brain_vendor)
if (<argo.findlayer.26.rescount>)
forcont <argo.findlayer.26>
if (<tag0.override.value>) || (<value>)
local.x += 1
local.uid<dlocal.x>=<uid>
endif
endfor
if (<local.x>)
for x 1 <local.x>
if (strmatch(<local.packet>,0))
local.packet=w<uid.<local.uid<dlocal.x>>.baseid> w<uid.<local.uid<dlocal.x>>.color> <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> <asc <uid.<local.uid<dlocal.x>>.name>>
else
local.packet=<local.packet> w<uid.<local.uid<dlocal.x>>.baseid> w<uid.<local.uid<dlocal.x>>.color> <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> <asc <uid.<local.uid<dlocal.x>>.name>>
endif
local.packetlength += <eval <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> +5>
endfor
local.title=<argo.title> Shoppe
local.packetlength += <eval strlen(<local.title>)>
sendpacket 07c w<eval <local.packetlength> +11> d<argo.uid> w0870 <eval strlen(<local.title>)> <asc <local.title>> <local.x> <local.packet>
endif
else
argo.speak I have nothing to sell.
endif
endif
endif
Here, this is the code you want, it's unfinished but at least you can view the shop list and use <tag.override.value> on any item.
Code:
[function testbuy3]
sysmessage Buy from who?
targetf f_testbuy3
[function f_testbuy3]
if (<argo.ischar>)
if (<argo.npc>==brain_vendor)
if (<argo.findlayer.26.rescount>)
forcont <argo.findlayer.26>
if (<tag0.override.value>) || (<value>)
local.x += 1
local.uid<dlocal.x>=<uid>
if (<tag0.override.value>)
local.uid<dlocal.x>.value=<tag0.override.value>
else
local.uid<dlocal.x>.value=<value>
endif
endif
endfor
if (<local.x>)
for x 1 <local.x>
if (strmatch(<local.packet>,0))
local.packet=d<local.uid<dlocal.x>> w<uid.<local.uid<dlocal.x>>.baseid> w<uid.<local.uid<dlocal.x>>.color> w<uid.<local.uid<dlocal.x>>.amount> w<uid.<local.uid<dlocal.x>>.value> w<eval strlen(<uid.<local.uid<dlocal.x>>.name>)> <asc <uid.<local.uid<dlocal.x>>.name>>
else
local.packet=<local.packet> d<local.uid<dlocal.x>> w<uid.<local.uid<dlocal.x>>.baseid> w<uid.<local.uid<dlocal.x>>.color> w<uid.<local.uid<dlocal.x>>.amount> w<uid.<local.uid<dlocal.x>>.value> w<eval strlen(<uid.<local.uid<dlocal.x>>.name>)> <asc <uid.<local.uid<dlocal.x>>.name>>
endif
local.packetlength += <eval <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> +14>
endfor
serv.log <local.packet>
sendpacket 09e w<eval <local.packetlength> +9> d<argo.uid> w<local.x> <local.packet>
return 1
endif
endif
argo.speak I have nothing to sell.
endif
endif
"I ask a question to the answer I already know."
Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 09-26-2012 02:39 PM by Skul.)
|
|
09-26-2012 02:13 PM |
|
|
Extreme
Grandmaster Poster
Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20
SphereCommunity
|
|
09-27-2012 01:22 AM |
|
|
User(s) browsing this thread: 3 Guest(s)