I'd like to apologize for the long post, but it's really only long because I'm trying to clearly demonstrate what I'm doing so everyone has the relevant info.
Long story short, I'm making a point and click game, so I need to make the 'ShowPicture' scriptcall as streamlined as possible, because some scenes could possibly have up to 30 images that when clicked with the mouse will trigger interaction events.
(Note:the Background art is not mine and just a place holder to test out my picture interaction hitboxes)
-But trying to guess the XY coordinates of each hitbox picture to place onscreen with the ShowPictureCommand would be an nightmare.
-So I figured out that I can easily get the X, Y coordinates of where I want the picture to show onscreen by the following process:
I have a phase in during playtesting where I need to save certain Mouse coordinates to a variable, along with a number(to represent the pictureID#) that increases by 1 each time. Naturally the thing is saved as an array and looks like this:
Variable1: 11,400,200
Variable2: 12,240,311
etc
I was able to do this using 4 variables:
>2 that are set to the Mouse X and Mouse Y -which is constantly being tracked with a separate parallel event.
>And then another variable Called PicID to mark the Show picture Layer #. (because pictures can't have the same layer # without overwriting themselves).
>The fourth Variable is the VarSlotVar. And that one is to decide which Variable the above info gets saved into, otherwise, each new set of coordinates would just overwrite the same variable slot.
It's fairly simple. I have an event that runs parallel that detects ingame if I 'right click'. When I do, it saves the current mouse coordinates along with the picID (which starts out set to 11) into the slot decided by the VarSlotVar.
Then it adds 1 to the Pic Id and VarSlotVar.
By doing this, while the first saved var would be something like this, clicking again would move the slot:
Example:
(VarSlot) (Pic#), (x), (y)
Variable100: 11,568,319
Variable101: 12,656,396
-After I've clicked on all the pictures, I talk to an NPC that is set to display the \v[] of all the variables in order.
-Then I screenshot the info and feed it to program that will dump text into a text file.(I'd prefer to have a scriptcall save the variables to a textfile but I don't know how to do that so in the meantime the screenshot to txt program works just fine)
-Perfect! Everything's working fine.
------------------------------------------------
But then I thought, "Instead of having to manually copy and paste each pic# and X,Y value into each 'show picture' scriptcall about 20 times, what if I automate that too?"
So I made use of the set var scriptcall to save things as a mix of strings and variables.
Inputting this into the scriptbox:
$gameVariables.setValue(961, '$gameScreen.showPicture(' + '\x1bV[995]' + ', "X", 1, ' + '\x1bV[998]' + '\x1bV[999]' + ', 100, 100, 255, 0)');
I would then do the command ingame to receive this saved into variable 1:
$gameScreen.showPicture(11, "X", 1, 586, 478, 100, 100, 255, 0)
Which is great, because that is a properly formatted and usable scriptcall to showpicture, and as long as you've got an image with the filename 'X', it works perfectly ingame!
But during the last step, something goes wrong.
It's WEIRD and I can't explain why it happens, but it does.
The Setvariable Event with the new format:
Remember how earlier I was able to get about 10 different variable slots each with their own coordinates?
For some reason, whenever I try to use this new Set variable script command to save the variable into the new format, it OVERWRITES the previous variables too!
So all 10 variable slots will have the exact same value of the latest variable saved! T-T
Example:
I only have the scriptcall saving the info to one slot at a time, and even then the slot changes after each scriptcall! So I don't understand how it could possibly be overwriting the previous variables like this!?
Does anyone have any ideas?
(PS: if anyone has a plugin or a script snippet to do this better than my current way I'm also all ears >.>)
Long story short, I'm making a point and click game, so I need to make the 'ShowPicture' scriptcall as streamlined as possible, because some scenes could possibly have up to 30 images that when clicked with the mouse will trigger interaction events.
(Note:the Background art is not mine and just a place holder to test out my picture interaction hitboxes)
-But trying to guess the XY coordinates of each hitbox picture to place onscreen with the ShowPictureCommand would be an nightmare.
-So I figured out that I can easily get the X, Y coordinates of where I want the picture to show onscreen by the following process:
I have a phase in during playtesting where I need to save certain Mouse coordinates to a variable, along with a number(to represent the pictureID#) that increases by 1 each time. Naturally the thing is saved as an array and looks like this:
Variable1: 11,400,200
Variable2: 12,240,311
etc
I was able to do this using 4 variables:
>2 that are set to the Mouse X and Mouse Y -which is constantly being tracked with a separate parallel event.
>And then another variable Called PicID to mark the Show picture Layer #. (because pictures can't have the same layer # without overwriting themselves).
>The fourth Variable is the VarSlotVar. And that one is to decide which Variable the above info gets saved into, otherwise, each new set of coordinates would just overwrite the same variable slot.
It's fairly simple. I have an event that runs parallel that detects ingame if I 'right click'. When I do, it saves the current mouse coordinates along with the picID (which starts out set to 11) into the slot decided by the VarSlotVar.
Then it adds 1 to the Pic Id and VarSlotVar.
By doing this, while the first saved var would be something like this, clicking again would move the slot:
Example:
(VarSlot) (Pic#), (x), (y)
Variable100: 11,568,319
Variable101: 12,656,396
-After I've clicked on all the pictures, I talk to an NPC that is set to display the \v[] of all the variables in order.
-Then I screenshot the info and feed it to program that will dump text into a text file.(I'd prefer to have a scriptcall save the variables to a textfile but I don't know how to do that so in the meantime the screenshot to txt program works just fine)
-Perfect! Everything's working fine.
------------------------------------------------
But then I thought, "Instead of having to manually copy and paste each pic# and X,Y value into each 'show picture' scriptcall about 20 times, what if I automate that too?"
So I made use of the set var scriptcall to save things as a mix of strings and variables.
Inputting this into the scriptbox:
$gameVariables.setValue(961, '$gameScreen.showPicture(' + '\x1bV[995]' + ', "X", 1, ' + '\x1bV[998]' + '\x1bV[999]' + ', 100, 100, 255, 0)');
I would then do the command ingame to receive this saved into variable 1:
$gameScreen.showPicture(11, "X", 1, 586, 478, 100, 100, 255, 0)
Which is great, because that is a properly formatted and usable scriptcall to showpicture, and as long as you've got an image with the filename 'X', it works perfectly ingame!
But during the last step, something goes wrong.
It's WEIRD and I can't explain why it happens, but it does.
The Setvariable Event with the new format:
Remember how earlier I was able to get about 10 different variable slots each with their own coordinates?
For some reason, whenever I try to use this new Set variable script command to save the variable into the new format, it OVERWRITES the previous variables too!
So all 10 variable slots will have the exact same value of the latest variable saved! T-T
Example:
I only have the scriptcall saving the info to one slot at a time, and even then the slot changes after each scriptcall! So I don't understand how it could possibly be overwriting the previous variables like this!?
Does anyone have any ideas?
(PS: if anyone has a plugin or a script snippet to do this better than my current way I'm also all ears >.>)