Page 1 of 1
New OSDValue control (0.62.6)
Posted: Sun Aug 12, 2012 4:32 pm
by Mit
While its fresh..
Code: Select all
osdaddat(OSDVALUE, 100, 100, 100, 20, "buyval", "$BuyPrice|0|50|1|Not Buying")
osdaddat(OSDBUTTON, 220, 100, 150, 20, "SetBuy|&buyval", "Set Buy Price")
because it was needed.
Params in the text field of the OSDValue are default value | Min Val | Max Val | Min Step | Min Val Text
(The 'min step' & 'min val text' are optional)
The &buyval reference in the params of the OSDButton response is replaced by the client with the current value of the named control, and accessed serverside in the normal way (i.e. $gParam[..] ). You can reference multiple value controls from a single button.
Posted: Sun Aug 12, 2012 5:52 pm
by Mit
alongside that, also added OSDAPPLYBUTTON and OSDAPPLYEXITBUTTON, which are same as the normal BUTTON and EXITBUTTON but they only light up when one of the value controls on the screen has changed value.
Posted: Sun Aug 12, 2012 6:31 pm
by zaroba
That is great mit
I'm assuming it's a to allow players to set buy and sale prices for items in a shop and provides the capability for min and max settable prices? If so, I must say I love that. I will be using that for every item on zoric and future worlds that use OSDs to prevent people from setting ridiculously high sale prices. Perhaps to prevent super low sale prices as well.
Is it possible to reference that buy price value in the OSD and other scripts? Thinking it might be nice to have the script calculate and display the total cost to make an item by adding up the buy prices of the necessary supplies, that way players will better know what to set sale prices at. Also then to use the limits to prevent players from selling for less then the item costs them to make the item.
Posted: Sun Aug 12, 2012 7:23 pm
by MasterNiCron
i would say it great but i have no idea what it is suposed to mean. lest not till i get the world program to mess with. i have never programed any thing ever so i have no idea what to do with scripts till i got a way to test them
may end up needing some 1 else to right the scripts ill be needing for my world but will try my hand at it first.
Posted: Mon Aug 13, 2012 11:56 pm
by Mit
Don't worry, blaze.. i have little idea what most of it means either unless im drunk enuf
. The samples should help a bit when the time comes.
this thread will be the 0.62.6 script features holding list... Next... extra param on OSDCreate which specifies a time limit for the dialog. Also added a new OSD type = OSDPOPUP which appears in a lil fixed sized window at the top right of the screen and is unaffected by escape.
e.g.
Code: Select all
osdcreate(OSDPOPUP,"CrowPopup", "Sign up for The Shamanic Crow Tournament", 60 )
osdaddat(OSDEXITBUTTON, 50, 20,200,60, "Signup", "Sign Up")
osdactivate()
Would make a lil box appear in the top right with a signup button. If the user hasnt pressed the button after 60 seconds the dialog will close itself.
Posted: Tue Aug 14, 2012 1:23 am
by Mit
oh btw.. in response to:
I'm assuming it's a to allow players to set buy and sale prices for items in a shop and provides the capability for min and max settable prices?
thats one use, but the value control is just a generic control and could be used for whatever.. the bet in a hand of blackjack, or the vehicle to select, or whatever.
That the example has 'buyval' and the variable $BuyPrice in the code is just that sample.. all those numbers (and the text) can be variables too, which can be set based on player inventory, capacities, or whatever other source of information you want to use to determine the range & limits of values that the player can choose.
but yeh.. setting buy and sell prices is the first use i'll be making of it
Posted: Thu Sep 13, 2012 8:13 pm
by zaroba
using latest server and client, this seems to not work...although its more probable that i'm doing something wrong.
Code: Select all
Event("&command", "test")
{
*say server var 1 = $gServerVar1
osdcreate(OSDLIST,"test","test")
osdadditem(OSDTEXT, "", " ")
osdaddat(OSDVALUE, 100, 100, 100, 20, "buyval", "$gServerVar1|0|50|1|Not Buying")
osdaddat(OSDBUTTON, 220, 100, 150, 20, "SetBuy|&buyval", "Set Buy Price")
osdadditem(OSDTEXT, "", " ")
osdactivate()
}
Took the first example and changed the $buyvar to $gServerVar1
$gserverVar1 remains at 0.