New OSDValue control (0.62.6)

Forum Archive - from http://theuniversal.net
Locked
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

New OSDValue control (0.62.6)

Post 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.
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post 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.
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post 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.
User avatar
MasterNiCron
Posts: 582
Joined: Wed Feb 17, 2010 10:57 pm
Location: Frost

Post 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.
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post 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.
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post 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 :)
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post 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.
Locked