I was wondering where I could find an equivalent for ALL the functions directly implemented in event but in script. On the wiki there are some examples (pbWait(x),pbShake(power,speed,x),pbFlash(color,x),pbToneChangeAll(tone,duration),pbMoveRoute(event,commands)) and then a list of actions that seem to be inside "moveroute" and I don't understand how to use them.
I'm much interested on how to display a picture on the screen and how to move it.
Your error looks like you've tried to do nil.pbShowPicture (although probably not literally nil on the lhs). Ideally you'd want to call the existing pbShowPicture on an object of the appropriate class (i.e. the class where pbShowPicture is defined). But maybe you could copy the function elsewhere, provided it doesn't depend on anything else from inside that class.
Press Ctrl+C to copy this message to the clipboard.
note that when I added the definition of pbshowpicture in item, i had no more error message but still no picture showing.
note2 that when i do this the action always shows the message "can't use that here" in the end
The Interpreter script section is a useful script section to reference in this case as its what actually runs the commands from the event. flippimg through that is a good place to start.
somw of those methods have be overridden in later script sections though, but I dont remember wich ones at the moment.
though when I use the item it says "can't use that here"
What am I doing wrong?
I looked for a possible reason for this message to be displayed as the sentence is not defined in my item effect and I found this
elsif $ItemData[item][ITEMUSE]==2 # Item is usable from bag
when 0; return 0
when 1; return 1 # Item used
when 2; return 2 # Item used, end screen
when 3; bag.pbDeleteItem(item); return 1 # Item used, consume item
when 4; bag.pbDeleteItem(item); return 2 # Item used, end screen and consume item
else; Kernel.pbMessage(_INTL("Can't use that here.")); return 0
Kernel.pbMessage(_INTL("Can't use that here."))
Is there a place other than the pbs where I have to say my item is usable from bag?
I actually wrote it badly in the pbs and now replaced the 0 by 2 in the three last numbers which are now 2,0,6
It made a difference because now the window is closing but after the message "can't use that here" shows again I guess the triggerUseFromBag gives 2 because it's ending the screen but then the message shows and no picture is displayed
thanks in advance
SOLVED!!! I didn't define a itemhandlers.UseInField it now works perfectly.
The only little problem is I used the line
only in the UseFromBag, when used in both the picture was not showing at all. Now that it's only in UseFromBag the picture vanishes after what looks like a random time. To solve it I made it display a message after. It now wait the message to be passed by the player then the picture vanishes.
Thank you a whole lot to all of you especially Ego who literally solved it <3
As far as I can see your item setup seems to be correct, however I believe you are using the wrong handler.
I looked at how the town map works and it uses the following code:
So you also need an UseInField handler and a return value of 1.
Besides that: To show the image as long as the player want it to be shown you need to add a loop to your code. Otherwise the image will disappear "whenever it feels like it". I was about to make a video tutorial on how all this works, but didn't do it yet due to bad recording quality.
Your code for your image item should look somewhat like this:
viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z = 99999
image = Sprite.new(viewport)
image.bitmap = Bitmap.new(YOUR GRAPHIC FILE PATH)
image.x = 100
image.y = 100
if Input.trigger?(Input::C) # image will be closed and properly disposed when the player presses c / enter
pbWait(20)# wait a bit to prevent double input