Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

cooking script

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

cooking script

Post by kddekadenz »

I wanted to make a guislider for the amount of meat which should be cooked.

The guislider doesn't show up for me (note that 19 is the ID of raw meat and 20 the ID of cooked meat):

Code: Select all

meat_count = (r_get_amount player 19)

r_script_signal interact [
			r_chat self 0
]


r_script_say "What do you want to cook?" [ //0
	if ( > (r_get_amount player 19) 0) [
		r_response "[Cook 'Meat']" 1
	]
	r_response "Nothing." -1
]

r_script_say "How much you want to cook?" [ //1
guislider meat_count
r_response "[OK]" 2
r_response "Nothing" -1
]

r_script_say "The meat is cooked." [ //2
	r_response "Take the meat." -1 [
	r_additem player 20 (meat_count)
	r_remove player 19 (meat_count)
	]
	
]
Any idea what's my mistake?
Last edited by kddekadenz on May 11th, 2012, 10:47 am, edited 1 time in total.
Kelgar is an advanced RPG beeing developed in Sandbox
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Guislider in RPG dialog?

Post by arcones »

A common mistake that trips me up is missing quotation marks ( " ) or a bracket. So if there's quotation marks missing for you guislider meat count, that might be it, but I would think Sandbox would pick it up.

That would be my suggestion.
Image
Want a user bar like this one? PM Leo!
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Guislider in RPG dialog?

Post by Hirato »

RPG dialogue just doesn't work that way. the r_response thing is meant to be a UI system independent means of defining dialogue.
Naturally sliders won't work
This is not a url, clicking it is pointless
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Guislider in RPG dialog?

Post by chocolatepie33 »

from your devblog:
We've picked it up again and we hope to have UI replace the old 3dgui by 2.8.0, we unfortunately have a LOT of work to do before the switch is even feasible.
For starters, there are the missing elements, there are basically 3 scenarios we need to be able to cover which the current UI facilities don't provide. As follows they are...

1. a guislider equivalent
2. some sort of dynamic text
3. a guifield equivalent
4. a guikeyfield equivalent
5. the ability to wrap text

We can more or less tackle the first case by jury-rigging the scrollbar code to function as the sliders and this is the approach I've taken, so our sliders have scrolling areas as well as a button in the centre to signify its position. While this has been completed, it's still a bit buggy, for example it handles integers (read: ID_VAR) very poorly. In addition it also lacks 2 capabilities I'd very much like some sort of "onchange" scrip and the ability to scroll up/left and down/right usign the mouse wheel or even the appropriate directional keys.
So you have it, it's just not quite implemented yet?
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Guislider in RPG dialog?

Post by Hirato »

We've already implemented that.
UI should very much explain why the dialogue system was designed as is; UI system agnostic.

There are some screenshots on moddb regarding an earlier more experimental version.
http://www.moddb.com/games/platinum-art ... 2#imagebox
This is not a url, clicking it is pointless
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: Guislider in RPG dialog?

Post by kddekadenz »

Hirato wrote:RPG dialogue just doesn't work that way. the r_response thing is meant to be a UI system independent means of defining dialogue.
Naturally sliders won't work
Hmm.
And could be a command be executed when the response is chosen?

Code: Select all

r_response (format "%1 meat" (meat_cook)) [meat_cook = meat_cook + 1]
This displays the first dialogue when chosen :/ Note: setted meat_cook to 0 at beginning
Kelgar is an advanced RPG beeing developed in Sandbox
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Guislider in RPG dialog?

Post by Hirato »

the syntax is r_response text dst script.
so yes, you could do something like that. Though I'd suggest using a series of fixed size queries for now.
eg, cook 1, cook 5, cook 10, cook 20, cook 50, cook 100, etc
This is not a url, clicking it is pointless
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: Guislider in RPG dialog?

Post by kddekadenz »

Works now fine :D

Here is the code, for anyone who is interested:

Code: Select all

//cook stuff, currently only meat
// 19 - ID of raw meat
// 20 - ID of cooked meat

meat_cook = 0

r_script_signal interact [
			r_chat self 0
]


r_script_say "What do you want to cook?" [ //0
	if ( > (r_get_amount player 19) 0) [
		r_response "[Cook 'Meat']" 1
	]
	r_response "Nothing." -1
]

r_script_say "How much you want to cook?" [ //1
r_response "everything" 2 "meat_cook = (r_get_amount player 19)"
r_response "1 meat" 2 "meat_cook = 1"
if ( > (r_get_amount player 19) 4) [r_response "5 meat" 2 "meat_cook = 5"]
if ( > (r_get_amount player 19) 9) [r_response "10 meat" 2 "meat_cook = 10"]
r_response "nothing" -1
]

r_script_say "The meat is cooked." [ //2
	r_response "Take the meat." -1 [
	r_additem player 20 (meat_cook)
	r_remove player 19 (meat_cook)
	]
	
]
Kelgar is an advanced RPG beeing developed in Sandbox
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Guislider in RPG dialog?

Post by chocolatepie33 »

Good job, kdd.

Anyways, *Slaps self*

Sorry about the (idiotic) post about the newUI slider, I just went from slider to slider and ignored the RPG to newui stuff. Again, sorry about that.
However, that means that when newUI comes about, it'll be just fine to use for everything?
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Guislider in RPG dialog?

Post by Hirato »

RPG wise? Yeah
I still need to do something about the FPS's scoreboard...

Most of the non-editing UIs should be up to scratch with their 3dgui counterparts.
This is not a url, clicking it is pointless
Locked