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.

Guiimage?

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
CyberxNeku
Member
Member
Posts: 10
Joined: March 24th, 2011, 3:28 pm
Name: Raaaawr!

Guiimage?

Post by CyberxNeku »

Hi I am trying to figure out all the gui commands for the gui messeges. Im having trouble understanding guiimage. I tried looking up examples in data/menus but it was too confusing, and it seemed like the way you can code it can vary. I do know that if u code it like this:

Code: Select all

newgui name [
    guiimage "my_stuff/packages/base/fps/mapname.jpg"
] "headername"

using an image of a custom made map in fps mode as an example (im guessing your PlatinumArtsSandbox folder is the base directory). This will give you small image, not the size of the actual image, on the left side of the gui messege box (don't really know what to call it ^^'). the image also works as a button, that you can give a function to, kinda weird XD.
I read that there are size spesifications you can give as well as the file location but im not sure were to put that as well as how to code it. i tried <scale:128,128> puting that in a couple of places but nothing worked (128px by 128px as an example). I was wondering how the load map menu displays those large images surounded by a fancy border. If someone could please clear up how exacly you code in guiimage with all the spify things you can do with it, i would be very appreciative XD

this is my first post by the way so if something is messed up like the code box thing, Im sry XD
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Guiimage?

Post by Hirato »

Firstly the syntax for guiimage is

Code: Select all

guiimage path action scale border alt-path
secondly
Also, you NEVER EVER EVER explicitly use a package dir in a path
if I ever see something like "my_stuff" in a path, I'll be very unhappy at the very least.

finally
The things inside <> are ignored as far as the engine is concerned.
They're actually commands that affect the loaded texture in different ways.
scale in this case loads up a 128x128 version of the image.
The others should be documented in the wiki and can be viewed in src/engine/texture.cpp otherwise
This is not a url, clicking it is pointless
User avatar
CyberxNeku
Member
Member
Posts: 10
Joined: March 24th, 2011, 3:28 pm
Name: Raaaawr!

Re: Guiimage?

Post by CyberxNeku »

Ah thanks for the reply! Im still a noob at this so im pretty much just playing around with things. Is there a reason why "my_stuff" shouldn't be used? I figured since all the other maps kept there associated images right where the actual maps were, I would do the same O.O it seemed to work decently.

Lets say for example, I create a map and I want a picture of some kind to show up when I hover over the name when I'm loading the map, just like the other maps do. So I create a picture thats 128x128 pixels and name it same as the map that I created, an put it the same folder where that map is (my_stuff/packages/base/fps). Then, in the map I created, I want a sign to show a picture of the map that I'm in using gui's.

That was pretty much the scenario. So should I make a new folder somewhere that has the same image im using for my maps loading picture, and just use that path?
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Guiimage?

Post by chocolatepie33 »

can someone provide me with a good, working example of using guiimage? this would open up many opportunities, from maps to maze paths to poster pics. I might even need a step-by-step tut on this.
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Guiimage?

Post by Leo_V117 »

Example from NEW menus (custom):

Code: Select all

// This here does the loading of crosshairs... Or images if you desire
crosshairlist = ""
crosshairnum = ""
crosshairs = "default" // defined in game
crosshairidx = 0 //the one to set

createcrosshairlist = [
	crosshairlist = ""
	loopfiles f packages/crosshairs png [
		crosshairlist = (concat $crosshairlist (concatword "packages/crosshairs/" $f))
	]
	crosshairnum = (listlen $crosshairlist)
]

Code: Select all

options_crosshairs = [ // This is the section for the actual menu
	guititle "Crosshairs"
	guibar
	guilist [
		loop i (listlen $crosshairs) [
			guiradio (at $crosshairs $i) crosshairidx $i
			guistrut 1
		]
	]
	guistrut 1
	guilist [
		guitext "Current: "
		guistayopen [ guiimage (getcrosshair $crosshairidx) [echo (getcrosshair $crosshairidx) ] .5 0]
	]
	guistrut 1

	guistayopen [
		loop i (div (+ 7 $crosshairnum) 8) [
			guilist [
				loop j (min 8 (- $crosshairnum (* $i 8))) [
					idx = (+ (* $i 8) $j)
					guiimage (at $crosshairlist $idx) [loadcrosshair @(at $crosshairlist $idx) @crosshairidx] 1 0
				]
			]
		]
	]
	guibar
	guibutton "Back"	[submenu_content = $options_general]
]
That a good example?
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Guiimage?

Post by chocolatepie33 »

Ummm... it's okay, but I'm thinking more of a interaction kind of way, not a pick-a-crosshair way. Like this example:

You see a picture on a wall. You walk up to it. A menu opens up, and it shows you the poster advertising something. Then you go to that event.
I'm looking for the code that would put the picture in the menu. It'd be like this:

Code: Select all

level_trigger_# = [showgui poster]
newgui poster [
guiimage (whatever goes here)
guibar
guibutton "Let's go!" [cleargui]
]
The guiimage command doesn't work, and I think it might have to be an image path problem for me. I do like the crosshair example, but it's actually overly complicated for me.
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Guiimage?

Post by Leo_V117 »

Well... All you should need is this:

Code: Select all

guiimage "images/poster01.jpg" [showgui event01] 1 0
Explanation: guiimage = command | "images/poster01.jpg" = path | [showgui event01] = show event menu | 1 = size (1 = default image size) | 0 = no border.

That okay?
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Guiimage?

Post by chocolatepie33 »

once again, it's close, but doesn't tell me all of what I need. WHERE WOULD THE ACTUAL IMAGE GO???? Under mystuff, under PAS2.6.1 (home folder), under fps, etc...?
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
java.x.beast
Member
Member
Posts: 194
Joined: August 10th, 2011, 2:35 pm
Name: Addis
IRC Username: javaxbeast
Location: Chicago, IL
Contact:

Re: Guiimage?

Post by java.x.beast »

If you mean where would you place the image in your PAS folder, it can go anywhere as far as I know. Again, I might not be right. If you create a new folder inside /data called guiimages, I'm pretty sure the following would work:

Code: Select all


newgui poster
guititle "Poster"
guibar
guiimage "data/guiimages/posterimg.jpg" [showgui event] 8 0
guitext "You should go! (click on image or button)"
guibar
guibutton "Let's go!" [showgui event]
] "Poster"

As you can see, I created a new gui with the title "Poster". Next, I put a bar to separate the title from the image. Next, I used the command "guiimage" to create a new image. The "data/guiimages/posterimg.jpg" tells the "guiimage" to look for the picture called "posterimg" inside the folder "guiimages" which is inside the folder "data". The "[showgui event]" command tells it to open up the gui titled "event" when the image is clicked on. The 8 next to it tells it to resize the image to eight, I did this because I thought it would be a good size for a poster image inside a gui. The 0 next to the 8 tells the main command (guiimage) to not put a border around it. Then, I added an additional bar after the image to make the image stand out. I'm sure you understand the functions of "guibutton", so I won't explain that part. After that, I just closed off the gui and renamed it.

Hope this helped!

CEO of Vulcanis Entertainment,
Addis Regassa
Age of Darkness
Maps: Image
Music: Image
Models: Image
Scripts: Image
Other: Image
Visit the company website: (In progress (Expected to be released in two weeks :uber:) 8-) :D 8-) )
Visit the company page on ModDB: Vulcanis Entertainment
java.x.beast wrote: I got them moves like JAGger!!!
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Guiimage?

Post by chocolatepie33 »

It worked, albeit the fact that the menu included the text on a separate tab, but hey, I'm glad it worked. Thanks a lot.
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
Locked